-
Notifications
You must be signed in to change notification settings - Fork 647
chore: add pre-commit hook to run validations #7882
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?
chore: add pre-commit hook to run validations #7882
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7882 +/- ##
==========================================
+ Coverage 72.72% 72.77% +0.04%
==========================================
Files 235 235
Lines 35100 35177 +77
==========================================
+ Hits 25528 25600 +72
- Misses 7755 7760 +5
Partials 1817 1817 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| This will configure Git to run the following checks before each commit: | ||
|
|
||
| * `make lint` |
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.
Nit: could we also run make lint.fix-golint
|
Would it be simpler to just add a precommit make target? |
zhaohuabing
left a comment
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.
LGTM Thanks!
|
thanks @syedazeez337 this looks good, can you share how much time this hook/make cmd takes ? want to make sure its not too long to start to annoy developers |
tools/make/lint.mk
Outdated
|
|
||
| .PHONY: precommit | ||
| precommit: ## Run all necessary steps to prepare for a commit. | ||
| precommit: lint.fix-golint lint test generate manifests gen-check |
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.
lets not run lint.fix-golint and change code, we can find an alt way to highlight this command to the user
.pre-commit-config.yaml
Outdated
| hooks: | ||
| - id: make-precommit | ||
| name: make precommit | ||
| entry: bash -c 'GITHUB_ACTION= make precommit' |
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.
why is GITHUB_ACTION= needed
|
Hi @arkodg
|
6fc32a8
|
that feels like a long time imo, should ideally be under 30s, does it take the same amount of time when run again ? |
Pre-commit Component TimingsLinters
Other Tasks
Possible Precommit Configurations
@arkodg What do you think should be kept in the pre-commit hook? |
Add a git pre-commit hook configuration (via pre-commit) that runs essential make targets locally before committing: - make lint - make test - make generate - make manifests - make gen-check This helps catch issues early and speeds up PR reviews by ensuring code passes validations before being pushed. Also updates the Developer Guide with instructions on how to install and use pre-commit. Fixes envoyproxy#7878 Signed-off-by: Azeez Syed <[email protected]>
Add a git pre-commit hook configuration (via pre-commit) that runs essential make targets locally before committing: - make lint.fix-golint - automatically fixes Go lint issues - make lint - verifies no lint issues remain - make test - make generate - make manifests - make gen-check This helps catch issues early and speeds up PR reviews by ensuring code passes validations before being pushed. Also updates the Developer Guide with instructions on how to install and use pre-commit, and adds a 'make precommit' target for convenience. Fixes envoyproxy#7878 Signed-off-by: Azeez Syed <[email protected]>
- Remove lint.fix-golint from precommit target to avoid auto-modifying code
- Remove GITHUB_ACTION= workaround from pre-commit config
- Fix root cause in lint.mk by using ${GITHUB_ACTION:-} to handle unset variable
Signed-off-by: Azeez Syed <[email protected]>
6fc32a8 to
6938870
Compare
|
hey @syedazeez337 thanks for running the tests and sharing this data, will bring it up in the community meeting this week |
Summary
make lint,make test,make generate,make manifests,make gen-checkTest plan
pre-commit run --all-filespassesFixes #7878