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

Added nix check and pre commit hook for formatting #220

Merged
merged 2 commits into from
Mar 6, 2023

Conversation

Alexnortung
Copy link
Contributor

@Alexnortung Alexnortung commented Mar 2, 2023

After making my first commits to this project in a while I was met with an angry CI that didn't like I did not run nix fmt before committing/pushing. So I thought a good idea would be to provide a pre-commit hook, so I and others don't forget to format before committing.

Thanks to cachix/pre-commit-hooks.nix this was quite easy to implement.

To install the pre commit hooks simply open the devShell in the repository (nix develop). Or if you have direnv it will load automatically.

This was also referenced a while back in another issue #114 (comment)

Edit:
On a second thought I am not sure if it is a good idea to have a check too. Since the CI now checks the formatting twice, however we could probably replace the nix fmt -- -c command with just checking the pre commit hook.

@pta2002
Copy link
Collaborator

pta2002 commented Mar 3, 2023

Yeah, I'd add the nix fmt -- -c to nix check in that case, and remove it from CI, it's probably for the best

@Alexnortung
Copy link
Contributor Author

Alright, do you want me to remove it from the CI?

@pta2002
Copy link
Collaborator

pta2002 commented Mar 4, 2023

Yeah, if you need help with that just say though

@pta2002 pta2002 merged commit 2c333c8 into nix-community:main Mar 6, 2023
@Alexnortung Alexnortung deleted the pre-commit branch March 6, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants