From 71683f30934c7626dc9ed6722b52210903086b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20De=20la=20Torre=20Vico?= Date: Thu, 7 May 2026 11:19:40 +0200 Subject: [PATCH] chore: remove pre-push from default install hook types (#11072) --- .pre-commit-config.yaml | 23 ++++------------------- docs/developer-guide/introduction.mdx | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1f55160b4c..a7b0ca8f5e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ # P40 — security scanners # P50 — dependency validation -default_install_hook_types: [pre-commit, pre-push] +default_install_hook_types: [pre-commit] repos: ## GENERAL (prek built-in — no external repo needed) @@ -62,12 +62,7 @@ repos: - id: autoflake name: "SDK - autoflake" files: { glob: ["{prowler,tests,dashboard,util,scripts}/**/*.py"] } - args: - [ - "--in-place", - "--remove-all-unused-imports", - "--remove-unused-variable", - ] + args: ["--in-place", "--remove-all-unused-imports", "--remove-unused-variable"] priority: 20 - repo: https://github.com/pycqa/isort @@ -179,8 +174,7 @@ repos: language: system types: [python] files: '.*\.py' - exclude: - { glob: ["{contrib,skills}/**", "**/.venv/**", "**/*_test.py"] } + exclude: { glob: ["{contrib,skills}/**", "**/.venv/**", "**/*_test.py"] } priority: 40 - id: safety @@ -190,16 +184,7 @@ repos: entry: safety check --policy-file .safety-policy.yml language: system pass_filenames: false - files: - { - glob: - [ - "**/pyproject.toml", - "**/poetry.lock", - "**/requirements*.txt", - ".safety-policy.yml", - ], - } + files: { glob: ["**/pyproject.toml", "**/poetry.lock", "**/requirements*.txt", ".safety-policy.yml"] } priority: 40 - id: vulture diff --git a/docs/developer-guide/introduction.mdx b/docs/developer-guide/introduction.mdx index 03b3bd27bd..8fccf1b202 100644 --- a/docs/developer-guide/introduction.mdx +++ b/docs/developer-guide/introduction.mdx @@ -134,6 +134,22 @@ prek installed at `.git/hooks/pre-commit` If pre-commit hooks were previously installed, run `prek install --overwrite` to replace the existing hook. Otherwise, both tools will run on each commit. +#### Enable TruffleHog as a Pre-Push Hook + +By default, only `pre-commit` hooks are installed. To enable [`TruffleHog`](https://github.com/trufflesecurity/trufflehog) secret scanning on every push, install the `pre-push` hook type explicitly: + +```shell +prek install --hook-type pre-push +``` + +Successful installation should produce the following output: + +```shell +prek installed at `.git/hooks/pre-push` +``` + +Once installed, TruffleHog runs before each push and blocks the operation when verified secrets are detected. + ### Code Quality and Security Checks Before merging pull requests, several automated checks and utilities ensure code security and updated dependencies: