-
Notifications
You must be signed in to change notification settings - Fork 93
feat: Add a very basic pre-commit configuration #683
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Peter Fiddes <[email protected]>
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hey, I've tested it and it works: $ brew install pre-commit
$ pre-commit install
$ echo " " >>deploy/charts/trust-manager/values.yaml
$ git ci -a -m test
trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook
Fixing deploy/charts/trust-manager/values.yaml
fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook
Fixing deploy/charts/trust-manager/values.yaml Upon testing it, I am slightly annoyed by the slowness of I'm using my editor (VS Code + trailing-spaces extension) for spotting trailing whitespace and removing them, and also for spotting missing EOF newlines. Not sure what to do next, so leaving it up to other maintainers! 😇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a huge fan of pre-commit hooks, but I have no issues with them being added to our projects - if it's helpful for other contributors. I just tested this feature branch locally, and as I don't use pre-commit hooks everything seems to be working as before.
Change looks good to me, but I would like @SgtCoDFish to have an opinion on this as well.
/lgtm
My starting point for reviewing this is: would this cause a large maintenance burden or would this break anything? I don't think it'll do either of those things - for most it would at worst be a slight distraction. I wouldn't personally use this, because I really value a high level of control over my commits, but I can see why this might be valuable to others. I'd be happy to merge this given it has very low impact - I think my gut says that this would be a good fit for a page under https://cert-manager.io/docs/contributing/ so it's not explicitly in-repo, but I don't think that's a blocker. |
In #680 there were a couple of nits that I would personally solve by using pre-commit. I have added the most basic configuration here as a discussion topic. There may be other ways or tools to achieve the same goal of "not having to correct whitespace or newline nits"
Assuming you have this checked out:
Reasons to have it
--all-files
)Concerns / addressed
I've left this section to record concerns about adding this, in the hope they can be addressed.
Will talk about this on some standup 🤞