Skip to content

refactor!: simplify public API around ComplexityOptions and the combi… - #169

Merged
itaymendel merged 1 commit into
mainfrom
chore/v4-public-api-cleanup
Oct 6, 2026
Merged

itaymendel merged 1 commit into
mainfrom
chore/v4-public-api-cleanup

Conversation

@itaymendel

@itaymendel itaymendel commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

…ned visitor

Summary by CodeRabbit

  • Breaking Changes

    • Replaced the separate complexity option types and max settings with ComplexityOptions, using cyclomatic and cognitive thresholds.
    • Removed public exports for individual visitor factories and related types. For AST analysis, use the combined visitor; source-string and diff APIs remain unchanged.
  • Documentation

    • Added migration guidance covering the new options, visitor results, and changes to loop labels and cognitive recursion-point reporting.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cf744ee2-c992-441b-a610-4785b03bc718
📥 Commits

Reviewing files that changed from the base of the PR and between 0bc4e62 and 7ea9f48.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • README.md
  • src/cognitive/handlers.ts
  • src/index.ts
  • src/rules/complexity.ts
  • src/rules/shared.ts
  • src/types.ts
  • tests/utils/test-helpers.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The package replaces two exported complexity option types with ComplexityOptions and updates rule option typing. It removes several visitor-related exports. The README and changelog describe the updated API and migration differences.

Changes

Complexity API migration

Layer / File(s) Summary
Complexity options contract and rule typing
src/types.ts, src/rules/complexity.ts, src/rules/shared.ts
Adds ComplexityOptions with cyclomatic, cognitive, and minLines fields. Rule option typing and extraction schema types now use this shared type.
Public exports and migration guidance
src/index.ts, src/cognitive/handlers.ts, tests/utils/test-helpers.ts, README.md, CHANGELOG.md
Removes visitor-related and legacy option type exports. Updates comments and documents the combined visitor API, option changes, and migration differences.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 7ea9f

This PR intentionally changes the TypeScript API and documents the replacement types, visitor entry point, and reporting differences. No actionable merge risk is identified in the supplied evidence.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the public API refactor around ComplexityOptions and the combined visitor, which matches the main changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 6 files. (2 skipped: 2 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit reads the types at dawn
New options hop where old ones shone
Two metrics share a visitor’s way
The changelog marks the former day
Then off I bound through fields of green

Comment @coderabbitai help to get the list of available commands.

@itaymendel
itaymendel merged commit 78e8e08 into main Oct 6, 2026
2 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.

1 participant