chshersh / iris

🌈 Haskell CLI Framework supporting Command Line Interface Guidelines
https://hackage.haskell.org/package/iris
Mozilla Public License 2.0
176 stars 21 forks source link

Configure pre-commit hooks #69

Closed chshersh closed 1 year ago

chshersh commented 1 year ago

Currently, only for whitespace cleanups. Later, things like hlint and fourmolu will be added.

Examples can be found here:

aleeusgr commented 1 year ago

I started to work on this. Thank you for the opportunity.

I will post my thoughts, feel free to ignore or comment

aleeusgr commented 1 year ago

i've met the idea of pre-commit hooks here however this repo does not use nix, so it would seem pre-commit is a tool I have to have locally in order for me to be able to test how the config file works.

$ nix shell nixpkgs#pre-commit $ pre-commit --version pre-commit 2.20.0

aleeusgr commented 1 year ago

reading this guide The hooks are all stored in the hooks subdirectory of the Git directory. In most projects, that’s .git/hooks. The pre-commit hook is run first, before you even type in a commit message. It’s used to inspect the snapshot that’s about to be committed.

This guide

You can generate a very basic configuration using pre-commit sample-config pre-commit run : this is what pre-commit runs by default when committing. This will run all hooks against currently staged files.

aleeusgr commented 1 year ago

$ pre-commit sample-config > .pre-commit-config.yaml $ pre-commit run

[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...........................................(no files to check)Skipped
Check for added large files..............................................Passed
aleeusgr commented 1 year ago

https://github.com/chshersh/iris/pull/72

aleeusgr commented 1 year ago

here are a hooks for hlint and styish-haskell and fourmolu

I will add them when PR#72 is merged or upon confirmation that I am doing it right. Thank you

chshersh commented 1 year ago

Hey @aleeusgr, thanks for the contribution!

Adding hlint would be nice indeed, so feel free to add it after 🙂 I haven't looked intro fourmolu and haven't created the config that satisfies my taste so no rush in adding formatter here 👍🏻

chshersh commented 1 year ago

Closed in #72