The class
Several pre-commit hooks read each changed file whole. So editing one line of a legacy module makes the commit, or the PR, answerable for that file's entire backlog. The hook fails on violations that blame attributes to other commits, and the change being made has nothing to do with them.
It is costly because it blocks fixes to old files, and old files are where security fixes land. #16186 recorded a 2-line git-scrubbing fix (#16179) that could not land for a day, because staging the file made it answerable for a 117-line function the diff never touched.
Precedent, and why it isn't enough
#13950 scoped pre-commit-hardcoded-values to added lines, and #14051 did the same for no-print-console. Both go through pipeline-scripts/check-pre-commit-hook-pr.sh --changed-lines-only. Both apply only in CI. code-quality.yml says so directly: "the pre-commit stage and a direct run still scan whole files." Hardcoded-values gets away with that because it has a baseline file for pre-existing hits. A hook with no CI step and no baseline still blocks the local commit, which is where each witness below was blocked.
Members
Principle for every member
A check that runs on a change should judge what the change added. The whole-file backlog stays visible by running the hook directly, and each hook should say which of the two it's doing, so a clean scoped run is never read as a clean file.
The class
Several pre-commit hooks read each changed file whole. So editing one line of a legacy module makes the commit, or the PR, answerable for that file's entire backlog. The hook fails on violations that blame attributes to other commits, and the change being made has nothing to do with them.
It is costly because it blocks fixes to old files, and old files are where security fixes land. #16186 recorded a 2-line git-scrubbing fix (#16179) that could not land for a day, because staging the file made it answerable for a 117-line function the diff never touched.
Precedent, and why it isn't enough
#13950 scoped
pre-commit-hardcoded-valuesto added lines, and #14051 did the same forno-print-console. Both go throughpipeline-scripts/check-pre-commit-hook-pr.sh --changed-lines-only. Both apply only in CI.code-quality.ymlsays so directly: "the pre-commit stage and a direct run still scan whole files." Hardcoded-values gets away with that because it has a baseline file for pre-existing hits. A hook with no CI step and no baseline still blocks the local commit, which is where each witness below was blocked.Members
no-local-schemas: fails on a pre-existing localBaseModel, and its instruction names only destinations frozen at their size ceilingfunction-length-check: a legacy long function blocks every unrelated change to its fileflake8 E501on a pre-existing long line, reported in bug(ci): no-local-schemas demands a move into modules that are all at zero headroom, and fails PRs for violations they did not introduce #16178's first comment: does not reproduce on base8e7d16918. No line inrepo_tests/python_file_size_ratchet_baseline.pyexceeds.flake8's configured 120, so it isn't filed. flake8 still reads staged files whole, so the same shape can come back. File it as a child when a live instance is seen.Principle for every member
A check that runs on a change should judge what the change added. The whole-file backlog stays visible by running the hook directly, and each hook should say which of the two it's doing, so a clean scoped run is never read as a clean file.