From b5960299f0a062db17a5113fdacf041a4ee51107 Mon Sep 17 00:00:00 2001 From: Bryan Cox Date: Wed, 4 Dec 2024 09:44:56 -0500 Subject: [PATCH 1/2] Add default stages/install hook type to pre-commit This commit adds default stages and default install hook types to the pre-commit configuration. In addition, it adds the stages in which certain hooks should be run. Signed-off-by: Bryan Cox --- .pre-commit-config.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2d1ba23efdb..e0dabfabe72 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,25 +1,34 @@ +default_stages: [pre-commit, pre-push] +default_install_hook_types: [pre-commit, pre-push] repos: - repo: https://github.com/gitleaks/gitleaks rev: v8.21.1 hooks: - id: gitleaks + stages: [pre-commit] - repo: https://github.com/koalaman/shellcheck-precommit rev: v0.10.0 hooks: - id: shellcheck args: ["--external-sources"] + stages: [pre-commit] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: end-of-file-fixer + stages: [pre-commit] - id: trailing-whitespace + stages: [pre-commit] - id: detect-private-key + stages: [pre-commit] - repo: https://github.com/pylint-dev/pylint rev: v3.3.1 hooks: - id: pylint exclude: ^hack/boilerplate/boilerplate.py$ + stages: [pre-commit] - repo: https://github.com/jumanjihouse/pre-commit-hooks rev: 3.0.0 hooks: - - id: forbid-binary + - id: forbid-binary + stages: [pre-commit] From b33199c3b7017e712d9612b2dfff8a53313218a7 Mon Sep 17 00:00:00 2001 From: Bryan Cox Date: Wed, 4 Dec 2024 10:29:30 -0500 Subject: [PATCH 2/2] Add make verify/test to pre-push pre-commit config This commit adds the same checks run in `make verify` without duplicating any previous hook runs in pre-commit to the pre-commit configuration. In addition, this commit adds `make test` to the pre-push stage of the pre-commit configuration. This will ensure `verify` and `test` are successfully passing before the commit is pushed. This will help reduce time and test resources by preventing `verify` and `test` from failing on the pull request in GitHub. Signed-off-by: Bryan Cox --- .pre-commit-config.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0dabfabe72..c1d67c37a02 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,3 +32,35 @@ repos: hooks: - id: forbid-binary stages: [pre-commit] +- repo: local + hooks: + - id: make-modules + name: Run make verify-modules + entry: make verify-modules + language: system + stages: [pre-push] + - id: make-gen + name: Run make verify-gen + entry: make verify-gen + language: system + stages: [pre-push] + - id: make-spellcheck + name: Run make verify-shellcheck + entry: make verify-shellcheck + language: system + stages: [ pre-push ] + - id: make-conversions + name: Run make verify-conversions + entry: make verify-conversions + language: system + stages: [ pre-push ] + - id: make-tiltfile + name: Run make verify-tiltfile + entry: make verify-tiltfile + language: system + stages: [ pre-push ] + - id: make-test + name: Run make test + entry: make test + language: system + stages: [pre-push]