ndmitchell / hlint

Haskell source code suggestions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"ignore: {}" causes restricted functions and imports to be ignored

langston-barrett opened this issue · comments

In HLint 2.2.2, the following config:

- ignore: {}
- functions:
  - {name: putStrLn, within: []}
- modules:
  - {name: [Data.List], as: List}

causes no warning to be issued on the following module:

module Main where
import Data.List as L
main :: IO ()
main = putStrLn $ L.intercalate " " ["hlint", "is", "awesome"]

whereas the appropriate warnings are raised without the ignore: {}. This is counterintuitive to me, because the README says:

These directives are applied in the order they are given, with later hints overriding earlier ones.

The logic is that when you type functions you are providing predicates for the banned function warning. However, you aren't enabling the banned function warning, just configuring it. So separately you ignored it, and haven't put in a corresponding unignore directive, so it remains ignored. Does that at least make sense why it happens that way?

Yeah, that makes sense. Is there a way to enable them after configuring them?

It seems like in the more normal configuration (not ignoring everything), enabling and configuring go hand in hand. But when using ignore: {}, these become separate steps. That makes sense of #747 as well, the difference there being that I figured out a workaround for that.