refactor: extract rules dataset into rules.ts and drop orphaned CSV#6
Conversation
The 352 normalization rules existed twice: inline as RULES_DATA in index.ts and as normadresse.csv at the repo root. Nothing reads the CSV (only dist is shipped), so it was an orphaned duplicate bound to drift. Move the CsvRule type and RULES_DATA verbatim into rules.ts, import them from index.ts, and delete the CSV. index.ts shrinks from 1140 to ~490 lines. No behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Warning Review limit reached
Next review available in: 55 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Thermo-nuclear code quality review — APPROVEThis is exactly the decomposition the codebase needed: index.ts drops from 1140 to 565 lines (well back under the 1k threshold), and the boundary is the right one — a pure-data module. No structural regressions, no missed code-judo move; the simpler framing is this PR. Verified (programmatically, not by eyeball)
FindingsNone blocking, no fixes needed. Verdict: approve — pure move confirmed, behavior 100% unchanged, dataset integrity verified programmatically. 🤖 Generated with Claude Code |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
* main: refactor: extract rules dataset into rules.ts and drop orphaned CSV (#6) refactor!: compile rules eagerly and drop clearRulesCache (#5) refactor: remove dead regex-escape fallback in compileRules (#4) fix: anchor first-name abbreviation matching to whole words (#3) docs: document unapplied rule groups in RULES_DATA (#2) # Conflicts: # index.ts
Problem
The 352 normalization rules exist twice in this repo:
RULES_DATAinindex.ts(~650 of its 1140 lines)normadresse.csvat the repo rootThe CSV is referenced by nothing: no code reads it, and
filesinpackage.jsononly shipsdist, so it never reaches the published package either. It is an orphaned duplicate of the dataset that will silently drift the next time someone edits one copy but not the other.Change
rules.tscontaining theCsvRuletype andRULES_DATA, moved verbatim fromindex.ts(byte-for-byte, verified withdiffagainst the previous block) and exported.index.tsimports them from./rules.tsand drops from 1140 to 490 lines.normadresse.csvdeleted —rules.tsis now the single source of truth.rules.ts.Verification
bun test: 19 pass, 0 failbun run lint,bun run ts: cleanbun run build(zshy): dist emitsrules.js/rules.cjswith all 352 rules;dist/index.jsimports./rules.jsanddist/index.cjsrequires./rules.cjs, so the published package still carries the full dataset.Pure move — no logic edits, behavior 100% unchanged.
🤖 Generated with Claude Code