vim-syntastic / syntastic

Syntax checking hacks for vim
Do What The F*ck You Want To Public License
11.3k stars 1.14k forks source link

Add errorformat handlers for HLint's column and line ranges #2334

Closed chrislf closed 4 years ago

chrislf commented 4 years ago

Hlint 3 introduced column ranges and multi-line ranges into its output: https://github.com/ndmitchell/hlint/commit/42cbbe03156232757d3716b9fb5993ab2593eff3

The current hlint checker does not match these and therefore ignores them.

I have a branch with an updated errorformat which matches the new formats in addition to the old, tested with Vim 8.2.1123 against Hlint's own test files. The testing shows:

Here is the diff: https://github.com/vim-syntastic/syntastic/compare/master...chrislf:master

Do you need more testing of this change before I submit a PR?

lcd047 commented 4 years ago

Please post some representative samples of hlint messages with the new formats.

chrislf commented 4 years ago

Sure!

Input file:

f x =
  map
    id
    x

g h x = head (sortBy h x) 

Hlint v3.1.6 results:

$ hlint data/GLTest.hs 
data/GLTest.hs:(1,1)-(4,5): Warning: Eta reduce
Found:
  f x = map id x
Perhaps:
  f = map id

data/GLTest.hs:(2,3)-(3,6): Warning: Redundant map
Found:
  map id
Perhaps:
  id

data/GLTest.hs:6:9-25: Warning: Use minimumBy
Found:
  head (sortBy h x)
Perhaps:
  minimumBy h x

3 hints
lcd047 commented 4 years ago

Normally having ranges like this would allow writing a GetHighlightRegex() function, but making it survive switching back and forth between spaces and tabs is not trivial. I suppose your patch will do, please make a pull request.

chrislf commented 4 years ago

PR submitted: thanks!

lcd047 commented 4 years ago

Merged: 20fb41c.