git-hooks.nix icon indicating copy to clipboard operation
git-hooks.nix copied to clipboard

`stylish-haskell` "benign failures"

Open michaelpj opened this issue 4 years ago • 1 comments

stylish-haskell exits 1 on files it can't deal with, with a typical example being anything containing CPP.

This is a "benign failure" in that it just means that it can't process the file. However, it has the effect of making the pre-commit hook fail.

I'm not sure quite what the right solution is:

  • Swallow the stylish-haskell exit code in the hook? Might mask some more genuine failures.
  • Require users to exclude such files themselves? A bit of a pain...

michaelpj avatar Nov 12 '20 15:11 michaelpj

I excluded files for ormolu when it didn't handle them.

You could write a script that checks for CPP pragma and write a list of files to exclude in JSON and then feed that to pre-commit.

domenkozar avatar Nov 13 '20 10:11 domenkozar