feat: add Spanish DNI/NIF generator to ID generator - #1906
Conversation
PR Summary
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1906 +/- ##
============================================
+ Coverage 92.28% 92.35% +0.06%
- Complexity 3597 3604 +7
============================================
Files 348 349 +1
Lines 7115 7127 +12
Branches 695 695
============================================
+ Hits 6566 6582 +16
+ Misses 376 374 -2
+ Partials 173 171 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Grok review: PR Review: #1906 – feat: add Spanish DNI/NIF generator to ID generator Author: SetyVII What the PR does
Usage example (from PR description): Faker faker = new Faker(Locale.forLanguageTag("es-ES"));
String validDni = faker.idNumber().valid();
String invalidDni = faker.idNumber().invalid();Correctness of the algorithm
This is confirmed by official sources (Spanish Ministry of the Interior) and multiple independent validators. The provided test cases also match known examples:
Invalid generation is also solid: it deliberately picks the next letter in the cycle so the checksum fails while still matching the regex. Code quality & consistency
Minor observations / suggestions:
|
asolntsev
left a comment
There was a problem hiding this comment.
But check Grok's comment.
Summary
This PR adds support for generating Spanish DNI/NIF identification numbers.
This initial implementation covers the standard DNI/NIF format for Spanish
nationals.
Tests for Spanish ID number generation are included.
Official references: