steam-backlog-enforcer/.pre-commit-config.yaml
Krzysztof kuhy Rudnicki 7d537943ff Drop lint, coverage and line-cap gates
Bug-class-check: none — gate policy change (kuhy 2026-11-27)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZDq7ef5JyQd7Rx3Ju
2026-11-28 08:19:16 +01:00

205 lines
8.2 KiB
YAML

# Pre-commit Configuration for steam-backlog-enforcer
# Install: pre-commit install && pre-commit install --hook-type pre-push
# Run: pre-commit run --all-files
# Update: pre-commit autoupdate
default_language_version:
python: python3
default_stages: [pre-commit]
fail_fast: false
default_install_hook_types: [pre-commit, pre-push, post-commit, post-merge, post-rewrite]
repos:
# ===========================================================================
# GENERAL HOOKS
# ===========================================================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
# The pinned signing key is byte-for-byte what its source served.
exclude: ^steam_installer/data/
- id: end-of-file-fixer
- id: check-yaml
# pnpm 12 writes pnpm-lock.yaml as two YAML documents (the pinned
# packageManager's own lock, then the project lock); parse both.
args: [--allow-multiple-documents]
- id: check-json
- id: check-toml
- id: check-added-large-files
args: [--maxkb=2000]
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-private-key
- id: debug-statements
- id: check-ast
- id: check-builtin-literals
- id: mixed-line-ending
args: [--fix=lf]
- id: requirements-txt-fixer
# ===========================================================================
# NOQA BLOCKER
# ===========================================================================
- repo: local
hooks:
- id: no-noqa
name: Block noqa comments
entry: '(?i)#\s*(noqa|type:\s*ignore)'
language: pygrep
types: [python]
- id: no-ruff-noqa
name: Block ruff noqa file-level comments
entry: '(?i)#\s*ruff:\s*noqa'
language: pygrep
types: [python]
- id: requirements-sync
name: requirements.txt covers all package imports
entry: python3 scripts/check_requirements_sync.py --package steam_backlog_enforcer
language: system
pass_filenames: false
files: ^(steam_backlog_enforcer/.*\.py|requirements\.txt)$
- id: requirements-sync-installer
name: requirements.txt covers the installer's imports
entry: python3 scripts/check_requirements_sync.py --package steam_installer
language: system
pass_filenames: false
files: ^(steam_installer/.*\.py|requirements\.txt)$
# ===========================================================================
# RUFF - Linter + formatter
# ===========================================================================
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.17.0
hooks:
- id: ruff-format
exclude: ^scripts/file_length/
types_or: [python, pyi]
# ===========================================================================
# CI MIRROR (manual stage: the gate steps before a push)
# ===========================================================================
# One gate step per hook, each under the 60 s per-command cap even on a
# loaded box: `scripts/check_gate_stamp.sh step <id>` per id of
# `scripts/check_gate_stamp.sh full --list`; the last one stamps the tree.
# The pylint hook above is split into the ci-mirror-pylint-* shards and
# ci-mirror-precommit skips it, so the union checks exactly what CI does:
# - per-file checks run per shard; the shards' `files` partition the hook's
# targets (tests by name: rest|test_[a-h], test_[i-r], test_[s-z]). With
# --fail-under=10.0 a shard passes only with zero scored messages, so
# every shard passing == the whole tree at 10.00;
# - the two cross-file checks (duplicate-code, cyclic-import) see the whole
# tree, as in the full hook (ci-mirror-pylint-dup, ci-mirror-pylint-cycles).
- repo: local
hooks:
- id: ci-mirror-venv
name: CI mirror (clean requirements.txt venv, rebuilt on change)
entry: bash scripts/ci_mirror.sh venv
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-precommit
name: CI mirror (pre-commit --all-files, pylint via the shards)
entry: bash scripts/ci_mirror.sh precommit
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-pytest
name: CI mirror (clean-venv pytest, xdist, 100% coverage)
entry: bash scripts/ci_mirror.sh pytest steam_backlog_enforcer/tests/ steam_installer/tests/
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
# ===========================================================================
# SHELLCHECK - Shell script linting
# ===========================================================================
- repo: local
hooks:
# Four markdown namespaces (README / CLAUDE* / DOCS* / TODO*), plus the
# rule that a TODO carries "REMOVE ME AFTER FINISH" and nothing else may.
# Shared gate in ~/src/utils owns the namespaces and the exemption list, so
# one repo's idea of a valid name cannot drift from every other repo's.
- id: md-naming
name: markdown naming convention
entry: scripts/check_md_naming.sh
language: system
files: \.(md|markdown)$
- id: todo-closer
name: close Todo trailer tasks
entry: scripts/todo_hooks.sh closer
language: system
stages: [post-commit]
always_run: true
pass_filenames: false
- id: todo-import-pr-merge
name: import PR Todo sections (pull)
entry: scripts/todo_hooks.sh import-pr post-merge
language: system
stages: [post-merge]
always_run: true
pass_filenames: false
- id: todo-import-pr-rewrite
name: import PR Todo sections (pull --rebase)
entry: scripts/todo_hooks.sh import-pr post-rewrite
language: system
stages: [post-rewrite]
always_run: true
pass_filenames: false
# Every dependency on its ecosystem's newest STABLE release, exact-pinned
# so the question is mechanically answerable at all.
#
# `files:` is what keeps this cheap: a commit touching only source makes
# ZERO network requests, and manifest commits mostly hit a 6h disk cache.
#
# Runs WITHOUT --strict on purpose. Offline it degrades to the cached
# answer and passes with a loud banner; `--no-verify` is banned here, so
# a hook that hard-failed on a flaky connection would leave no way to
# commit at all. The strict run is local only (CI does not check
# freshness): scripts/check_dependency_freshness.sh --all --strict
- id: dependency-freshness
name: dependencies on newest stable
entry: scripts/check_dependency_freshness.sh
language: system
pass_filenames: true
files: >-
(pubspec\.(yaml|lock)|pyproject\.toml|requirements.*\.txt|uv\.lock
|package\.json|package-lock\.json|pnpm-lock\.yaml
|Cargo\.(toml|lock)|go\.(mod|sum)
|\.fvmrc|\.nvmrc|\.python-version
|\.github/workflows/.*\.ya?ml
|steam_installer/data/proton-native\.lock)$
- repo: local
hooks:
# The only pre-push hook. Everything that used to run here is now
# `stages: [manual]` -- run on demand with `scripts/check_gate_stamp.sh
# full`, and by CI on every push. finish_auto.sh stamps HEAD after its
# gate; a tree without that receipt cannot leave the machine.
- id: gate-stamp
name: pushed tree passed the local gate (stamp check)
entry: scripts/check_gate_stamp.sh check
language: system
pass_filenames: false
always_run: true
stages: [pre-push]
- id: repo-contract
name: repo contract (CLAUDE.md Commands + test_changed)
entry: scripts/check_repo_contract.sh
language: system
pass_filenames: false
files: ^(CLAUDE\.md|AGENTS\.md|scripts/test_changed\.sh)$