Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure pre-commit hooks #69

Closed
chshersh opened this issue Sep 30, 2022 · 8 comments
Closed

Configure pre-commit hooks #69

chshersh opened this issue Sep 30, 2022 · 8 comments
Labels
⚗️ dx Dev experience improvements good first issue Good for newcomers hacktoberfest https://hacktoberfest.com/

Comments

@chshersh
Copy link
Owner

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

Examples can be found here:

@chshersh chshersh added good first issue Good for newcomers ⚗️ dx Dev experience improvements hacktoberfest https://hacktoberfest.com/ labels Sep 30, 2022
@aleeusgr
Copy link
Contributor

aleeusgr commented Oct 2, 2022

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

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

@aleeusgr
Copy link
Contributor

aleeusgr commented Oct 2, 2022

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
Copy link
Contributor

aleeusgr commented Oct 2, 2022

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
Copy link
Contributor

aleeusgr commented Oct 2, 2022

$ 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
Copy link
Contributor

aleeusgr commented Oct 2, 2022

#72

@aleeusgr
Copy link
Contributor

aleeusgr commented Oct 2, 2022

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
Copy link
Owner Author

chshersh commented Oct 3, 2022

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 added a commit that referenced this issue Oct 3, 2022
Co-authored-by: alexeusgr <alexeusgr@gmail.com>
Co-authored-by: Dmitrii Kovanikov <kovanikov@gmail.com>
@chshersh
Copy link
Owner Author

chshersh commented Oct 3, 2022

Closed in #72

@chshersh chshersh closed this as completed Oct 3, 2022
@chshersh chshersh added this to the v0.1.0.0: Improved UX milestone Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚗️ dx Dev experience improvements good first issue Good for newcomers hacktoberfest https://hacktoberfest.com/
Projects
None yet
Development

No branches or pull requests

2 participants