The refuse-claude-md pattern was case-sensitive, so claude.md or CLAUDE.MD passed it, yet a case-insensitive file system serves either as CLAUDE.md. Match with the inline (?i) flag. The hook config is a ci image input, so the ci image moves from 0.2.37 to 0.2.38. Assisted-by: Claude Code
144 lines
6.2 KiB
YAML
144 lines
6.2 KiB
YAML
# Hook repositories are pinned by commit SHA, with the release in a `# frozen:` comment: a
|
|
# tag can be moved, a commit cannot, so a moved tag shows up as a failed fetch and not as
|
|
# new code in the hook environment (supply chain, ci image and contributors alike).
|
|
# Renovate's pre-commit manager keeps a frozen rev in its frozen form when it updates it (it never
|
|
# creates one). To pin by hand, list both refs and take the `^{}` (peeled) line when there is one,
|
|
# the plain line otherwise: `git ls-remote <repo> "refs/tags/<tag>" "refs/tags/<tag>^{}"`.
|
|
default_install_hook_types: [pre-commit, commit-msg, pre-push]
|
|
|
|
repos:
|
|
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
rev: 33b50eb042bee26eac0ee96ad84aa9c1b4dccdd8 # frozen: v4.5.0
|
|
hooks:
|
|
- id: conventional-pre-commit
|
|
stages: [commit-msg]
|
|
|
|
- repo: https://github.com/gitleaks/gitleaks
|
|
rev: 83d9cd684c87d95d656c1458ef04895a7f1cbd8e # frozen: v8.30.1
|
|
hooks:
|
|
- id: gitleaks
|
|
stages: ['pre-commit']
|
|
|
|
- repo: https://github.com/adrienverge/yamllint
|
|
rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0
|
|
hooks:
|
|
- id: yamllint
|
|
args: [--strict]
|
|
stages: ['pre-commit']
|
|
|
|
# Python and shell scripts under scripts/ and tests/scripts/ (#112). ruff.toml holds the
|
|
# configuration. No --fix: a finding fails the hook instead of rewriting files in CI.
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: 9026c9127e153371d7a78dfcb0c45ae2046a3d10 # frozen: v0.17.6
|
|
hooks:
|
|
- id: ruff-check
|
|
stages: ['pre-commit']
|
|
- id: ruff-format
|
|
stages: ['pre-commit']
|
|
|
|
# shellcheck-py ships the shellcheck binary as a wheel, so no system package is needed.
|
|
# Default severity, no .shellcheckrc. actionlint (below) covers the run: blocks of workflows.
|
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1
|
|
hooks:
|
|
- id: shellcheck
|
|
stages: ['pre-commit']
|
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
|
|
hooks:
|
|
- id: check-toml
|
|
stages: ['pre-commit']
|
|
- id: check-merge-conflict
|
|
stages: ['pre-commit']
|
|
|
|
# Blocking. .gitea/actionlint.yaml declares the runner labels. The workflows use the
|
|
# github.* contexts (Gitea aliases them), because actionlint does not know gitea.*.
|
|
# actionlint runs shellcheck over run: blocks when shellcheck is on PATH.
|
|
- repo: https://github.com/rhysd/actionlint
|
|
rev: 914e7df21a07ef503a81201c76d2b11c789d3fca # frozen: v1.7.12
|
|
hooks:
|
|
- id: actionlint
|
|
args: [-config-file, .gitea/actionlint.yaml]
|
|
files: ^\.gitea/workflows/.*\.ya?ml$
|
|
stages: ['pre-commit']
|
|
|
|
# zizmor finds security problems in workflows (pull_request_target, ${{ }} expanded into
|
|
# run:). Its own files: pattern only matches .github/, so point it at .gitea/workflows.
|
|
# --offline: no network audits, so a run needs no token and gives the same result everywhere.
|
|
# Overriding args drops the hook's default, so --no-progress is repeated here.
|
|
- repo: https://github.com/zizmorcore/zizmor-pre-commit
|
|
rev: c7d31dc612dffdd4d3b2f2b88b9660d3ab057ee8 # frozen: v1.33.1
|
|
hooks:
|
|
- id: zizmor
|
|
args: [--no-progress, --offline]
|
|
files: ^\.gitea/workflows/[^/]+\.ya?ml$
|
|
stages: ['pre-commit']
|
|
|
|
# ansible-lint and the changelog lint run from PATH (language: system): their
|
|
# versions are the pins in requirements-dev.txt, installed into a virtualenv by
|
|
# CI and locally. ansible-lint is the slowest hook, so fail_fast stops the run
|
|
# once it fails (a global fail_fast would hide every other failure).
|
|
- repo: local
|
|
hooks:
|
|
# REUSE compliance (licence files, SPDX data, REUSE.toml). The wrapper tolerates only
|
|
# unused licence texts, see its docstring.
|
|
- id: reuse-lint
|
|
name: REUSE compliance
|
|
description: reuse lint, tolerating unused licence texts until the roles arrive
|
|
entry: python3 scripts/reuse_lint.py
|
|
language: system
|
|
pass_filenames: false
|
|
always_run: true
|
|
stages: ['pre-commit']
|
|
|
|
- id: antsibull-changelog-lint
|
|
name: Changelog fragments lint
|
|
description: antsibull-changelog lint over changelogs/
|
|
entry: antsibull-changelog lint
|
|
language: system
|
|
files: ^(changelogs/|galaxy\.yml$)
|
|
stages: ['pre-commit']
|
|
pass_filenames: false
|
|
|
|
# Pre-push only: the Build job's ansible-test sanity run, on HEAD (scripts/ansible-test-sanity.sh).
|
|
# The sanity tests carry their own pylint, pep8 and shellcheck settings, which the hooks above do
|
|
# not, and a cold run builds virtualenvs, so it is not a commit hook. CI's pre-commit run does not
|
|
# run this stage (the Build job runs sanity itself), and no hook environment is built for it.
|
|
- id: ansible-test-sanity
|
|
name: ansible-test sanity
|
|
description: ansible-test sanity on HEAD, as the Build job runs it
|
|
entry: scripts/ansible-test-sanity.sh
|
|
language: system
|
|
pass_filenames: false
|
|
always_run: true
|
|
require_serial: true
|
|
stages: ['pre-push']
|
|
|
|
- id: ansible-lint
|
|
name: ansible-lint
|
|
description: ansible-lint production profile, offline
|
|
entry: scripts/ansible-lint.sh
|
|
language: system
|
|
files: ^(roles/|plugins/|meta/|galaxy\.yml$|requirements\.yml$|\.ansible-lint$|\.yamllint$)
|
|
stages: ['pre-commit']
|
|
pass_filenames: false
|
|
require_serial: true
|
|
fail_fast: true
|
|
|
|
# apm compile (target claude), a tool's project init or a skill can create a CLAUDE.md, and
|
|
# the failure is silent: the agent gets no guidance and no error.
|
|
- id: refuse-claude-md
|
|
name: Refuse CLAUDE.md files
|
|
description: refuse CLAUDE.md, CLAUDE.local.md and .claude/CLAUDE.md at any depth, in any case
|
|
entry: a CLAUDE.md file makes Claude Code ignore every AGENTS.md; delete it
|
|
language: fail
|
|
# Any letter case: a case-insensitive file system serves claude.md as CLAUDE.md.
|
|
files: (?i)(^|/)(\.claude/)?claude(\.local)?\.md$
|
|
stages: ['pre-commit']
|
|
|
|
- repo: meta
|
|
hooks:
|
|
- id: check-hooks-apply
|
|
- id: check-useless-excludes
|