haskell / haskell/haskell-language-server

Don't apply hlint to source code generated by ghc plugins

Open
#2,571 2 comments 2 reactions 0 assignees View on GitHub
component: hls-hlint-plugin type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
3d 21h
Merged PRs (30d)
13

Description

### Steps to reproduce

- Clone https://github.com/codygman/hls-hlints-source-plugin-generated-code/blob/2c170e5b5f446fb3362d967db3fe8a87fe2c7215/src/Main.hs#L8
- Go to [line 8: ToJSON](https://github.com/codygman/hls-hlints-source-plugin-generated-code/blob/2c170e5b5f446fb3362d967db3fe8a87fe2c7215/src/Main.hs#L8)
- let hls finish loading up

### Expected behaviour

Source code generated by the evoke source plugin or other source plugins has hlint and any custom hlint rules applied to it that aren't relevant to your codebase.

### Actual behaviour
You'll see a squiggle for the ["use into" rule](https://github.com/codygman/hls-hlints-source-plugin-generated-code/blob/2c170e5b5f446fb3362d967db3fe8a87fe2c7215/hlint.yaml#L4) because the generated code uses `Text.pack` [internally](https://github.com/tfausak/evoke#tojson).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the report with src/Main.hs at line 8 from the linked example and inspect the hlint.yaml rule at line 4. Trace how HLS applies hlint to source generated by the evoke or other GHC source plugins; done means generated code no longer receives irrelevant hlint or custom-rule diagnostics while ordinary code still does.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.