hlint icon indicating copy to clipboard operation
hlint copied to clipboard

how to enable one specific ruleset?

Open jwaldmann opened this issue 4 years ago • 2 comments

How do I enable just the warnings/suggestions provided by the rules from one file? (https://github.com/NorfairKing/haskell-dangerous-functions/issues/18)

I tried

hlint --hint=hlint.yaml src/ 

but this will use hlint's built-in rules as well - I think that's the meaing of the first to lines of .. -v .. output

# Initialise of global flags... took 0.00s
# Config of data/hlint.yaml... took 0.17s
# Config of hlint.yaml... took 0.00s
# Parse of src/...

I tried to put - ignore: { } at the start, but then I get no output at all (I think that's https://github.com/ndmitchell/hlint/issues/748)

jwaldmann avatar Nov 30 '21 20:11 jwaldmann

Currently, if you put - ignore: { } at the start, then you must explicitly turn on any hint you want. In other words, this does not produce any hint:

- ignore: { }
- warn: {lhs: mapM, rhs: traverse}

You need to turn on the hint by

- ignore: { }
- warn: {name: Use traverse}
- warn: {lhs: mapM, rhs: traverse}

This is obviously redundant, and what's worse, the hint name "Use traverse" is auto-generated, and may not be obvious to whoever created the hint. I think we should make it so that whatever follows - ignore is turned on automatically.

zliu41 avatar Dec 08 '21 21:12 zliu41

That seems a very reasonable solution @zliu41 - patch welcome

ndmitchell avatar Dec 12 '21 20:12 ndmitchell