mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-28 09:09:18 +01:00
Drop lint, coverage and line-cap gates
Some checks are pending
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
Some checks are pending
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
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
This commit is contained in:
parent
e96cf6c98b
commit
82ae083df4
70
.github/workflows/pre-commit.yml
vendored
70
.github/workflows/pre-commit.yml
vendored
@ -22,12 +22,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- group: mypy
|
||||
hooks: mypy
|
||||
- group: pylint
|
||||
hooks: pylint
|
||||
- group: shellcheck
|
||||
hooks: shellcheck
|
||||
- group: rest
|
||||
hooks: ""
|
||||
name: pre-commit (${{ matrix.group }})
|
||||
@ -124,70 +118,6 @@ jobs:
|
||||
{ sudo apt-get update && sudo apt-get install -y "${pkgs[@]}"; }
|
||||
zsh --version
|
||||
|
||||
# The SDL headers are for pygame, one of pylint's additional_dependencies.
|
||||
# 2.6.1 is the newest release and its wheels stop at cp313, so on
|
||||
# newest-stable Python pip falls back to a source build -- which dies on
|
||||
# a missing `sdl-config` unless these are here. Only a pylint env BUILD
|
||||
# needs them (30 s of apt), and a restored cache usually already holds
|
||||
# the env, so the build is tried first and the headers are installed
|
||||
# only if it fails. Run against a non-Python file: pre-commit installs
|
||||
# the hook env before filtering files, then has nothing to lint, so the
|
||||
# only way this exits non-zero is the env build itself failing.
|
||||
- name: Build the pylint hook env (pygame headers only if needed)
|
||||
if: matrix.group == 'pylint'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# The first attempt's output goes to a file: an expected sdl-config
|
||||
# traceback would otherwise trip setup-python's problem matcher and
|
||||
# put an error annotation on a green run. The retry below prints in
|
||||
# full, so any other cause of failure still shows up there.
|
||||
attempt_log="$RUNNER_TEMP/pylint-env-attempt.log"
|
||||
if pre-commit run pylint --files .pre-commit-config.yaml >"$attempt_log" 2>&1; then
|
||||
cat "$attempt_log"
|
||||
exit 0
|
||||
fi
|
||||
echo "pylint env build failed -- installing pygame's build headers and retrying"
|
||||
pkgs=(libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
|
||||
libfreetype6-dev libportmidi-dev)
|
||||
sudo apt-get install -y "${pkgs[@]}" ||
|
||||
{ sudo apt-get update && sudo apt-get install -y "${pkgs[@]}"; }
|
||||
pre-commit run pylint --files .pre-commit-config.yaml
|
||||
|
||||
# Pin shellcheck instead of inheriting whatever ubuntu-latest ships.
|
||||
#
|
||||
# The runner image carried 0.9.0 while developer machines have 0.11.0
|
||||
# from pacman, and the shellcheck hook is `language: system` -- so it
|
||||
# used whichever binary happened to be on PATH. The two versions
|
||||
# disagree (0.11.0 demoted SC2002 and several SC2015/SC2119 cases as
|
||||
# noise), which meant a commit could pass every local check and still
|
||||
# fail CI on findings the developer could not reproduce. That is exactly
|
||||
# what kept this workflow red from b83ce5d onward.
|
||||
#
|
||||
# Keep SHELLCHECK_VERSION in step with the version developers install;
|
||||
# the verification below fails loudly rather than silently drifting.
|
||||
- name: Install shellcheck (pinned)
|
||||
if: matrix.group == 'shellcheck'
|
||||
env:
|
||||
SHELLCHECK_VERSION: v0.11.0
|
||||
SHELLCHECK_SHA256: 8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tarball="shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz"
|
||||
curl -fsSL -o "$tarball" \
|
||||
"https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/${tarball}"
|
||||
echo "${SHELLCHECK_SHA256} ${tarball}" | sha256sum --check --strict
|
||||
tar -xJf "$tarball"
|
||||
sudo install -m 0755 "shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/local/bin/shellcheck
|
||||
# Fail here, not 40 hooks later, if PATH still resolves to another copy.
|
||||
installed="$(shellcheck --version | awk '/^version:/ { print $2 }')"
|
||||
expected="${SHELLCHECK_VERSION#v}"
|
||||
if [ "$installed" != "$expected" ]; then
|
||||
echo "::error::shellcheck on PATH is ${installed}, expected ${expected}" >&2
|
||||
command -v -a shellcheck >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "shellcheck ${installed} pinned and on PATH"
|
||||
|
||||
# prettier and shfmt do NOT run in this job -- prettier is a pre-push
|
||||
# hook and shfmt runs from the local pre-commit git hook. They are
|
||||
# pinned here anyway so this file stays the single place that records
|
||||
|
||||
1
.github/workflows/python-tests.yml
vendored
1
.github/workflows/python-tests.yml
vendored
@ -72,4 +72,3 @@ jobs:
|
||||
- name: Run pytest with coverage
|
||||
run: >-
|
||||
pytest -n auto -q -p no:sugar
|
||||
--cov=python_pkg --cov-branch --cov-report=term-missing --cov-fail-under=100
|
||||
|
||||
@ -51,11 +51,8 @@ repos:
|
||||
- id: check-shebang-scripts-are-executable
|
||||
- id: detect-private-key
|
||||
- id: debug-statements
|
||||
- id: name-tests-test
|
||||
args: [--pytest-test-first]
|
||||
- id: check-ast
|
||||
- id: check-builtin-literals
|
||||
- id: check-docstring-first
|
||||
- id: fix-byte-order-marker
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
@ -71,16 +68,6 @@ repos:
|
||||
entry: meta/scripts/check_no_binaries.sh
|
||||
language: script
|
||||
always_run: false
|
||||
- id: file-length-cap
|
||||
name: Enforce the 250-line file cap
|
||||
# Repo-wide (--all), not per-file: a file that grows past the cap
|
||||
# without being staged in this commit must still be caught. Wired only
|
||||
# after the campaign that brought every file under it — turning this on
|
||||
# earlier would have blocked every unrelated commit in the repo.
|
||||
entry: bash meta/scripts/check_file_length.sh --all
|
||||
language: system
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
- id: directory-depth-cap
|
||||
name: Enforce the directory-depth cap
|
||||
# Repo-wide and ENFORCING. It ran --warn while the 46 paths under
|
||||
@ -149,19 +136,6 @@ repos:
|
||||
types: [shell]
|
||||
require_serial: true
|
||||
exclude: ^(\.git/|tests/)
|
||||
- id: shell-coverage-ratchet
|
||||
name: Every shell library has a test suite beside it
|
||||
# The ratchet from meta/shell-coverage-allowlist.txt: a lib under a
|
||||
# lib/ directory needs a tests/run_all.sh, unless it is allowlisted.
|
||||
# Wired here on 2026-08-23. It existed but was never in pre-commit,
|
||||
# so it had been silently unenforced -- a new untested lib could land
|
||||
# freely. That was only affordable to fix once 578c4a6c dropped the
|
||||
# jail-measured 100% bar: --all went from >600s to 0.31s, and the
|
||||
# per-file mode this hook uses is milliseconds.
|
||||
entry: bash meta/scripts/check_shell_coverage.sh
|
||||
language: system
|
||||
types: [shell]
|
||||
exclude: ^third_party/
|
||||
|
||||
# ===========================================================================
|
||||
# NOQA BLOCKER - Zero tolerance for noqa/type:ignore suppression comments
|
||||
@ -185,130 +159,10 @@ repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.15.2
|
||||
hooks:
|
||||
# Linter - run first to catch issues
|
||||
- id: ruff
|
||||
args:
|
||||
- --fix
|
||||
- --unsafe-fixes
|
||||
- --exit-non-zero-on-fix
|
||||
- --show-fixes
|
||||
types_or: [python, pyi]
|
||||
# Formatter - run after linting
|
||||
- id: ruff-format
|
||||
types_or: [python, pyi]
|
||||
|
||||
# ===========================================================================
|
||||
# MYPY - Static type checking (per-commit on changed files only)
|
||||
# Was on pre-push, but force-push diffs caused full-repo scans + OOM. On
|
||||
# pre-commit it sees only the file(s) currently staged → near-instant.
|
||||
# ===========================================================================
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.13.0
|
||||
hooks:
|
||||
- id: mypy
|
||||
stages: [pre-commit]
|
||||
args:
|
||||
- --ignore-missing-imports
|
||||
- --no-error-summary
|
||||
- --disable-error-code=no-untyped-def
|
||||
- --disable-error-code=no-untyped-call
|
||||
- --disable-error-code=var-annotated
|
||||
- --disable-error-code=no-any-unimported
|
||||
- --disable-error-code=type-arg
|
||||
- --disable-error-code=no-any-return
|
||||
- --disable-error-code=misc
|
||||
- --disable-error-code=unused-ignore
|
||||
- --disable-error-code=unreachable
|
||||
- --disable-error-code=assignment
|
||||
- --disable-error-code=no-redef
|
||||
- --disable-error-code=attr-defined
|
||||
- --disable-error-code=arg-type
|
||||
- --disable-error-code=union-attr
|
||||
- --disable-error-code=call-overload
|
||||
- --disable-error-code=return-value
|
||||
- --disable-error-code=redundant-cast
|
||||
- --disable-error-code=empty-body
|
||||
- --disable-error-code=list-item
|
||||
exclude: >-
|
||||
(?x)^(
|
||||
Bash/.*|
|
||||
\.venv/.*|
|
||||
linux_configuration/misc/tools/.*
|
||||
)$
|
||||
additional_dependencies:
|
||||
- types-requests
|
||||
- types-PyYAML
|
||||
- types-python-dateutil
|
||||
|
||||
# ===========================================================================
|
||||
# PYLINT - Comprehensive Python linter (per-commit on changed files only)
|
||||
# Was on pre-push, but force-push diffs caused full-repo scans + OOM.
|
||||
# ===========================================================================
|
||||
- repo: https://github.com/pylint-dev/pylint
|
||||
rev: v4.1.4
|
||||
hooks:
|
||||
- id: pylint
|
||||
stages: [pre-commit]
|
||||
args:
|
||||
- --rcfile=pyproject.toml
|
||||
- --fail-under=10
|
||||
# One job: dill, which pickles for --jobs>1, breaks on Python 3.15.
|
||||
- --jobs=1
|
||||
additional_dependencies:
|
||||
- pytest
|
||||
- requests
|
||||
- pillow
|
||||
# archwiki_rag parses the local arch-wiki-docs HTML dump. pylint runs
|
||||
# in its own venv, so a package being in meta/requirements.txt is not
|
||||
# enough for it to resolve the import.
|
||||
- beautifulsoup4
|
||||
- markdownify
|
||||
# android_ui parses `uiautomator dump` output. Same reason as
|
||||
# beautifulsoup4 above: requirements.txt is not on pylint's path.
|
||||
- defusedxml
|
||||
# android_ui's MCP server; same isolated-venv reason.
|
||||
- fastmcp==4.2.4
|
||||
# artgate computes image gates over pixel arrays. Same reason again:
|
||||
# it is the first package here to import numpy.
|
||||
- numpy
|
||||
# js_anki builds the Anki .apkg; same isolated-venv reason as above.
|
||||
- genanki
|
||||
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.1.0#subdirectory=gatelock
|
||||
- sql_drills @ git+https://github.com/kuhyx/utils@sql-drills-v0.2.2#subdirectory=sql_drills
|
||||
# The shared logo credit on the CLIs' --help; same isolated-venv reason.
|
||||
- kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit
|
||||
- anthropic
|
||||
- rich
|
||||
- typer
|
||||
# linux_configuration/installers: verify_helium drives Helium
|
||||
# over the DevTools websocket; migrate_helium_passwords_to_basic re-encrypts
|
||||
# Chromium os_crypt blobs (AES-CBC).
|
||||
- websockets
|
||||
- cryptography
|
||||
- secretstorage
|
||||
# Test suites and conftest fixtures are linted separately; they use
|
||||
# patterns (protected-access, missing docstrings, fixture shadowing)
|
||||
# that don't belong in the source-code 10/10 gate.
|
||||
exclude: ^(Bash/|\.venv/)|(^|/)(tests/|conftest\.py)
|
||||
|
||||
# ===========================================================================
|
||||
# BANDIT - Security linter (per-commit on changed files only)
|
||||
# Was on pre-push, but force-push diffs caused full-repo scans + OOM.
|
||||
# ===========================================================================
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.7.10
|
||||
hooks:
|
||||
- id: bandit
|
||||
stages: [pre-commit]
|
||||
args:
|
||||
- -c
|
||||
- pyproject.toml
|
||||
- --severity-level=high
|
||||
- --confidence-level=medium
|
||||
- --skip=B113
|
||||
additional_dependencies: ["bandit[toml]"]
|
||||
exclude: ^(Bash/|\.venv/|tests/|.*test.*\.py$)
|
||||
|
||||
# ===========================================================================
|
||||
# PYTEST + COVERAGE - Run tests and enforce 100% code coverage
|
||||
# Only tests for subpackages with changed files are run (see script).
|
||||
@ -316,17 +170,6 @@ repos:
|
||||
# ===========================================================================
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pytest-coverage
|
||||
name: pytest with coverage enforcement
|
||||
# Serialised against builds and pacman transactions on this 7.6 GB
|
||||
# machine via the heavy-job lock. run_with_heavy_lock.sh is a plain
|
||||
# passthrough on any clone that has not installed one.
|
||||
entry: bash meta/scripts/run_with_heavy_lock.sh pytest python meta/scripts/pytest_changed_packages.py
|
||||
language: system
|
||||
types: [python]
|
||||
pass_filenames: true
|
||||
require_serial: true
|
||||
stages: [pre-commit]
|
||||
- id: requirements-sync
|
||||
name: requirements.txt covers all python_pkg imports
|
||||
entry: python3 meta/scripts/check_requirements_sync.py --package python_pkg
|
||||
@ -392,29 +235,6 @@ repos:
|
||||
# args:
|
||||
# - --py310-plus
|
||||
|
||||
# ===========================================================================
|
||||
# CODESPELL - Spell checking in code (expanded ignore list for non-English)
|
||||
# ===========================================================================
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: codespell
|
||||
args:
|
||||
- --skip=*.json,*.lock,*-lock.yaml,*.min.js,*.min.css,.git,__pycache__,.venv,*.txt
|
||||
# Many entries below are Polish words, not typos: they are field
|
||||
# names from Polish data formats (e.g. `dokument` in the e-paragon /
|
||||
# JPK e-receipt schema that billsplit parses). "Correcting" them to
|
||||
# English breaks the parsers that match on them.
|
||||
# `daa` is MediaTek's Download Agent Authentication, a BROM security
|
||||
# feature named in the mtk_root notes - not a misspelling of "data".
|
||||
# `artic` is SearXNG's engine id for the Art Institute of Chicago
|
||||
# (setup_searxng.sh), not a misspelling of "arctic" - renaming it
|
||||
# would stop matching the engine.
|
||||
# `imput` is Helium's vendor (imput.net): its profile dir is
|
||||
# `~/.config/net.imput.helium` and the installers/*helium* scripts spell it out.
|
||||
- --ignore-words-list=als,ans,ect,nd,som,sur,te,nam,numer,lew,sie,wil,postion,clen,ther,folow,derrive,ony,tje,noe,theses,crate,doubleclick,wile,tabel,pary,blok,bloc,proces,serwer,parametr,adres,hart,dout,metod,tekst,synonim,grup,mosty,lokal,skalar,milion,nowe,tre,hel,alph,iif,dokument,daa,artic,imput
|
||||
exclude: ^(Bash/ffmpeg-build/|LaTeX/|.*\.geojson$)
|
||||
|
||||
# ===========================================================================
|
||||
# DOCFORMATTER - Format docstrings (disabled - causes recursion errors)
|
||||
# ===========================================================================
|
||||
@ -507,42 +327,6 @@ repos:
|
||||
)$
|
||||
stages: [pre-push]
|
||||
|
||||
# ===========================================================================
|
||||
# SHELLCHECK - Shell script linting
|
||||
# Wrapper batches files to avoid OOM on large repos.
|
||||
# ===========================================================================
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
name: shellcheck
|
||||
# NO --severity filter: every finding shellcheck reports, down to info
|
||||
# and style, fails the commit. The previous --severity=warning quietly
|
||||
# accepted 222 findings across 94 of 244 shell files -- and among them
|
||||
# were real defects, not noise: two scripts that reported SUCCESS on an
|
||||
# unknown command, five that sourced a path off by one directory (so
|
||||
# they failed at runtime), a stale `source=` directive that had silently
|
||||
# disabled following for six i3blocks scripts, and a diagnostic that
|
||||
# would hang on stdin when its file list came back empty.
|
||||
# Settings live in .shellcheckrc (external-sources, source-path).
|
||||
entry: bash -c 'printf "%s\0" "$@" | xargs -0 -n 40 shellcheck' --
|
||||
language: system
|
||||
types: [shell]
|
||||
# shellcheck only understands sh/bash/dash/ksh; it cannot parse zsh
|
||||
# syntax (e.g. extended globs like (#s)). zsh files are checked by the
|
||||
# zsh-syntax hook below instead.
|
||||
exclude_types: [zsh]
|
||||
# Vendored upstream code: we do not own it and patches here would be
|
||||
# lost on the next vendor sync. Matches the prettier hook's exclusion.
|
||||
#
|
||||
# PKGBUILDs are makepkg manifests, not standalone scripts: they have no
|
||||
# shebang by design, and pkgname/pkgver/source/sha512sums are read by
|
||||
# makepkg while pkgdir/srcdir are injected by it. shellcheck therefore
|
||||
# reports every one of them as unused-or-undefined (SC2148/SC2034/
|
||||
# SC2154) -- all false positives, and none suppressible without
|
||||
# littering the file with directives. Same reasoning as zsh above:
|
||||
# the dialect is outside what shellcheck can judge.
|
||||
exclude: ^third_party/|(^|/)PKGBUILD$
|
||||
|
||||
# ===========================================================================
|
||||
# ZSH SYNTAX - zsh -n parse check (shellcheck has no zsh mode)
|
||||
# ===========================================================================
|
||||
|
||||
@ -180,6 +180,6 @@ number of error codes, so it is weaker than the `strict = true` in the config.
|
||||
- deploy: `scripts/deploy.sh` (fast-forwards the live `~/src/testsAndMisc` checkout to origin/main, keeping unrelated local edits; exits non-zero unless HEAD = origin/main and the tracked hooks are wired)
|
||||
- test: `python3 -m pytest -q -o addopts="--strict-markers --strict-config"`
|
||||
- test-changed: `scripts/test_changed.sh`
|
||||
- lint: `pre-commit run --hook-stage pre-commit`
|
||||
- coverage: `python3 -m pytest -q --cov=python_pkg --cov-branch --cov-report=xml -o addopts="--strict-markers --strict-config"`
|
||||
- coverage-gaps: `coverage-gaps coverage.xml`
|
||||
- lint: n/a: dropped (kuhy, 2026-11-27)
|
||||
- coverage: n/a: dropped (kuhy, 2026-11-27)
|
||||
- coverage-gaps: n/a: dropped (kuhy, 2026-11-27)
|
||||
|
||||
@ -51,11 +51,8 @@ repos:
|
||||
- id: check-shebang-scripts-are-executable
|
||||
- id: detect-private-key
|
||||
- id: debug-statements
|
||||
- id: name-tests-test
|
||||
args: [--pytest-test-first]
|
||||
- id: check-ast
|
||||
- id: check-builtin-literals
|
||||
- id: check-docstring-first
|
||||
- id: fix-byte-order-marker
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
@ -125,131 +122,10 @@ repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.15.2
|
||||
hooks:
|
||||
# Linter - run first to catch issues
|
||||
- id: ruff
|
||||
args:
|
||||
- --fix
|
||||
- --unsafe-fixes
|
||||
- --exit-non-zero-on-fix
|
||||
- --show-fixes
|
||||
types_or: [python, pyi]
|
||||
# Formatter - run after linting
|
||||
- id: ruff-format
|
||||
types_or: [python, pyi]
|
||||
|
||||
# ===========================================================================
|
||||
# MYPY - Static type checking (per-commit on changed files only)
|
||||
# Was on pre-push, but force-push diffs caused full-repo scans + OOM. On
|
||||
# pre-commit it sees only the file(s) currently staged → near-instant.
|
||||
# ===========================================================================
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.13.0
|
||||
hooks:
|
||||
- id: mypy
|
||||
stages: [pre-commit]
|
||||
args:
|
||||
- --ignore-missing-imports
|
||||
- --no-error-summary
|
||||
- --disable-error-code=no-untyped-def
|
||||
- --disable-error-code=no-untyped-call
|
||||
- --disable-error-code=var-annotated
|
||||
- --disable-error-code=no-any-unimported
|
||||
- --disable-error-code=type-arg
|
||||
- --disable-error-code=no-any-return
|
||||
- --disable-error-code=misc
|
||||
- --disable-error-code=unused-ignore
|
||||
- --disable-error-code=unreachable
|
||||
- --disable-error-code=assignment
|
||||
- --disable-error-code=no-redef
|
||||
- --disable-error-code=attr-defined
|
||||
- --disable-error-code=arg-type
|
||||
- --disable-error-code=union-attr
|
||||
- --disable-error-code=call-overload
|
||||
- --disable-error-code=return-value
|
||||
- --disable-error-code=redundant-cast
|
||||
- --disable-error-code=empty-body
|
||||
- --disable-error-code=list-item
|
||||
exclude: >-
|
||||
(?x)^(
|
||||
Bash/.*|
|
||||
\.venv/.*|
|
||||
linux_configuration/misc/tools/.*
|
||||
)$
|
||||
additional_dependencies:
|
||||
- types-requests
|
||||
- types-PyYAML
|
||||
- types-python-dateutil
|
||||
|
||||
# ===========================================================================
|
||||
# PYLINT - Comprehensive Python linter (per-commit on changed files only)
|
||||
# Was on pre-push, but force-push diffs caused full-repo scans + OOM.
|
||||
# ===========================================================================
|
||||
- repo: https://github.com/pylint-dev/pylint
|
||||
rev: v4.0.8
|
||||
hooks:
|
||||
- id: pylint
|
||||
stages: [pre-commit]
|
||||
args:
|
||||
- --rcfile=pyproject.toml
|
||||
- --fail-under=10
|
||||
- --jobs=0
|
||||
# Every third-party import a linted source file makes, pinned as in
|
||||
# meta/requirements.txt: pylint scores each unresolved one as
|
||||
# import-error, which is a config gap dressed up as a code defect.
|
||||
additional_dependencies:
|
||||
- pytest
|
||||
- python-chess
|
||||
- requests
|
||||
- pygame
|
||||
- anthropic==1.5.0
|
||||
- beautifulsoup4==4.15.0
|
||||
- defusedxml==0.7.1
|
||||
- markdownify==1.2.4
|
||||
- numpy==2.5.3
|
||||
- pillow==12.3.0
|
||||
- rich==15.0.0
|
||||
- typer==0.27.2
|
||||
# Test suites are ruff's; pylint grades source. The rcfile's
|
||||
# `ignore = ["tests"]` cannot do this on its own -- it matches only
|
||||
# the basename of what pylint is handed, and pre-commit hands it
|
||||
# explicit file paths -- so the exclusion lives here, as in the root
|
||||
# config.
|
||||
exclude: ^(Bash/|\.venv/)|(^|/)(tests/|conftest\.py)
|
||||
|
||||
# ===========================================================================
|
||||
# BANDIT - Security linter (per-commit on changed files only)
|
||||
# Was on pre-push, but force-push diffs caused full-repo scans + OOM.
|
||||
# ===========================================================================
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.7.10
|
||||
hooks:
|
||||
- id: bandit
|
||||
stages: [pre-commit]
|
||||
args:
|
||||
- -c
|
||||
- pyproject.toml
|
||||
- --severity-level=high
|
||||
- --confidence-level=medium
|
||||
- --skip=B113
|
||||
additional_dependencies: ["bandit[toml]"]
|
||||
exclude: ^(Bash/|\.venv/|tests/|.*test.*\.py$)
|
||||
|
||||
# ===========================================================================
|
||||
# PYTEST + COVERAGE - Run tests and enforce 100% code coverage
|
||||
# Only tests for subpackages with changed files are run (see script).
|
||||
# Uses pytest-xdist (-n auto) to parallelize across all CPUs.
|
||||
# ===========================================================================
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pytest-coverage
|
||||
name: pytest with coverage enforcement
|
||||
entry: python scripts/pytest_changed_packages.py
|
||||
language: system
|
||||
types: [python]
|
||||
pass_filenames: true
|
||||
require_serial: true
|
||||
stages: [pre-commit]
|
||||
|
||||
# ===========================================================================
|
||||
# VULTURE - Dead code detection (disabled - doesn't work well with pre-commit)
|
||||
# ===========================================================================
|
||||
@ -272,18 +148,6 @@ repos:
|
||||
# args:
|
||||
# - --py310-plus
|
||||
|
||||
# ===========================================================================
|
||||
# CODESPELL - Spell checking in code (expanded ignore list for non-English)
|
||||
# ===========================================================================
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: codespell
|
||||
args:
|
||||
- --skip=*.json,*.lock,*.min.js,*.min.css,.git,__pycache__,.venv,*.txt
|
||||
- --ignore-words-list=als,ans,ect,nd,som,sur,te,nam,numer,lew,sie,wil,postion,clen,ther,folow,derrive,ony,tje,noe,theses,crate,doubleclick,wile,tabel,pary,blok,bloc,proces,serwer,parametr,adres,hart,dout,metod,tekst,synonim,grup,mosty,lokal,skalar,milion,nowe,tre,hel,alph
|
||||
exclude: ^(Bash/ffmpeg-build/|LaTeX/|.*\.geojson$)
|
||||
|
||||
# ===========================================================================
|
||||
# DOCFORMATTER - Format docstrings (disabled - causes recursion errors)
|
||||
# ===========================================================================
|
||||
@ -376,18 +240,6 @@ repos:
|
||||
)$
|
||||
stages: [pre-push]
|
||||
|
||||
# ===========================================================================
|
||||
# SHELLCHECK - Shell script linting
|
||||
# Wrapper batches files to avoid OOM on large repos.
|
||||
# ===========================================================================
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
name: shellcheck
|
||||
entry: bash -c 'printf "%s\0" "$@" | xargs -0 -n 40 shellcheck --severity=warning' --
|
||||
language: system
|
||||
types: [shell]
|
||||
|
||||
# ===========================================================================
|
||||
# CHECK PYTHON LOCATION - All Python files must be under python_pkg/
|
||||
# ===========================================================================
|
||||
|
||||
@ -295,10 +295,6 @@ addopts = [
|
||||
"--strict-markers",
|
||||
"--strict-config",
|
||||
"-ra",
|
||||
"--cov=python_pkg",
|
||||
"--cov-branch",
|
||||
"--cov-report=term-missing",
|
||||
"--cov-report=lcov",
|
||||
]
|
||||
markers = [
|
||||
"docker: needs the live sql-drills MySQL container (skipped when it is down)",
|
||||
@ -322,8 +318,6 @@ omit = [
|
||||
]
|
||||
|
||||
[tool.coverage.report]
|
||||
# Fail under this percentage
|
||||
fail_under = 100
|
||||
show_missing = true
|
||||
skip_covered = false
|
||||
exclude_lines = [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user