[feature] stylish-haskell as a pre-commit hook #481
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
i've tried to add pre-commit support for users of stylish-haskell.
You can test it, by
Example
outside thestylish-haskell
repocd Example
git init
example/Bad.hs
from the stylish-haskell repo to your folderExample
git add Bad.hs
git commit -m "initial commit"
pre-commit try-repo your/local/path/to/repo/stylish-haskell/ --all-files
Bad.hs
should be formatted nowEDIT:
additional:
.pre-commit-config.yaml
in the repoExample
with:Bad.hs
/EDIT
Be aware that the
try-repo
command ofpre-commit
works with HEAD of the local stylish-haskell repo, so commit your changes of.pre-commit-hooks.yaml
.The
--all-files
argument ensures that yourBad.hs
is not skipped (and that's the reason why I don't use the command instylish-haskell/examples
, as it would change every.hs
file in the repo).Pre-commit uses
cabal
to install stylish-haskell. I've tested this with ghc 9.8.2 andcabal 3.10.3.0.
People should be able to use now
stylish-haskell
in pre-commit by adding this to their.pre-commit-config.yaml
and runningpre-commit run --all-files
or committing in their haskell project repo.Thank you
Greetings
LucBro