Skip to content

[2.4.0 stack 9/18] Quality: zero duplicated code, zero unused exports, 100% mutation score - #517

Open
hyanmandian wants to merge 1 commit into
stack/07-docsfrom
stack/08-quality
Open

[2.4.0 stack 9/18] Quality: zero duplicated code, zero unused exports, 100% mutation score#517
hyanmandian wants to merge 1 commit into
stack/07-docsfrom
stack/08-quality

Conversation

@hyanmandian

@hyanmandian hyanmandian commented Sep 12, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Part 9 of 18 of the 2.4.0 release stack (main <- stack/01-tooling <- ... <- stack/11-testing). One refactor commit that brings the tree to the three new quality gates of part 9 before they are switched on: jscpd reports zero duplicated blocks (shared fetchSortedRecord for the dataset scripts, one isValidCeiCnoNumber for CEI and CNO, the Pix TLV helpers), knip reports zero unused files, exports and dependencies, and Stryker reports a 100% mutation score (every surviving mutant got a test with a literal expectation, a simplification of a dead guard, or, for the few provably equivalent mutants, a Stryker disable next-line comment stating why). No public signature or output changes; the build-to-build comparison over every export is identical.

Commits in this part (1)

  • ccbf74c refactor: remove duplicated code, drop unused exports and close every surviving mutant

How to review and merge

  • Review each part on its own; the diff of this PR is exactly the commits above.
  • Every part is green on its own: each branch builds, lints, passes the tests on Node 20/22/24/26, Bun, Deno and the four browsers, and passes the tree-shaking check against the part below it.
  • Tree-shaking: isValidNfeKey grows from 1.0 KB to 1.3 KB because it now delegates to parseNfeKey instead of carrying a second copy of the key checks (the duplication jscpd flagged). Accepted with the tree-shaking: accepted label.
  • Do not merge the lower parts individually. When all eighteen are approved, retarget [2.4.0 stack 18/18] Review rounds 3 to 5: holidays, date-fns business days, capitalize defaults, currency, words, CEP typed errors, subpath types, citations #520 to main and merge it with a merge commit: the reviewed commits land unchanged and GitHub marks the seventeen parts below as merged.
  • Zero breaking changes: every existing signature, export, entry point and error message is preserved. Twelve output corrections were validated against the published 2.3.0 tarball and are listed in CHANGELOG.md (part 7); the build of every later part is compared export by export against the part below it.

Stack

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 176 files, which is 26 over the limit of 150.

To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Check out review usage here.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2610c138-f999-458d-9242-a0c5fc9200d0

📥 Commits

Reviewing files that changed from the base of the PR and between 076d914 and ccbf74c.

📒 Files selected for processing (176)
  • scripts/cbo.ts
  • scripts/cfop.ts
  • src/_internals/calculate-cnh-second-verifier/calculate-cnh-second-verifier.ts
  • src/_internals/calculate-voter-id-second-digit/calculate-voter-id-second-digit.test.ts
  • src/_internals/clamp-precision/clamp-precision.ts
  • src/_internals/constants/cei.ts
  • src/_internals/constants/phone.ts
  • src/_internals/constants/pix.ts
  • src/_internals/constants/voter-id.ts
  • src/_internals/fetch-sorted-record/fetch-sorted-record.test.ts
  • src/_internals/fetch-sorted-record/fetch-sorted-record.ts
  • src/_internals/fetch-with-retry/fetch-with-retry.test.ts
  • src/_internals/fetch-with-retry/fetch-with-retry.ts
  • src/_internals/is-valid-cei-cno-number/is-valid-cei-cno-number.test.ts
  • src/_internals/is-valid-cei-cno-number/is-valid-cei-cno-number.ts
  • src/_internals/mod10/mod10.ts
  • src/_internals/mod11/mod11.ts
  • src/_internals/number-to-words/number-to-words.ts
  • src/_internals/parse-arrecadacao/parse-arrecadacao.test.ts
  • src/_internals/parse-arrecadacao/parse-arrecadacao.ts
  • src/_internals/parse-decimal/parse-decimal.test.ts
  • src/_internals/parse-decimal/parse-decimal.ts
  • src/_internals/parse-tlv/parse-tlv.ts
  • src/add-business-days/add-business-days.test.ts
  • src/add-business-days/add-business-days.ts
  • src/capitalize/capitalize.test.ts
  • src/capitalize/capitalize.ts
  • src/convert-currency-to-words/convert-currency-to-words.test.ts
  • src/convert-currency-to-words/convert-currency-to-words.ts
  • src/convert-date-to-words/convert-date-to-words.test.ts
  • src/convert-license-plate-to-mercosul/convert-license-plate-to-mercosul.ts
  • src/convert-number-to-words/convert-number-to-words.test.ts
  • src/convert-number-to-words/convert-number-to-words.ts
  • src/difference-in-business-days/difference-in-business-days.test.ts
  • src/difference-in-business-days/difference-in-business-days.ts
  • src/format-boleto/format-boleto.test.ts
  • src/format-caepf/format-caepf.ts
  • src/format-cei/format-cei.ts
  • src/format-cep/format-cep.test.ts
  • src/format-cnae/format-cnae.test.ts
  • src/format-cnh/format-cnh.test.ts
  • src/format-cno/format-cno.ts
  • src/format-cnpj/format-cnpj.test.ts
  • src/format-cpf/format-cpf.test.ts
  • src/format-currency/format-currency.test.ts
  • src/format-currency/format-currency.ts
  • src/format-iban/format-iban.ts
  • src/format-legal-nature/format-legal-nature.test.ts
  • src/format-license-plate/format-license-plate.test.ts
  • src/format-license-plate/format-license-plate.ts
  • src/format-ncm/format-ncm.ts
  • src/format-passport/format-passport.test.ts
  • src/format-passport/format-passport.ts
  • src/format-phone/format-phone.test.ts
  • src/format-phone/format-phone.ts
  • src/format-pis/format-pis.test.ts
  • src/format-processo-juridico/format-processo-juridico.test.ts
  • src/format-voter-id/format-voter-id.test.ts
  • src/generate-boleto/generate-boleto.test.ts
  • src/generate-boleto/generate-boleto.ts
  • src/generate-cnh/generate-cnh.test.ts
  • src/generate-cpf/generate-cpf.test.ts
  • src/generate-legal-nature/generate-legal-nature.test.ts
  • src/generate-license-plate/generate-license-plate.test.ts
  • src/generate-passport/generate-passport.test.ts
  • src/generate-phone/generate-phone.test.ts
  • src/generate-pix-payload/generate-pix-payload.test.ts
  • src/generate-pix-payload/generate-pix-payload.ts
  • src/generate-processo-juridico/generate-processo-juridico.test.ts
  • src/generate-voter-id/generate-voter-id.ts
  • src/get-address-info-by-cep/get-address-info-by-cep.test.ts
  • src/get-address-info-by-cep/get-address-info-by-cep.ts
  • src/get-area-code-info/get-area-code-info.ts
  • src/get-area-codes-by-state/get-area-codes-by-state.ts
  • src/get-bank-by-code/get-bank-by-code.test.ts
  • src/get-bank-by-code/get-bank-by-code.ts
  • src/get-bank-by-ispb/get-bank-by-ispb.test.ts
  • src/get-bank-by-ispb/get-bank-by-ispb.ts
  • src/get-boleto-info/get-boleto-info.test.ts
  • src/get-boleto-info/get-boleto-info.ts
  • src/get-cbo/get-cbo.ts
  • src/get-cep-info-by-address/get-cep-info-by-address.test.ts
  • src/get-cfop/get-cfop.ts
  • src/get-cities/get-cities.test.ts
  • src/get-cities/get-cities.ts
  • src/get-cnae/get-cnae.ts
  • src/get-format-license-plate/get-format-license-plate.ts
  • src/get-holidays/get-holidays.test.ts
  • src/get-holidays/get-holidays.ts
  • src/get-legal-nature/get-legal-nature.ts
  • src/get-municipality-by-code/get-municipality-by-code.test.ts
  • src/get-municipality-by-code/get-municipality-by-code.ts
  • src/get-municipality/get-municipality.test.ts
  • src/get-municipality/get-municipality.ts
  • src/get-state-by-ibge-code/get-state-by-ibge-code.ts
  • src/get-state-code-by-name/get-state-code-by-name.ts
  • src/get-state-name-by-code/get-state-name-by-code.ts
  • src/is-business-day/is-business-day.test.ts
  • src/is-business-day/is-business-day.ts
  • src/is-holiday/is-holiday.test.ts
  • src/is-holiday/is-holiday.ts
  • src/is-valid-bank-account/is-valid-bank-account.test.ts
  • src/is-valid-bank-account/is-valid-bank-account.ts
  • src/is-valid-boleto/is-valid-boleto.test.ts
  • src/is-valid-boleto/is-valid-boleto.ts
  • src/is-valid-caepf/is-valid-caepf.ts
  • src/is-valid-cbo/is-valid-cbo.ts
  • src/is-valid-cei/is-valid-cei.ts
  • src/is-valid-cep/is-valid-cep.test.ts
  • src/is-valid-certidao/is-valid-certidao.test.ts
  • src/is-valid-certidao/is-valid-certidao.ts
  • src/is-valid-cfop/is-valid-cfop.ts
  • src/is-valid-cnae/is-valid-cnae.ts
  • src/is-valid-cnh/is-valid-cnh.test.ts
  • src/is-valid-cnh/is-valid-cnh.ts
  • src/is-valid-cno/is-valid-cno.ts
  • src/is-valid-cnpj/is-valid-cnpj.test.ts
  • src/is-valid-cnpj/is-valid-cnpj.ts
  • src/is-valid-cns/is-valid-cns.test.ts
  • src/is-valid-cpf/is-valid-cpf.test.ts
  • src/is-valid-cpf/is-valid-cpf.ts
  • src/is-valid-credit-card/is-valid-credit-card.test.ts
  • src/is-valid-csosn/is-valid-csosn.ts
  • src/is-valid-cst/is-valid-cst.test.ts
  • src/is-valid-cst/is-valid-cst.ts
  • src/is-valid-email/is-valid-email.test.ts
  • src/is-valid-email/is-valid-email.ts
  • src/is-valid-iban/is-valid-iban.test.ts
  • src/is-valid-iban/is-valid-iban.ts
  • src/is-valid-ie/is-valid-ie.test.ts
  • src/is-valid-ie/is-valid-ie.ts
  • src/is-valid-landline-phone/is-valid-landline-phone.ts
  • src/is-valid-legal-nature/constants.ts
  • src/is-valid-legal-nature/is-valid-legal-nature.ts
  • src/is-valid-mobile-phone/is-valid-mobile-phone.test.ts
  • src/is-valid-mobile-phone/is-valid-mobile-phone.ts
  • src/is-valid-ncm/is-valid-ncm.ts
  • src/is-valid-nfe-key/constants.ts
  • src/is-valid-nfe-key/is-valid-nfe-key.test.ts
  • src/is-valid-nfe-key/is-valid-nfe-key.ts
  • src/is-valid-passport/is-valid-passport.ts
  • src/is-valid-phone/is-valid-phone.ts
  • src/is-valid-pis/is-valid-pis.test.ts
  • src/is-valid-pis/is-valid-pis.ts
  • src/is-valid-processo-juridico/is-valid-processo-juridico.test.ts
  • src/is-valid-processo-juridico/is-valid-processo-juridico.ts
  • src/is-valid-registro-profissional/is-valid-registro-profissional.ts
  • src/is-valid-renavam/is-valid-renavam.test.ts
  • src/is-valid-renavam/is-valid-renavam.ts
  • src/is-valid-service-phone/is-valid-service-phone.ts
  • src/is-valid-vin/is-valid-vin.test.ts
  • src/is-valid-vin/is-valid-vin.ts
  • src/is-valid-voter-id/is-valid-voter-id.test.ts
  • src/is-valid-voter-id/is-valid-voter-id.ts
  • src/parse-boleto/parse-boleto.test.ts
  • src/parse-cep/parse-cep.test.ts
  • src/parse-certidao/parse-certidao.ts
  • src/parse-cnh/parse-cnh.test.ts
  • src/parse-cnpj/parse-cnpj.test.ts
  • src/parse-cpf/parse-cpf.test.ts
  • src/parse-legal-nature/parse-legal-nature.test.ts
  • src/parse-license-plate/parse-license-plate.test.ts
  • src/parse-license-plate/parse-license-plate.ts
  • src/parse-nfe-key/constants.ts
  • src/parse-nfe-key/parse-nfe-key.test.ts
  • src/parse-nfe-key/parse-nfe-key.ts
  • src/parse-passport/parse-passport.test.ts
  • src/parse-passport/parse-passport.ts
  • src/parse-pis/parse-pis.test.ts
  • src/parse-pix-key/parse-pix-key.ts
  • src/parse-pix-payload/parse-pix-payload.test.ts
  • src/parse-pix-payload/parse-pix-payload.ts
  • src/parse-processo-juridico/parse-processo-juridico.test.ts
  • src/parse-voter-id/parse-voter-id.test.ts
  • src/parse-voter-id/parse-voter-id.ts
  • src/remove-accents/remove-accents.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

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

