Skip to content

refactor: remove custom rules feature#113

Merged
let-sunny merged 1 commit intomainfrom
refactor/remove-custom-rules
Mar 26, 2026
Merged

refactor: remove custom rules feature#113
let-sunny merged 1 commit intomainfrom
refactor/remove-custom-rules

Conversation

@let-sunny
Copy link
Copy Markdown
Owner

@let-sunny let-sunny commented Mar 26, 2026

Summary

  • Remove custom rules feature (--custom-rules) entirely
  • Keep config overrides (--config) for adjusting scores, severity, and thresholds

Why

Built-in rules should be complete and well-calibrated. Custom rules added complexity (loader, schema, diversity denominator issues) without clear value — if a check is worth having, it should be a built-in rule maintained by the project.

This also resolves the diversity scoring issue flagged in #111 where custom rules weren't included in TOTAL_SCORE_PER_CATEGORY.

What's removed

  • src/core/rules/custom/ directory (loader, schema, index) — -1,465 lines
  • examples/custom-rules.json
  • --custom-rules option from CLI, MCP server, docs
  • Custom rules section from docs/REFERENCE.md
  • Custom rules guide from canicode docs rules

What's kept

  • --config option for rule score/severity/threshold overrides
  • config-loader.ts moved from custom/ to rules/ (cleaner location)

Test plan

  • 662 tests pass
  • Type check clean
  • --config still works (config-loader moved, not deleted)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Removed Features
    • Removed custom rules functionality and the --custom-rules CLI option from analyze and list-rules commands.
    • Removed custom rules documentation, reference guides, and example files.
    • Simplified configuration options to use --config exclusively for rule customization.

Custom rules (--custom-rules) allowed adding new analysis rules via JSON.
This is removed in favor of maintaining a complete built-in rule set.

Config overrides (--config) for adjusting scores/severity/thresholds are kept.

- Delete src/core/rules/custom/ (loader, schema, index)
- Delete examples/custom-rules.json
- Move config-loader.ts out of custom/ to rules/
- Remove --custom-rules from CLI, MCP, docs
- Update CLAUDE.md, README.md, REFERENCE.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 71abc8db-ad27-4cd5-a84d-a26468e79a18

📥 Commits

Reviewing files that changed from the base of the PR and between a53ea35 and 97ae2b7.

📒 Files selected for processing (15)
  • CLAUDE.md
  • README.md
  • docs/REFERENCE.md
  • examples/custom-rules.json
  • src/cli/commands/analyze.ts
  • src/cli/commands/list-rules.ts
  • src/cli/docs.ts
  • src/cli/index.ts
  • src/core/rules/config-loader.test.ts
  • src/core/rules/config-loader.ts
  • src/core/rules/custom/custom-rule-loader.test.ts
  • src/core/rules/custom/custom-rule-loader.ts
  • src/core/rules/custom/custom-rule-schema.ts
  • src/core/rules/custom/index.ts
  • src/mcp/server.ts
💤 Files with no reviewable changes (8)
  • README.md
  • src/cli/docs.ts
  • docs/REFERENCE.md
  • src/core/rules/custom/custom-rule-schema.ts
  • examples/custom-rules.json
  • src/core/rules/custom/custom-rule-loader.test.ts
  • src/core/rules/custom/index.ts
  • src/core/rules/custom/custom-rule-loader.ts

📝 Walkthrough

Walkthrough

This PR completely removes custom rules functionality from the codebase. It deletes the custom rule loader, schema definitions, and test suite; removes the --custom-rules CLI option from multiple commands; and eliminates all related documentation from CLAUDE.md, README.md, and REFERENCE.md. The MCP server is updated accordingly.

Changes

Cohort / File(s) Summary
Documentation Removal
CLAUDE.md, README.md, docs/REFERENCE.md
Removed all references to --custom-rules option and comprehensive custom rules guidance, including schema definitions, match-condition examples, and rule JSON samples.
Custom Rules Implementation Deletion
src/core/rules/custom/custom-rule-loader.ts, src/core/rules/custom/custom-rule-schema.ts, src/core/rules/custom/custom-rule-loader.test.ts, src/core/rules/custom/index.ts
Deleted entire custom rule loading logic, JSON schema validation, comprehensive test suite (876 lines), and re-export surface for custom rules functionality.
CLI Command Updates
src/cli/commands/analyze.ts, src/cli/commands/list-rules.ts
Removed --custom-rules CLI option and associated config merging logic that dynamically loaded and registered custom rules during execution.
CLI Help & Docs Interface
src/cli/index.ts, src/cli/docs.ts
Removed --custom-rules from help text customization section and deleted printDocsRules() function with routing support for custom rules documentation topic.
MCP Server & Import Updates
src/mcp/server.ts, src/core/rules/config-loader.ts
Removed customRulesPath parameter from analyze tool schema; updated imports to remove custom-rule-loader references and correct config-loader paths.
Examples
examples/custom-rules.json
Removed example custom rules JSON file containing icon-not-component and large-frame-no-auto-layout rule definitions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Farewell, custom rules, you've served us well,
Now simplified paths have much more to tell,
No schemas to juggle, no loaders to parse,
The CLI runs cleaner—a hop, skip, and... smart! ✨

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: remove custom rules feature' directly and clearly summarizes the main objective of the changeset—removing the custom rules feature across the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/remove-custom-rules

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

@let-sunny let-sunny marked this pull request as ready for review March 26, 2026 11:34
@let-sunny let-sunny merged commit cc30ce6 into main Mar 26, 2026
3 checks passed
@let-sunny let-sunny deleted the refactor/remove-custom-rules branch March 26, 2026 11:38
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