The hook scripts written by dev-setup.sh exported ANSIBLE_HOME and ANSIBLE_COLLECTIONS_PATH, so only a hook run through git commit saw the pinned collections; a bare pre-commit run fell back to the control host's ~/.ansible, the drift #118 removes. The ansible-lint hook now runs scripts/ansible-lint.sh, which uses .ansible/collections of the clone when ANSIBLE_COLLECTIONS_PATH is unset, fails with the fix when they are missing, and leaves a preset path (CI's /opt/collections) alone. dev-setup.sh keeps installing the collections and no longer edits the hook scripts beyond the PATH block it always wrote. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
101 lines
3.4 KiB
YAML
101 lines
3.4 KiB
YAML
default_install_hook_types: [pre-commit, commit-msg]
|
|
|
|
repos:
|
|
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
rev: v4.4.0
|
|
hooks:
|
|
- id: conventional-pre-commit
|
|
stages: [commit-msg]
|
|
|
|
- repo: https://github.com/gitleaks/gitleaks
|
|
rev: v8.30.1
|
|
hooks:
|
|
- id: gitleaks
|
|
stages: ['pre-commit']
|
|
|
|
- repo: https://github.com/adrienverge/yamllint
|
|
rev: 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: v0.17.5
|
|
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: v0.11.0.1
|
|
hooks:
|
|
- id: shellcheck
|
|
stages: ['pre-commit']
|
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: 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: v1.7.12
|
|
hooks:
|
|
- id: actionlint
|
|
args: [-config-file, .gitea/actionlint.yaml]
|
|
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; docs/licensing.md in the
|
|
# environment repo). 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
|
|
|
|
- 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
|
|
|
|
- repo: meta
|
|
hooks:
|
|
- id: check-hooks-apply
|
|
- id: check-useless-excludes
|