ndmitchell / hlint

Haskell source code suggestions
Other
1.48k stars 195 forks source link

Adding severity to restrictions #1528

Open alt-romes opened 1 year ago

alt-romes commented 1 year ago

First off, thanks for the great tool! Secondly, I've been trying to add a severity to my restrictions:

I currently have

- modules:
  - {name: Unsafe.Linear, within: Ghegin.Core.*}

but this triggers a warning message, while I'd really like this to trigger an error message.

Is there a way to do that?

Thanks in advance.

ndmitchell commented 1 year ago

I think you should be able to do this with:

- error: {name: Avoid restricted module}

But that applies to all modules, not just the one you want. I think changing this makes sense if you need it - you could imagine severity: error as an extra key, and wire it in as an extra key in Restrict https://github.com/ndmitchell/hlint/blob/252b1915ac8fa479b188d8f6f382d8bb163531ad/src/Config/Type.hs#L156-L167. Probably not a bad first issue.