feat: Add a very basic pre-commit configuration#683
Conversation
Signed-off-by: Peter Fiddes <peter.fiddes@jetstack.io>
|
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. DetailsNeeds 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.yamlUpon 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! 😇 |
erikgb
left a comment
There was a problem hiding this comment.
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. |
Signed-off-by: Peter Fiddes <peter.fiddes@jetstack.io>
|
New changes are detected. LGTM label has been removed. |
Signed-off-by: Peter Fiddes <peter.fiddes@jetstack.io>
|
Thanks all for the feedback.
@SgtCoDFish - I could follow up with a PR to the website under contributing as you suggested? In the context, these are provided as optional to use? |
|
Issues go stale after 6 months of inactivity. |
|
Stale issues rot after 3 months of inactivity. |
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 🤞