Skip to content

fix(health): score module-level JS callbacks#456

Merged
RaghavChamadiya merged 1 commit into
repowise-dev:mainfrom
joptimus:fix/issue-451-arrow-complexity
Jun 12, 2026
Merged

fix(health): score module-level JS callbacks#456
RaghavChamadiya merged 1 commit into
repowise-dev:mainfrom
joptimus:fix/issue-451-arrow-complexity

Conversation

@joptimus

Copy link
Copy Markdown
Contributor

Summary

  • collect module-level JS/TS lambda callbacks as scoreable complexity entries
  • synthesize names for assigned lambdas and call-site callbacks
  • skip outer test suite wrapper callbacks while still descending into their test/hook callbacks

Fixes #451.

Verification

  • uv run pytest tests/unit/health/test_complexity_walker.py tests/unit/health/test_file_nloc.py -q
  • uv run ruff check packages/core/src/repowise/core/analysis/health/complexity/walker.py tests/unit/health/test_complexity_walker.py

I also ran a read-only before/after validation harness against representative local projects without persisting health tables:

  • Express-style API service: file NLOC stayed unchanged, route callbacks became scoreable entries, and new complexity/large-method signals appeared only where callback bodies had enough substance.
  • TypeScript frontend app: file NLOC stayed unchanged; existing top health targets remained stable, with only callback/lambda entry coverage increasing.
  • Desktop/app-style JavaScript project: file NLOC stayed unchanged; low-complexity event callbacks were collected but did not create new findings.

Validation also caught noisy suite-level test callbacks, so this PR skips describe/context/suite wrappers while still collecting nested it/hook callbacks.

@repowise-bot

repowise-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

✅ Health: 7.7 (unchanged)
1 file moved · 2 hotspots · 5 hidden couplings · 2 with fix history

⚠️ Change risk: moderate (riskier than 43% of this repo's commits · raw 8.3/10)
This change's risk is driven by:

  • large diff (many lines added)

🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)

File Score Δ Why
.../health/test_complexity_walker.py 6.2 → 6.6 ▲ +0.5 score drifted on re-parse — no PR-attributable biomarkers
🔥 Hotspots touched (2)
  • .../health/test_complexity_walker.py — 5 commits/90d, 2 dependents · primary owner: Raghav Chamadiya (90%)
  • .../complexity/walker.py — 8 commits/90d, 4 dependents · primary owner: Raghav Chamadiya (88%)
🔗 Hidden coupling (2 files)
  • .../health/test_complexity_walker.py co-changes with .../complexity/languages.py (4× — 🟢 routine) — not in this PR.
  • .../complexity/walker.py co-changes with these files (not in this PR):
    • docs/architecture/code-health.md (4× — 🟢 routine)
    • .../health/engine.py (4× — 🟢 routine)
    • docs/CODE_HEALTH.md (4× — 🟢 routine)
    • .../biomarkers/README.md (4× — 🟢 routine)

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-06-11 14:27 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

@RaghavChamadiya RaghavChamadiya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RaghavChamadiya RaghavChamadiya merged commit b65c2c6 into repowise-dev:main Jun 12, 2026
5 checks passed
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.

Health complexity is blind to top-level arrow/lambda functions

2 participants