#19: Python oversized-file via a line-count leaf sensor - #37
Merged
Conversation
lineCountSensor emits oversized-file for any discovered file whose physical line count exceeds a threshold. oversized-file is a pure line count and needs no AST, so this can cover languages with no tool rule for it. Unwired until the Python preset uses it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nq6xHU6JtSNpYWhMYjXB15
(`max-module-lines`, default 200) from the consumer's config via a no-TOML-parser text scan. ruff 0.15 rejects an unknown `max-module-lines` key under `[tool.ruff]`, so consumers set it in a ruff-ignored location (e.g. `[tool.habit-hooks]` in pyproject.toml); documented in DECISIONS.md and smell-vocabulary.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nq6xHU6JtSNpYWhMYjXB15
devill
force-pushed
the
issue-19-python-oversized-file
branch
from
June 17, 2026 15:05
e5e2c6d to
381a82b
Compare
devill
marked this pull request as ready for review
June 17, 2026 15:06
This was referenced Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19.
oversized-filefired for TypeScript (ESLintmax-lines) but not Python — there's no clean ruff rule, so it was deferred. This closes the gap, giving the two presets full parity on the smell.Implementation (locked decision)
A language-agnostic
lineCountSensor(maxLines)emitsoversized-filefor any discovered file whose physical line count exceeds the threshold (no AST needed). The Python preset wires it in.Threshold sourcing + a ruff finding
The threshold (
max-module-lines, default 200, matching TSmax-lines) is read from the consumer's config by a no-TOML-parser text scan — the same approach the init drift-check uses.max-module-linesas an unknown field under[tool.ruff](verified:unknown field max-module-lines, expected one of …). So the locked decision's literal "ruff-config-style key in the consumer's ruff config" can't live inside[tool.ruff]. The key is therefore set in a ruff-ignored location (e.g.[tool.habit-hooks]inpyproject.toml); the text scan finds it anywhere. It is intentionally not added toRUFF_RECOMMENDED/the init scaffold, since recommending a key inside a ruff table would break ruff. Documented inDECISIONS.mdanddocs/smell-vocabulary.md.Atomic commits
#19: add a language-agnostic line-count sensor— the sensor + unit tests (strictly-over boundary, trailing-newline handling).#19: emit oversized-file in the Python preset— wire-in, threshold reader, runnercwdthread-through, docs, and acceptance tests.Tests
.pyfile over a configured threshold yieldsoversized-file; a small file at the default threshold does not. These run without the Python toolchain (line-count needs no tools).Gates
pnpm build,pnpm lint— cleanpnpm test— 389 passed (+4)🤖 Generated with Claude Code
Generated by Claude Code