Repository navigation
fix(validators): read the mask of every identifier the way isValidCpf does - #611
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
commit: |
Tree-shaking report✅ No size regression. 18 grew, 5 shrank out of 195 exports.
What changed (23)
Show the other 3
All exports (195)
How this is measuredEvery export is imported alone into an esbuild consumer bundle (minified, tree-shaken) built from the head and from the base of this pull request; the sizes are the resulting bundles, gzip is their gzipped size. 🔴 marks a regression: a pre-existing export that grew more than 20% and more than 256 B, or the bundle importing every pre-existing export growing more than 5%. 🟡 is growth under the threshold, 🟢 a decrease, ⚪ no change, 🆕 an export that does not exist on the base (never a regression), 🗑️ an export that was removed. An intentional increase is accepted with the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## claude/municipality-code-by-name #611 +/- ##
====================================================================
Coverage ? 100.00%
====================================================================
Files ? 239
Lines ? 2430
Branches ? 714
====================================================================
Hits ? 2430
Misses ? 0
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… does isValidCpf takes any run of whitespace, `.`, `-` or `/` between the groups of its mask. The other validators now follow it: - Lookup codes (CBO, CFOP, CNAE, NCM, CST, CEST, NBS, service item) and the IBAN take a run of separators between their groups, not just one; the service item also takes space, `-` and `/`, not only `.`. - CEP, CNH, RENAVAM, legal nature, processo jurídico and voter id take `/` (voter id also `-`), through the shared SEPARATORS_REGEX. - The Pix CPF key is read through isValidCpf itself. - ISBN takes any run of the four characters between two digits. - The NFS-e key takes them at the boundaries of its fields (7-1-1-14-13-4-9-1), through a new readNfseKey that getNfseKeyInfo shares. - SUFRAMA (not released yet) now rejects the (, ), comma and * it used to strip, and a separator inside a field. Only widenings for utils released in 2.4.0; check:api holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLkm9YrtAifc6XCLFVEsdH
61e6297 to
9e40382
Compare
…ention # Conflicts: # docs/pt-br/utilities.md # docs/utilities.md # src/is-valid-isbn/is-valid-isbn.ts
What does this PR do?
isValidCpftrims the input, then accepts any run of whitespace,.,-or/between the groups of its mask and rejects any other character. This PR makes the other validators follow the same rule:isValidServiceItem/getServiceItem)..,-,//rejected (voter id also-)SEPARATORS_REGEXgetPixKeyInfo)isValidCpfitselfisValidNfseKey/getNfseKeyInfo)readNfseKeyshared by both(,),,,*and separators anywhereStacked on the
getCodeByMunicipalityNamePR.Checklist
npm test).docs/utilities.mdanddocs/pt-br/utilities.md.npm run checkpasses locally (format, lint, types).npm run build:llms.Breaking change?
No. For every utility released in 2.4.0 the change only widens what is accepted, and
check:apiholds. The only narrowing is SUFRAMA, which has not been released yet.Additional context
Everything was validated locally: vitest with 100% coverage, bun, deno, and Stryker on the changed files.
🤖 Generated with Claude Code
https://claude.ai/code/session_01RLkm9YrtAifc6XCLFVEsdH
Generated by Claude Code