Refactor small maintainability issues in transformations, fake-value resolution and Irish PPSN generation#1871
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1871 +/- ##
============================================
+ Coverage 92.45% 92.52% +0.06%
- Complexity 3557 3563 +6
============================================
Files 345 346 +1
Lines 7025 7050 +25
Branches 685 685
============================================
+ Hits 6495 6523 +28
+ Misses 366 364 -2
+ Partials 164 163 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for maintaining DataFaker. I noticed this PR contains a few small maintainability refactorings in separate areas. I kept them small and behaviour-preserving, but I am happy to split this into separate smaller PRs if that would better match the project’s contribution style. Validation run locally:
Please let me know if you would prefer this PR to be narrowed to one logical change. |
|
I think it's okay as-is. Yes it's multiple ummm topics but it isn't 100s of lines of change either. I'll try to review this afternoon, in my experience others are generally quiet on the weekends with this project. |
|
Thanks for your contribution. I'm not sure how this PR is solving anything, and I don't think it's a good idea to move around stuff as a first PR while not maintaining this library. As such, closing this PR. |
|
Thank you for reviewing the PR and for the feedback. I understand the concern. This was submitted as a small maintainability-focused refactoring, but I respect that it may not fit the project’s preferred contribution direction. I appreciate your time, and I will keep this feedback in mind for any future contribution by starting with a smaller, more clearly scoped issue or maintainer-approved change. |
Summary
This pull request makes a small set of maintainability-focused refactorings:
Classusage inJavaObjectTransformer.apply()withClass<?>and typedinstanceofhandling.dotIndex == -1branch from the privateFakeValuesService.resolveFakerObjectAndMethod()helper.indexOf()while the code usescontains("}").Why
These changes address small maintainability issues found during source inspection. They improve type clarity, remove unreachable control-flow noise, align comments with the current implementation, and separate checksum calculation from the high-level PPSN generation workflow.
The changes are intentionally small and avoid public API or generic-contract redesign.
Refactoring approach
The refactoring was kept local to the affected implementation details:
JavaObjectTransformer.apply()now usesClass<?>to represent an unknown class type more safely.FakeValuesService.resolveFakerObjectAndMethod()now reflects the verified private helper call contract more directly.FakeValuesService.resolveExpression()no longer contains a stale implementation-specific comment.IrishIdNumber.generateValid()now delegates weighted checksum accumulation tocalculateWeightedSum(...), while preserving the existing weights, suffix handling, multiplier, checksum character calculation and output format.Validation
The following validation was performed:
JavaObjectTransformerTestandJavaObjectTransformerConstructorTestpassed.FakeValuesServiceTestpassed.IrishIdNumberTestpassed.