steam-backlog-enforcer/scripts/file_length/config.py
Krzysztof kuhy Rudnicki 10c33690b9 Add the 250-line file-length gate as a pre-commit hook
Vendors ~/utils/file_length into scripts/file_length so the gate is
reachable in CI: pre-commit's `entry:` is not shell-expanded and GitHub
runners have no ~/utils, so an external reference would pass locally and
silently skip on push. The existing pre-commit/action all-files job picks
the hook up with no workflow change.

The vendored copy is excluded from ruff/ruff-format/mypy/pylint and must
stay byte-identical to upstream -- ruff --unsafe-fixes otherwise rewrites
its print() calls to `pass` (T201/F841), which leaves the gate exiting 1
while reporting nothing.

Also:
- name-tests-test now exempts tests/_*.py, so the 35 test-file splits have
  a landing zone for shared helpers (it rejects any non-test_*.py module
  under tests/).
- pylint max-module-lines 1000 -> 250, so both limits agree.

Note: .git/hooks/pre-commit was never installed in this repo (only
pre-push), so no commit-stage hook had ever run. Installed via
`pre-commit install`.

55 files are currently over the cap; they are split in following commits.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPpmMpTSkp8UziRc5u8B7P
2026-08-23 19:27:09 +02:00

46 lines
1.1 KiB
Python

"""Shared configuration for the 250-line file-length cap.
Single source of truth for the cap and its exemptions, imported by both the
pre-commit gate (`check.py`) and the survey. This module is the public
surface: :mod:`file_length._tables` holds the data, and
:mod:`file_length.exemptions` the rules that read it.
"""
from __future__ import annotations
from file_length._tables import (
CAPPED_EXTENSIONS,
DATA_TXT_MAX_MEAN_LINE,
EXCLUDED_DIRS,
GENERATED_MARKERS,
GENERATED_PATTERN,
MAX_LINES,
SESSION_ARTIFACTS_ANYWHERE,
THIRD_PARTY_REPOS,
VENDORED_ANYWHERE,
VENDORED_SUBPATHS,
)
from file_length.exemptions import (
is_data_text,
is_generated,
is_session_artifact,
is_vendored,
)
__all__ = [
"CAPPED_EXTENSIONS",
"DATA_TXT_MAX_MEAN_LINE",
"EXCLUDED_DIRS",
"GENERATED_MARKERS",
"GENERATED_PATTERN",
"MAX_LINES",
"SESSION_ARTIFACTS_ANYWHERE",
"THIRD_PARTY_REPOS",
"VENDORED_ANYWHERE",
"VENDORED_SUBPATHS",
"is_data_text",
"is_generated",
"is_session_artifact",
"is_vendored",
]