hlint icon indicating copy to clipboard operation
hlint copied to clipboard

ignore: {} ignores custom rules

Open phadej opened this issue 4 years ago • 2 comments

An example:

{-# LANGUAGE FunctionalDependencies #-}
module HLintExample where

example = foo bar 42

example2 = maybe False id example

Without ignore: {}

Using a .hlint.yaml with a custom rule

- warn: {lhs: "foo bar", rhs: "foobar"}

we get expected results:

% hlint --hint=hlint.yaml HLintExample.hs
HLintExample.hs:1:1-39: Warning: Unused LANGUAGE pragma
Found:
  {-# LANGUAGE FunctionalDependencies #-}
Perhaps you should remove it.
Note: may require `{-# LANGUAGE MultiParamTypeClasses #-}` adding to the top of the file

HLintExample.hs:4:11-17: Warning: Use foobar
Found:
  foo bar
Perhaps:
  foobar

HLintExample.hs:6:12-25: Warning: Use fromMaybe
Found:
  maybe False id
Perhaps:
  Data.Maybe.fromMaybe False

With ignore: {}

But say, we don't like default warn set and do

- ignore: {}
- warn: {name: Unused LANGUAGE pragma}
- warn: {lhs: "foo bar", rhs: "foobar"}

I'd expect to get two hints from the example file now, i.e. ignore Use fromMaybe hint. However:

HLintExample.hs:1:1-39: Warning: Unused LANGUAGE pragma
Found:
  {-# LANGUAGE FunctionalDependencies #-}
Perhaps you should remove it.
Note: may require `{-# LANGUAGE MultiParamTypeClasses #-}` adding to the top of the file

1 hint

custom rule doesn't fire anymore.


% hlint --version                        
HLint v3.3, (C) Neil Mitchell 2006-2021

phadej avatar Mar 28 '21 12:03 phadej