Closed chshersh closed 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
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
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.
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.
$ 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
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 👍🏻
Closed in #72
Currently, only for whitespace cleanups. Later, things like
hlint
andfourmolu
will be added.Examples can be found here: