Skip to content

Complexity + god-folder ratchet gates (pattern 07, gates II) - #27

Merged
astrapi69 merged 1 commit into
mainfrom
feature/complexity-gate
Jun 29, 2026
Merged

astrapi69 merged 1 commit into
mainfrom
feature/complexity-gate

Conversation

@astrapi69

@astrapi69 astrapi69 commented Jun 29, 2026 •

Copy link
Copy Markdown
Owner

Closes #26
Closes #28

Completes the remaining ratchet gates of docs/patterns/07 (the cohesion/file-size gate already shipped in #23). Additive tooling.

Complexity ratchet (Python/radon)

  • scripts/check-complexity.sh (warn-only view + --gate + --update-baseline) + radon_warn.py + complexity_gate.py — file-level worst-cc ratchet vs .complexity-baseline (may only shrink).
  • radon added as a backend dev-dependency; resolved from the backend Poetry venv (deterministic in CI), with fallbacks.
  • .complexity-baseline seeded from the 4 real cc>20 offenders in backend/app (genuine, not hollow).

God-folder watcher

  • scripts/check-directory-size.sh — warns when a directory under frontend/src holds >15 flat *.ts/*.tsx files, --gate ratchet vs .dirsize-baseline (seeded: components/ 58 = EXAMPLE-DOMAIN, hooks/ 16).

Targets

make check-complexity / check-complexity-gate / check-complexity-gate-update / check-directory-size / check-directory-size-gate.

The TypeScript/eslint half of the complexity gate degrades gracefully and stays inactive until the template has an ESLint flat config (eslint.config.js) — the one remaining pattern-07 gap.

Verified

make check-complexity-gate → exit 0 (4 baselined, radon actually runs). make check-directory-size-gate → exit 0 (2 baselined). make test-backend → 1281 passed.

Implements the complexity half of docs/patterns/07:
- scripts/check-complexity.sh (warn-only view + --gate / --update-baseline)
  + radon_warn.py + complexity_gate.py (file-level worst-cc ratchet vs
  .complexity-baseline, may only shrink).
- radon added as a backend dev-dependency; the script resolves it from the
  backend Poetry venv (deterministic in CI), falling back to PATH /
  python3 -m radon / a bootstrap .radon-venv (gitignored).
- .complexity-baseline seeded from the 4 current cc>20 offenders in
  backend/app; gate verified exit 0.
- make check-complexity / check-complexity-gate / check-complexity-gate-update.

The TypeScript/eslint half degrades gracefully and stays inactive until an
ESLint flat config (eslint.config.js) exists - a separate pre-existing gap.
Additive tooling; backend tests stay green (1281 passed).

Closes #26
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​radon@​6.0.197100100100100

View full report

@astrapi69
astrapi69 merged commit 628d1a1 into main Jun 29, 2026
9 checks passed
@astrapi69 astrapi69 changed the title Complexity ratchet gate — radon/Python half (pattern 07) Complexity + god-folder ratchet gates (pattern 07, gates II) Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

God-folder watcher (pattern 07, third gate) Complexity ratchet gate — radon/Python half (pattern 07)

2 participants