Files
Kamino/.pre-commit-config.yaml
T
Dragonish 1184938f1e
Build / build (pull_request) Successful in 10s
Lint / lint (pull_request) Successful in 1m37s
Molecule / molecule (pull_request) Successful in 5m26s
feat(ci): pin hook revisions by SHA and install dev tools from a hashed lock
Refs #113.

- .pre-commit-config.yaml: every hook repo is pinned by commit SHA with the release in a
  `# frozen:` comment, so a moved tag cannot change the code a hook environment is built from.
- requirements-dev.lock: hashed lock of requirements-dev.txt, installed with
  `pip install --require-hashes` by scripts/dev-setup.sh, the ci image and the fallback
  install of the Lint and Build workflows.
- scripts/lock-requirements.sh regenerates the lock; scripts/check_requirements_lock.py
  (offline, a pre-commit hook) fails when it drifts from the direct pins.
- check_bot_pr_diff.py accepts a `rev:` line with a `# frozen:` comment and nothing else.
- ci image 0.2.16 -> 0.2.17 (image inputs changed).
2026-11-14 15:14:39 +00:00

116 lines
4.7 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 keeps both parts in step (pinDigests rule in renovate.json). To pin by hand:
# `git ls-remote <repo> refs/tags/<tag>^{}` (an annotated tag needs the peeled `^{}` line).
default_install_hook_types: [pre-commit, commit-msg]
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: 91ab4bf57e58b32adf1a122681f6ebe164d081c8 # frozen: v4.4.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: ef6cf06c079dd6b299dfc720b0f14400c9d168e1 # frozen: 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: 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']
# 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']
# The hashed lock must cover every direct pin at the same version (#113); offline.
- id: requirements-lock
name: requirements-dev.lock matches requirements-dev.txt
description: scripts/check_requirements_lock.py, regenerate with scripts/lock-requirements.sh
entry: python3 scripts/check_requirements_lock.py
language: system
files: ^(requirements-dev\.(txt|lock)|scripts/check_requirements_lock\.py)$
stages: ['pre-commit']
pass_filenames: false
- 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