light-heart-labs--ods
56 行
2.4 KiB
YAML
56 行
2.4 KiB
YAML
# Pre-commit hooks for secret scanning + shell hygiene.
|
|
# Install: pip install pre-commit && pre-commit install
|
|
# Run manually: pre-commit run --all-files
|
|
|
|
repos:
|
|
- repo: https://github.com/gitleaks/gitleaks
|
|
rev: v8.21.2
|
|
hooks:
|
|
- id: gitleaks
|
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v5.0.0
|
|
hooks:
|
|
- id: detect-private-key
|
|
- id: check-added-large-files
|
|
args: ['--maxkb=500']
|
|
|
|
# Shellcheck on the installer + scripts surface. Mirrors the failing
|
|
# second pass of .github/workflows/lint-shell.yml — `--severity=error`
|
|
# is the bar that already gates CI, so existing warnings on the tree
|
|
# do not tip the pre-commit run while genuine errors are caught
|
|
# locally before push.
|
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
rev: v0.10.0.1
|
|
hooks:
|
|
- id: shellcheck
|
|
name: shellcheck (installer + scripts, errors only)
|
|
files: ^ods/(installers|scripts)/.*\.(sh|bash)$
|
|
args: ['--exclude=SC1091,SC2034', '--severity=error']
|
|
|
|
# Catch legacy `…` command substitution anywhere in the installer
|
|
# surface. SC2006 is style-level so it's filtered out by the
|
|
# severity=error pass above; an explicit --include re-enables it
|
|
# without dragging the rest of style-level noise back in. The tree
|
|
# is currently zero-SC2006, so this hook starts as a regression guard.
|
|
- id: shellcheck
|
|
name: shellcheck SC2006 (no legacy backticks)
|
|
files: ^ods/(installers|scripts)/.*\.(sh|bash)$
|
|
args: ['--include=SC2006']
|
|
|
|
# Custom local hook (issue #509): forbid backticks inside the BODY of
|
|
# unquoted here-documents. Even when the rest of the file passes
|
|
# shellcheck, an `<<EOF` heredoc body that contains `…` will silently
|
|
# run command substitution — which is easy to miss in a code review of
|
|
# generated systemd units, config files, or README fragments shipped
|
|
# by installer phases. Quoted heredocs (<<'EOF' / <<"EOF") are
|
|
# exempt because they suppress expansion entirely.
|
|
- repo: local
|
|
hooks:
|
|
- id: no-backticks-in-installer-heredocs
|
|
name: no-backticks-in-installer-heredocs
|
|
description: Forbid `…` command substitution inside unquoted heredoc bodies under ods/installers and ods/scripts.
|
|
language: system
|
|
files: ^ods/(installers|scripts)/.*\.(sh|bash)$
|
|
entry: awk -f ods/scripts/check-heredoc-backticks.awk
|