-
Notifications
You must be signed in to change notification settings - Fork 910
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
Add pre commit #681
Add pre commit #681
Conversation
With existing configuration preference
I think this is an outstanding repo, and am very grateful for its availability. In particular the techniques for factory resource generation will be very useful for our organisation. Applying some standardised QA is my small way of trying to say thanks 🙏 |
default_language_version: | ||
python: python3 | ||
repos: | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks |
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'm a bit wary about relying on external code which we will then need to audit regularly, and would prefer coming up with our own static versions of pre commits
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 generally like the idea and thanks for taking the time to send this PR, but I see two issues that will require at least some internal discussion
- reliance on external code, which would need to be regularly audited
- increased friction for contributors who only work on Terraform and might not have Python or a working vitualenv installed
Let's use the comments to discuss these two points.
+1 @ludoo's comments. I like the overall idea but we're introducing a ton of dependencies (pre-commit, random third-party plugins, etc). Some of the checks also break the standard conventions for certain code (e.g. the remove-tabs task is removing tabs from Go code). That being said, I like the idea of a Makefile to simplify some tasks. @27Bslash6 @ludoo what do you think of a simple Makefile to run the existing tools (check, lint, tests etc) without introducing extra checks/tools? |
Thanks for taking the time to peruse, folks! A few thoughts:
|
I'm going to close this, as it adds friction with no clear benefit. Feel free to reopen individual issues for each pre-commit feature and we can discuss there. |
tldr
Minimal QA Uplift and Automation
With reference to the previous PR, these changes introduce only one additional, optional (highly recommended) developer dependency:
pre-commit
, and offers guidance on its installation.In doing so, we ensure that all standard linting and custom business logic QA is applied before PR review, including the existing yapf style choice, boilerplate, documentation, links and name length checks.
Rationale
Pre-commit
I believe the addition of this one tool will significantly improve DX and reduce cognitive load for both the developer and those responsible for code review. Reducing manual pre- and post-commit burden should also reduce the size of
CONTRIBUTING.md
as much of the QA will be implemented automatically, including Terraform and Python formatting, vulnerability checks, tdfoc creation etc, however I have elected to minimise the number of changes toCONTRIBUTING
at this time, until code owners validate the proposed new developer flow.Changes
No breaking changes are included in this PR. The use of the pre-commit hook is optional.
The only changes to the main codebase are aesthetic:
The
check-documentation
hook indicated that thecompute-mig
readme had missed changes, and so that file has been updated also.A Makefile is included for convenience, but the use of which is optional.
Note: this will conflict with #680 so will rebase one or the other if accepted.