Summary
Add a composite "god file" / kitchen-sink module detector that flags modules doing too much by combining multiple existing signals — large size, many exports, and high responsibility spread — into one finding.
Motivation
DebtLens already detects individual symptoms (large-function, api-surface-sprawl, barrel-file). But a module can pass each individual threshold while still being an unmaintainable catch-all. A composite rule that fires when several signals co-occur catches the "everything lives here" file that single-axis rules miss.
Proposed behavior
god-file: fires when a module crosses a combination of thresholds, e.g. total lines + export count + number of top-level functions/classes + distinct concern indicators (mixed I/O, UI, and domain logic).
- Confidence scales with how many independent axes are exceeded.
- Suggestion: split by responsibility, extract cohesive submodules, define a clear public entrypoint.
Config: godFile.maxLines, godFile.maxExports, godFile.maxTopLevelDecls, and the minimum number of axes required to fire.
Implementation surface
- New
src/detectors/godFile.ts that reuses metrics computed by apiSurfaceSprawl.ts and the size logic in largeFunction.ts / src/utils/lines.ts.
- Register in
src/detectors/index.ts; include in core pack.
- Docs in
docs/rules.md; fixtures: a true god file vs a large-but-cohesive module (must not fire on the latter).
Acceptance criteria
Difficulty: medium.
Summary
Add a composite "god file" / kitchen-sink module detector that flags modules doing too much by combining multiple existing signals — large size, many exports, and high responsibility spread — into one finding.
Motivation
DebtLens already detects individual symptoms (
large-function,api-surface-sprawl,barrel-file). But a module can pass each individual threshold while still being an unmaintainable catch-all. A composite rule that fires when several signals co-occur catches the "everything lives here" file that single-axis rules miss.Proposed behavior
god-file: fires when a module crosses a combination of thresholds, e.g. total lines + export count + number of top-level functions/classes + distinct concern indicators (mixed I/O, UI, and domain logic).Config:
godFile.maxLines,godFile.maxExports,godFile.maxTopLevelDecls, and the minimum number of axes required to fire.Implementation surface
src/detectors/godFile.tsthat reuses metrics computed byapiSurfaceSprawl.tsand the size logic inlargeFunction.ts/src/utils/lines.ts.src/detectors/index.ts; include incorepack.docs/rules.md; fixtures: a true god file vs a large-but-cohesive module (must not fire on the latter).Acceptance criteria
npm run test:allpasses.Difficulty: medium.