-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hlint produces suggestions for code inserted by preprocessor #1245
Comments
If you are using HLS, then HLint sees the code after preprocessing. If you are using The |
I see that the issue seems more complex and asking more questions than I expected. To avoid more questions, perhaps you put a note where the For code with preprocessors I will use hlint on the command line when I really need it. usually I can ignore the effects when looking at the hints and warnings fro hlint. In general, i find hlint very helpful, especially when pointing out unused things. what I would wish for, but which is not in the design enveloppe, are unused imports, unused dependencies and, especially, unused functions. HLS makes good progress and might eventually help with these. - thank you for your help over the years! andre |
If I understand correctly, GHC itself is capable of warning about these. You just need |
The comment about HLint running over the output of `tasty-discover` is only actually true within HLS and not through a local command line or on CI. See ndmitchell/hlint#1245 (comment). Until haskell/haskell-language-server#638 is fixed, we're going to have to deal with spurious HLint warnings from HLS anyway. It should be easy to silence them in all LSP clients. And even without that issue, we'll sometimes see extra hints in HLS due to version mismatches, since the HLint in HLS is statically linked, so we have no control over the version. For example, HLS 1.4 alerts to some redundant parentheses at line 140 in `Tests/Gen/Core/Typed.hs`, but these hints have been disabled in a recent HLint version - see ndmitchell/hlint#1282.
The comment about HLint running over the output of `tasty-discover` is only actually true within HLS and not through a local command line or on CI. See ndmitchell/hlint#1245 (comment). Until haskell/haskell-language-server#638 is fixed, we're going to have to deal with spurious HLint warnings from HLS anyway. It should be easy to silence them in all LSP clients. And even without that issue, we'll sometimes see extra hints in HLS due to version mismatches, since the HLint in HLS is statically linked, so we have no control over the version. For example, HLS 1.4 alerts to some redundant parentheses at line 140 in `Tests/Gen/Core/Typed.hs`, but these hints have been disabled in a recent HLint version - see ndmitchell/hlint#1282.
use case: HTF wiih the pragma
{-# OPTIONS_GHC -F -pgmF htfpp #-}
produces many hints about the bracket the precompiler inserts (defensively, I think):
I tried to avoid this by adding to my hlint.yaml:
- arguments: [-XNoCPP]
but did not work (I restarted HSL, what else would have been necessary), the same hints are produced (which I can not act on).
I am confused assuming that
-XNoCPP
would avoid running the preprocessor on my code and show me only the hints I can fix. What is my misunderstanding? How to achieve thathlint
shows only user fixable things?Thank you for a VERY useful tool!
The text was updated successfully, but these errors were encountered: