chore: resolve fallow dead-code findings and decompose dd-rules complexity#37
Merged
Conversation
- xml-emit.ts: remove export and stale suppression from emitPstlAdr and emitPstlAdrSEPA (used only within the module); delete the dead emitNmElement function and its JSDoc entirely (never called anywhere) - arbitraries.ts: un-export IBAN_COUNTRIES, SEPA_CHARSET, arbSanitizedSepaText, MAX_AMOUNT_MINOR (all used only within the file) - pain008.ts: un-export FrequencyCodeSchema and MandateSetupReasonSchema (composed internally into MandateAmendmentSchema; not re-exported from index.ts); drop the now-unused FrequencyCode and MandateSetupReason type aliases - generate-snapshots.ts: add correct fallow-ignore-next-line unused-export suppression for writeSnapshots (a script entry point, not a test import)
…elpers Extract R1, R2, R3, R4 checks into focused private functions: - checkR1SignatureBeforeCollection: returns one issue or null - checkR2Issues: OOFF single-use mandate check - checkR3Issues: mandate scheme consistency check - checkR4SmndaRequiresFirst: SMNDA requires FRST batch - accumulateMandateUsage: pure map accumulator The orchestrator becomes a thin coordinator. Issue ordering is identical to before: R1 in collection-traversal order, R2 then R3 per mandate in map-insertion order, R4 at the end. Cognitive complexity: 58 (CRITICAL) -> 15 on the orchestrator. All 668 tests pass; guard suites stress-ran 8x with zero failures.
Contributor
Fallow audit reportFound 2 findings. Details
Generated by fallow. |
| * (SMNDA), the batch's sequenceType must be 'FRST'. | ||
| * Returns issues for each violating collection. | ||
| */ | ||
| function checkR4SmndaRequiresFirst(doc: DirectDebitDocument): ProfileIssue[] { |
Contributor
There was a problem hiding this comment.
warn fallow/high-cognitive-complexity: 'checkR4SmndaRequiresFirst' has cognitive complexity 13 (threshold: 12)
| * @param doc A DirectDebitDocument that has already passed Zod schema validation. | ||
| * @returns An array of ProfileIssue describing any violations (empty when valid). | ||
| */ | ||
| export function checkDirectDebitRules(doc: DirectDebitDocument): ProfileIssue[] { |
Contributor
There was a problem hiding this comment.
warn fallow/high-cognitive-complexity: 'checkDirectDebitRules' has cognitive complexity 15 (threshold: 12)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolved dead code findings by removing unused functions and making over-exported helpers private. Decomposed checkDirectDebitRules (SDD mandate rules R1-R4) to meet fallow complexity thresholds, extracting mandate-index building and R2/R3 rule checking into per-rule helpers. Behavior is identical: same issues, same order, same messages and codes.
Changes
Notes