mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 17:47:24 +01:00
aur-publish/publish.sh 439 -> 148 + lib/aur_registration 107
+ lib/aur_verify 122 + lib/aur_publish_one 107
guard-lib/lib/file_guard.sh 350 -> 140 + file_guard_unlock 214
file_length/config.py 252 -> 45 + _tables 202 + exemptions 77
The libs are sourced, never executed: they read the readonly config the entry
script declares, and a `readonly` re-run inside a twice-sourced lib aborts
under `set -e`. Verified by function parity rather than by eye — publish.sh
resolves the same 17 functions as before the split, guardctl the same 15 —
plus `shellcheck -x` clean on every file and a real `--help` / bad-option run.
file_length is the gate's own code, so a broken import there turns the gate
into a no-op. Split three ways to avoid an import cycle without a `# noqa`:
_tables holds the data, exemptions the rules that read it, config re-exports
both so `from file_length.config import is_generated` still resolves. The
first attempt was wrong — EXCLUDED_DIRS was left behind and every invocation
raised — caught because the gate was re-run in both modes rather than
assumed. Now verified: exit 0 on a clean file, exit 1 on an over-cap one,
--explain intact, and the same 61 exemption decisions as HEAD.
Also deletes baseline-2026-08-14.json and SURVEY-2026-08-14.txt: the task
forbids a baseline file, and nothing in the tree read either.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CFSGeWxHPY5rHUGrPqhcmG
46 lines
1.1 KiB
Python
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",
|
|
]
|