@hyanmandian
hyanmandian added this pull request to stack #514 September 12, 2026 12:47
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (076d914) to head (ccbf74c).

Additional details and impacted files
@@               Coverage Diff                @@
##           stack/07-docs      #517    +/-   ##
================================================
  Coverage         100.00%   100.00%            
================================================
  Files                152       154     +2     
  Lines               2161      1981   -180     
  Branches             664       601    -63     
================================================
- Hits                2161      1981   -180     
Flag Coverage Δ
node 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown

Tree-shaking report

Fails when a pre-existing export grows more than 20% and more than 256 B, or when importing every export that already existed on the base grows more than 5%. New exports never count as a regression.

Pre-existing exports: 628788 B to 625733 B (-0.5%, gzip 161766 B). Full import on head: 625733 B (gzip 161766 B).

name base head delta bytes delta % gzip head
isValidIE 6337 5640 -697 -11.0% 1926
isValidIe 6337 5640 -697 -11.0% 1926
isValidNfeKey (REGRESSION) 1073 1368 +295 +27.5% 870
formatLicensePlate 770 511 -259 -33.6% 371
getAddressInfoByCep 3404 3220 -184 -5.4% 1420
generateBoleto 1361 1178 -183 -13.4% 701
isValidPixKey 4626 4519 -107 -2.3% 1849
parsePixKey 4521 4414 -107 -2.4% 1815
generatePixPayload 6134 6029 -105 -1.7% 2536
getMunicipality 157762 157660 -102 -0.1% 50900
parseNfeKey 1447 1351 -96 -6.6% 860
addBusinessDays 5612 5532 -80 -1.4% 2311
differenceInBusinessDays 5658 5611 -47 -0.8% 2327
getStateCodeByName 2565 2526 -39 -1.5% 759
isValidCaepf 857 818 -39 -4.6% 522
parseCertidao 1186 1153 -33 -2.8% 690
isHoliday 5036 5005 -31 -0.6% 2103
isValidBankAccount 6142 6172 +30 +0.5% 2311
isValidCreditCard 514 544 +30 +5.8% 390
GetAddressInfoByCepError 254 283 +29 +11.4% 246
GetAddressInfoByCepNotFoundError 347 376 +29 +8.4% 265
GetAddressInfoByCepServiceError 346 375 +29 +8.4% 263
GetAddressInfoByCepValidationError 345 374 +29 +8.4% 267
GetCepInfoByAddressError 254 283 +29 +11.4% 246
GetCepInfoByAddressNotFoundError 347 376 +29 +8.4% 265
GetCepInfoByAddressValidationError 345 374 +29 +8.4% 267
formatBoleto 690 719 +29 +4.2% 455
formatCEP 520 549 +29 +5.6% 395
formatCNPJ 671 700 +29 +4.3% 468
formatCPF 563 592 +29 +5.2% 419
formatCep 520 549 +29 +5.6% 395
formatCertidao 559 588 +29 +5.2% 405
formatCnae 520 549 +29 +5.6% 398
formatCnh 523 552 +29 +5.5% 395
formatCnpj 671 700 +29 +4.3% 468
formatCns 529 558 +29 +5.5% 397
formatCpf 563 592 +29 +5.2% 419
formatLegalNature 501 530 +29 +5.8% 387
formatNfeKey 554 583 +29 +5.2% 393
formatPis 525 554 +29 +5.5% 398
formatProcessoJuridico 536 565 +29 +5.4% 401
generateCNPJ 1163 1192 +29 +2.5% 681
generateCPF 949 978 +29 +3.1% 630
generateCep 272 301 +29 +10.7% 256
generateCnpj 1163 1192 +29 +2.5% 681
generateCpf 949 978 +29 +3.1% 630
generateLegalNature 5176 5205 +29 +0.6% 1728
generateLicensePlate 373 402 +29 +7.8% 324
generatePassport 368 397 +29 +7.9% 307
generatePis 488 517 +29 +5.9% 386
generateProcessoJuridico 670 699 +29 +4.3% 474
getBankByCode 28502 28531 +29 +0.1% 7681
getBankByIspb 28506 28535 +29 +0.1% 7681
getBanks 28234 28263 +29 +0.1% 7492
getLegalNatures 5197 5226 +29 +0.6% 1746
getMunicipalities 159483 159512 +29 +0.0% 51112
getStates 2345 2374 +29 +1.2% 660
getTimezoneByState 879 908 +29 +3.3% 458
isValidCEP 272 301 +29 +10.7% 255
isValidCep 272 301 +29 +10.7% 255
isValidCns 754 783 +29 +3.8% 514
isValidLegalNature 5219 5190 -29 -0.6% 1724
isValidPixPayload 1788 1817 +29 +1.6% 977
parseBoleto 303 332 +29 +9.6% 276
parseCep 255 284 +29 +11.4% 242
parseCnh 256 285 +29 +11.3% 242
parseCnpj 360 389 +29 +8.1% 290
parseCpf 256 285 +29 +11.3% 242
parseLegalNature 255 284 +29 +11.4% 241
parsePis 256 285 +29 +11.3% 242
parsePixPayload 1771 1800 +29 +1.6% 967
parseProcessoJuridico 256 285 +29 +11.3% 242
getBoletoInfo 2480 2506 +26 +1.0% 1328
getCities 157237 157263 +26 +0.0% 50596
isValidBoleto 1742 1768 +26 +1.5% 980
formatVoterId 634 659 +25 +3.9% 452
generatePhone 827 852 +25 +3.0% 531
generateVoterId 954 979 +25 +2.6% 633
generateCnh 709 733 +24 +3.4% 461
isValidCNPJ 1333 1310 -23 -1.7% 690
isValidCnpj 1333 1310 -23 -1.7% 690
isValidPhone 2040 2017 -23 -1.1% 987
formatIban 374 395 +21 +5.6% 317
formatNcm 514 535 +21 +4.1% 389
formatPassport 284 305 +21 +7.4% 259
getCepInfoByAddress 3928 3949 +21 +0.5% 1453
isValidCertidao 889 868 -21 -2.4% 550
isValidCsosn 354 375 +21 +5.9% 294
isValidEmail 299 320 +21 +7.0% 256
isValidPIS 819 840 +21 +2.6% 528
isValidPassport 307 328 +21 +6.8% 274
isValidPis 819 840 +21 +2.6% 528
isValidProcessoJuridico 546 567 +21 +3.8% 403
isValidRegistroProfissional 2905 2926 +21 +0.7% 950
parseLicensePlate 280 301 +21 +7.5% 255
parsePassport 284 305 +21 +7.4% 257
removeAccents 249 270 +21 +8.4% 240
formatCurrency 1147 1127 -20 -1.7% 697
isValidCbo 112238 112218 -20 -0.0% 28225
isValidCfop 56209 56189 -20 -0.0% 5546
isValidCnae 95206 95186 -20 -0.0% 20954
parseCurrency 795 775 -20 -2.5% 524
isValidCei 795 814 +19 +2.4% 539
isValidCno 799 818 +19 +2.4% 539
isValidVin 887 868 -19 -2.1% 596
formatCaepf 545 562 +17 +3.1% 402
formatCei 542 559 +17 +3.1% 401
formatCno 542 559 +17 +3.1% 401
isBusinessDay 5081 5064 -17 -0.3% 2150
isValidServicePhone 845 862 +17 +2.0% 485
isValidCnh 761 777 +16 +2.1% 482
parseVoterId 350 366 +16 +4.6% 294
convertCurrencyToWords 2247 2232 -15 -0.7% 1178
convertLicensePlateToMercosul 655 640 -15 -2.3% 441
convertNumberToWords 1893 1878 -15 -0.8% 986
getFormatLicensePlate 465 478 +13 +2.8% 348
isValidLicensePlate 486 499 +13 +2.7% 358
getAreaCodesByState 892 881 -11 -1.2% 519
isValidCst 904 893 -11 -1.2% 521
getHolidays 4715 4724 +9 +0.2% 1993
parsePhone 427 436 +9 +2.1% 327
isValidNcm 115986 115993 +7 +0.0% 24402
isValidIban 541 535 -6 -1.1% 408
parseIban 780 774 -6 -0.8% 537
convertDateToWords 2717 2722 +5 +0.2% 1411
isValidCPF 759 764 +5 +0.7% 452
isValidCpf 759 764 +5 +0.7% 452
isValidRenavam 538 543 +5 +0.9% 398
isValidVoterId 913 908 -5 -0.5% 531
getCbo 112310 112314 +4 +0.0% 28302
getCfop 56242 56246 +4 +0.0% 5589
getCnae 95585 95589 +4 +0.0% 21349
getLegalNature 5274 5278 +4 +0.1% 1778
getAreaCodeInfo 3140 3143 +3 +0.1% 1030
getMunicipalityByCode 159557 159554 -3 -0.0% 51149
getStateByIbgeCode 2502 2505 +3 +0.1% 741
getStateNameByCode 2461 2464 +3 +0.1% 720
capitalize 764 766 +2 +0.3% 493
formatPhone 2117 2118 +1 +0.0% 1079
isValidLandlinePhone 828 829 +1 +0.1% 549
isValidMobilePhone 878 879 +1 +0.1% 582

