Skip to content

#26: deep-nesting smell (TS, ESLint max-depth) — #24's live demonstrator - #40

Merged
devill merged 2 commits into
mainfrom
issue-26-deep-nesting
Jun 17, 2026
Merged

#26: deep-nesting smell (TS, ESLint max-depth) — #24's live demonstrator#40
devill merged 2 commits into
mainfrom
issue-26-deep-nesting

Conversation

@devill

@devill devill commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Closes #26. Stacked on #24 (issue-24-smell-agnostic) — it is #24's live demonstrator.

Adds a deep-nesting smell (TypeScript via ESLint core max-depth): deeply nested blocks that want guard clauses, early returns, or an extracted helper.

This is the #24 proof

After #24 made the sensor layer smell-agnostic, adding deep-nesting touches only src/config/ and src/cli/init/:

$ git diff --name-only issue-24-smell-agnostic...HEAD | grep -E 'src/(runner|sensors|checks|rules)/' | grep -v test
(none)

The eslint raw→smell translation and the preset's produces auto-derive from the catalogue (via #24's tool-smells.ts) — zero edits to the runner, sensors, checks, or rules registry.

Changes

  • src/config/catalogue.ts: the deep-nesting rule (source: eslint, sourceRuleId: max-depth, enforced, changed-files-only — mirrors high-complexity).
  • src/cli/init/templates/eslint-config.ts: scaffolds a tunable max-depth: 4.
  • src/prompts/deep-nesting.md: ROSE-pattern prompt (guard clauses → extract helper → replace structure).
  • docs/smell-vocabulary.md: catalogue + TS translation tables, and the TS/Python asymmetry (ruff PLR1702 is preview/unstable → Python deferred).

Scope

TypeScript only; Python deferred (don't opt the default preset into ruff --preview).

Tests

End-to-end through the real runner: a 5-deep nested file fires deep-nesting at max-depth: 2 and does not at max-depth: 6 (proving consumer-configurability). Init scaffold test asserts max-depth: 4.

Gates

  • pnpm build, pnpm lint — clean (catalogue.ts at the 200-line cap)
  • pnpm test — 390 passed

🤖 Generated with Claude Code


Generated by Claude Code

@devill
devill force-pushed the issue-24-smell-agnostic branch from 067a3ed to bff09dc Compare June 17, 2026 15:26
claude added 2 commits June 17, 2026 17:32
only the catalogue (source eslint, sourceRuleId max-depth) — the eslint
translation and preset produces auto-derive via #24, so the runner,
sensors, checks, and registry need zero edits. Ships a ROSE-pattern
prompt and an end-to-end test that fires it through the real runner.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nq6xHU6JtSNpYWhMYjXB15
`max-depth: 4` rule alongside the other thresholds, so deep-nesting is
configurable from the eslint config like the other TS smells.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nq6xHU6JtSNpYWhMYjXB15
@devill
devill force-pushed the issue-26-deep-nesting branch from b0e9aef to 35328cb Compare June 17, 2026 15:36
@devill
devill marked this pull request as ready for review June 17, 2026 15:36
@devill
devill changed the base branch from issue-24-smell-agnostic to main June 17, 2026 15:37
@devill
devill merged commit e8195be into main Jun 17, 2026
@devill
devill deleted the issue-26-deep-nesting branch June 19, 2026 12:21
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.

Add deep-nesting smell (TypeScript via ESLint max-depth) — also #24's live demonstrator

2 participants