-
-
Notifications
You must be signed in to change notification settings - Fork 399
Add action for ignoring HLint hint for a single definition #4670
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
base: master
Are you sure you want to change the base?
Conversation
topDir, | ||
wopt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports are a bit of a mess, due to this file defining its own RealSrcSpan
and others, because of the option to use ghc-lib
rather than ghc
. I'm not certain I've got it right for all versions. Hopefully CI will let us know.
05170e9
to
97db3bc
Compare
97db3bc
to
5a95caa
Compare
RealSrcLoc sl _ -> Just (srcLocLine sl - 1) | ||
UnhelpfulLoc _ -> Nothing | ||
-- TODO `documentSymbolForDecl` wasn't intended to be exported, and computes more than we need | ||
-- (although laziness should save us there) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fendor Do you know a better way to go LHsDecl GhcPs -> Maybe Text
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise we can factor out the required part of documentSymbolForDecl
, and use it there and here.
containingDecl <- find (maybe False (positionInRange pos) . srcSpanToRange . getLoc) | ||
$ hsmodDecls $ unLoc $ pm_parsed_source pm | ||
defStartLine <- case srcSpanStart $ getLoc containingDecl of | ||
-- TODO `srcLocLine` can apparently raise an error, but it's not clear what the safe version is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to look in to this...
Based on #4669. While working on that, I realised that this should be fairly easy. Six hours later...
I've only done some light manual testing, but it seems to generally work. The one issue I've found is that the ignore comment is inserted after a value definition's type signature, when there is one, which is probably not what we want.
There's also some general code cleanup to do. See TODO comments. I'll get to that once #4669 is merged. As well as adding tests.
It doesn't actually matter where the ignore comment is placed, but I figured that at the top of the relevant definition is conventional.