Regression accepted through the tree-shaking: accepted label.

@hyanmandian hyanmandian changed the title refactor: remove duplicated code, drop unused exports and close every surviving mutant [2.4.0 stack 8/11] Quality: zero duplicated code, zero unused exports, 100% mutation score Sep 12, 2026
@hyanmandian hyanmandian added the tree-shaking: accepted The size increase reported by the tree-shaking check is intentional label Sep 12, 2026
@hyanmandian
hyanmandian force-pushed the stack/08-quality branch 3 times, most recently from 108a8e9 to 3fddbfa Compare September 12, 2026 14:07
@hyanmandian
hyanmandian force-pushed the stack/08-quality branch 2 times, most recently from 8e3eee3 to 4acb4cb Compare September 12, 2026 14:44
@hyanmandian

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 59 minutes.

… surviving mutant

Prepares the code for three new gates that land in the next part (jscpd, knip and
Stryker), so that each of them is green from its first run.

Duplication: the per-state IE validators share two private helpers for the weighted sums
and the modulo 11 digit; isValidCei and isValidCno delegate to
_internals/is-valid-cei-cno-number (the CNO inherited the CEI numbering); the CBO and CFOP
generators fetch and sort through _internals/fetch-sorted-record; repeated test setups
became local helpers or table-driven cases with the same literal expectations.

