mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-10 18:47:11 +01:00
The archive reached zero ruff findings this morning, so the standing rule in
.pre-commit-config.yaml -- a hook lands only once the thing it gates is clean
-- is finally satisfied for ruff. `ruff check` and `ruff format --check` are
hooks now, pinned at v0.16.5 per rules/dependency-freshness, plus
`no-suppressions`, which rejects `# noqa` and `# type: ignore`. CLAUDE.md has
always claimed a hook did that; until now the only thing stopping them was
whoever was reading ruff's output, and I typed `# noqa-free` three times in
this session by accident. mypy stays out: six of its errors are third-party
typing limits rather than our code.
The first attempt used `language: system`, which passed `pre-commit run
--all-files` and then failed the actual commit with "Executable `ruff` not
found" -- git hooks do not get ~/.local/bin on PATH. Taking the hooks from
astral-sh/ruff-pre-commit means pre-commit installs ruff itself, which is also
what makes the pin mean anything.
`ruff format --check` failed the moment it was wired up, on four TRAK files I
wrote today and never formatted. Formatted, and the ray_tracing0 render is
still 02484bdb6b6c1ddeff317d7e5566580f.
Then the run guard from f780d023 needed proving on more than TRAK, since it
now applies to every course kind. make, cpp and python courses pass it; node
and target and obj are all properly gitignored, so npm, maven and dotnet
builds cannot trip it either. But NotProgramming/MOM failed, and not because
of the guard:
`_first_file '*.tex'` used `find -print -quit`, which returns whatever readdir
hands back. After the 19 reports were split into sections, that was
`report_three/sections/02-model-dwukryterialny.tex`, and latexmk faithfully
tried to typeset a bare `\section` as a document. DOCS-runnability.md has
recorded MOM as runnable throughout. The tex branch now picks a file that
actually contains `\documentclass`.
Deliberately not sorted, and that is the interesting part. Sorting is the
obvious fix and it made things worse: it swapped ELAC's pick to projectA and
AIS's to report/final/ver1, both of which fail with latexmk exit 12. Those two
documents are broken independently, and sorting merely surfaced them; turning
two green courses red to fix a third is a bad trade. Recorded in
TODO-refactor-remaining.md instead. MOM, ELAC, AIS, SPD, ZPOB, SDM, DPZ and
ESOEN all exit 0 now.
`_works` also grew a `timeout 5`, because `unityhub --version` never returns
on this machine and a probe without one would hang the status sweep.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
107 lines
4.3 KiB
YAML
107 lines
4.3 KiB
YAML
# Install: ./install.sh (or: pre-commit install && pre-commit install --hook-type pre-push)
|
|
# Fast lint: pre-commit run --all-files
|
|
#
|
|
# Ordering rule for this repo: a hook lands only once the thing it gates is
|
|
# already clean, so `pre-commit run --all-files` is green at every commit.
|
|
# Hooks still to come, each blocked on its own cleanup:
|
|
# - file-length blocked on the .tex/code splits and TODO-file-length-250.md
|
|
# - mypy blocked on six errors that are third-party typing
|
|
# limits, not our code -- see TODO-refactor-remaining.md
|
|
# - dependency-freshness blocked on the upgrade itself; the gate and the
|
|
# upgrade must land in the SAME commit or the repo is
|
|
# instantly and permanently red
|
|
# - trailing-whitespace / end-of-file-fixer these REWRITE files, so they get
|
|
# their own reviewed cleanup commit first
|
|
default_language_version:
|
|
python: python3
|
|
default_stages: [pre-commit]
|
|
fail_fast: false
|
|
|
|
repos:
|
|
# Landed 2026-08-29, the day the archive first reached zero ruff findings
|
|
# repo-wide. Pinned exactly, per rules/dependency-freshness: 0.16.5 is the
|
|
# newest stable. These hooks pass --force-exclude themselves, so the
|
|
# vendored trees excluded in pyproject.toml stay excluded even though
|
|
# pre-commit hands ruff explicit filenames.
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: v0.16.5
|
|
hooks:
|
|
- id: ruff-check
|
|
types_or: [python, pyi, jupyter]
|
|
- id: ruff-format
|
|
args: [--check]
|
|
types_or: [python, pyi, jupyter]
|
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.6.0
|
|
hooks:
|
|
# Structural checks only -- none of these rewrite a file.
|
|
- id: check-merge-conflict
|
|
- id: check-case-conflict
|
|
- id: check-symlinks
|
|
- id: destroyed-symlinks
|
|
- id: detect-private-key
|
|
# tsconfig*.json and .vscode/*.json are JSONC -- both TypeScript and
|
|
# VS Code document comments and trailing commas as valid there, and
|
|
# check-json uses a strict RFC parser. This is the wrong parser for
|
|
# those files, not a defect being suppressed; every other .json is
|
|
# still checked. (The one real failure this hook found, a committed
|
|
# merge conflict in EARIN/.vscode/extensions.json, is fixed.)
|
|
- id: check-json
|
|
exclude: |
|
|
(?x)^(
|
|
.*/tsconfig[^/]*\.json|
|
|
.*/\.vscode/[^/]*\.json
|
|
)$
|
|
- id: check-toml
|
|
- id: check-yaml
|
|
args: [--unsafe]
|
|
# 2 MB. The four 39 MB movies.csv copies are already tracked and stay
|
|
# (approved decision 6); this stops the NEXT one.
|
|
- id: check-added-large-files
|
|
args: [--maxkb=2000]
|
|
|
|
- repo: local
|
|
hooks:
|
|
# Coursework deliverables are allowed under the two course trees;
|
|
# compiled output is allowed nowhere. See .binary-allowlist.
|
|
- id: no-binaries
|
|
name: block binary files outside the allowlist
|
|
entry: scripts/check_no_binaries.sh
|
|
language: script
|
|
pass_filenames: true
|
|
|
|
# A tracked file that .gitignore also matches fails silently on
|
|
# `git add`. 130 of those were fixed by hand; this keeps them fixed.
|
|
- id: ignore-consistency
|
|
name: no tracked file is gitignored
|
|
entry: scripts/check_ignore_consistency.sh
|
|
language: script
|
|
pass_filenames: false
|
|
always_run: true
|
|
|
|
# Thin shim into ~/utils, which owns the four markdown namespaces.
|
|
- id: md-naming
|
|
name: markdown naming convention
|
|
entry: scripts/check_md_naming.sh
|
|
language: system
|
|
files: \.(md|markdown)$
|
|
|
|
# CLAUDE.md has always said a hook rejects these. Now one does.
|
|
- id: no-suppressions
|
|
name: no noqa or type-ignore comments
|
|
entry: scripts/check_no_suppressions.sh
|
|
language: script
|
|
types_or: [python, pyi, jupyter]
|
|
|
|
# -x so shellcheck FOLLOWS sourced files. The 44 per-course run.sh stubs
|
|
# source scripts/course_lib.sh; without -x every one of them reports
|
|
# SC1091 "not following", and the only other way to silence that is a
|
|
# per-file disable, which is banned here.
|
|
- id: shellcheck
|
|
name: shellcheck
|
|
entry: bash -c 'printf "%s\0" "$@" | xargs -0 -n 40 shellcheck -x' --
|
|
language: system
|
|
types: [shell]
|
|
exclude_types: [zsh]
|