Unused code: MIN_PRECISION, MAX_PRECISION, PHONE_INTERNATIONAL_PREFIX, PIX_KEY_MAX_LENGTH,
CEI_LENGTH and the Mod11Variant type are no longer exported; the two voter id federative
union constants are one.

Mutation testing: 641 surviving mutants across 115 files were closed, mostly with new tests
carrying hand-written expectations, otherwise by removing guards that a later check already
enforced. parseNfeKey now performs the validation and isValidNfeKey delegates to it, so the
model narrowing has no unreachable branch. getCities keeps its cached combined list; the test
that asserts its content is the first caller so the cached path is exercised. The few
provably equivalent mutants are marked with `Stryker disable next-line` and a reason.
@hyanmandian
hyanmandian removed this pull request from stack #514 September 12, 2026 22:57
@hyanmandian
hyanmandian added this pull request to stack #524 September 12, 2026 22:58
@hyanmandian hyanmandian changed the title [2.4.0 stack 8/11] Quality: zero duplicated code, zero unused exports, 100% mutation score [2.4.0 stack 9/14] Quality: zero duplicated code, zero unused exports, 100% mutation score Sep 12, 2026
@hyanmandian

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@hyanmandian have exceeded the limit for the number of chat messages per hour. Please wait 16 minutes and 57 seconds before sending another message.

@hyanmandian

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review skipped: 176 files exceed the limit of 150.

@hyanmandian
hyanmandian removed this pull request from stack #524 September 13, 2026 01:17
@hyanmandian
hyanmandian added this pull request to stack #527 September 13, 2026 01:17
@hyanmandian hyanmandian changed the title [2.4.0 stack 9/14] Quality: zero duplicated code, zero unused exports, 100% mutation score [2.4.0 stack 9/16] Quality: zero duplicated code, zero unused exports, 100% mutation score Sep 13, 2026
@hyanmandian
hyanmandian removed this pull request from stack #527 September 13, 2026 03:44
@hyanmandian
hyanmandian added this pull request to stack #530 September 13, 2026 03:44
@hyanmandian hyanmandian changed the title [2.4.0 stack 9/16] Quality: zero duplicated code, zero unused exports, 100% mutation score [2.4.0 stack 9/18] Quality: zero duplicated code, zero unused exports, 100% mutation score Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tree-shaking: accepted The size increase reported by the tree-shaking check is intentional

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant