refactor: align outliers in ndarray/iter with namespace error-construction conventions#11801
Closed
Planeshifter wants to merge 6 commits intodevelopfrom
Closed
refactor: align outliers in ndarray/iter with namespace error-construction conventions#11801Planeshifter wants to merge 6 commits intodevelopfrom
ndarray/iter with namespace error-construction conventions#11801Planeshifter wants to merge 6 commits intodevelopfrom
Conversation
…nstruction conventions Wrapped the dim-check `TypeError` in `format(...)` to match the dominant error-construction pattern in the file (other throws already use `format()`, including a static-string `Error` on line 113) and across the `ndarray/iter` namespace, where sibling packages with analogous dim-checks (`subarrays`, `stacks`, `interleave-subarrays`) wrap the throw in `format()`. Message text is preserved exactly.
…ion conventions Wrapped the dim-check `TypeError` in `format(...)` to match the dominant error-construction pattern in the file (other throws already use `format()`, including a static-string `Error` on line 113) and across the `ndarray/iter` namespace, where sibling packages with analogous dim-checks (`subarrays`, `stacks`, `interleave-subarrays`) wrap the throw in `format()`. Message text is preserved exactly.
…tion conventions Wrapped the dim-check `TypeError` in `format(...)` to match the dominant error-construction pattern in the file (other throws already use `format()`, including a static-string `Error` on line 107) and across the `ndarray/iter` namespace, where sibling packages with analogous dim-checks (`subarrays`, `stacks`, `interleave-subarrays`) wrap the throw in `format()`. Message text is preserved exactly.
…nstruction conventions Wrapped the dim-check `TypeError` in `format(...)` to match the dominant error-construction pattern in the file (other throws already use `format()`, including a static-string `Error` on line 113) and across the `ndarray/iter` namespace, where sibling packages with analogous dim-checks (`subarrays`, `stacks`, `interleave-subarrays`) wrap the throw in `format()`. Message text is preserved exactly.
…ruction conventions Wrapped the dim-check `TypeError` in `format(...)` to match the dominant error-construction pattern in the file (other throws already use `format()`, including a static-string `Error` on line 113) and across the `ndarray/iter` namespace, where sibling packages with analogous dim-checks (`subarrays`, `stacks`, `interleave-subarrays`) wrap the throw in `format()`. Message text is preserved exactly.
… conventions Wrapped the dim-check `TypeError` in `format(...)` to match the dominant error-construction pattern in the file (other throws already use `format()`, including a static-string `Error` on line 113) and across the `ndarray/iter` namespace, where sibling packages with analogous dim-checks (`subarrays`, `stacks`, `interleave-subarrays`) wrap the throw in `format()`. Message text is preserved exactly.
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
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.
Aligning outliers in
ndarray/iterwith namespace majority patterns (random namespace pick, seed20260426).Description
This pull request normalizes a single drift item across six packages in the
@stdlib/ndarray/iternamespace. Each outlier had exactly onethrow new TypeError( '...' )site that passed a plain string literal instead of routing the message throughformat(...)— diverging from the dominant pattern in the same file (4/5 = 80% of throws already usedformat(), including a static-stringErrorwrapped informat()for the read-only check) and from all three sibling packages with analogous dim-checks (subarrays,stacks,interleave-subarrays). Message text is preserved verbatim in every case.Namespace summary
ndarray/iter20260426package.jsonshape, README section structure, test/benchmark/example file naming. All 14 packages structurally identical — no structural drift.@stdlib/*dependencies.package.jsontop-level keys (100%), README section sequence (100%,Usage→Notes→Examples→See Also),returnKind(100%iterator),jsdocShape.hasExample(100% true),errorConstruction(100%formatat the package level when classified as "format dominates"). Within-file drift on a single throw site in 6/14 packages.publicSignature,validationPrologue,dependencies— these legitimately vary by what each iterator does (shapevsxinput,readonlyvsorderoption, etc.).Per-package notes
ndarray/iter/column-entriesFixes a formatting inconsistency in
ndarray/iter/column-entrieswhere a single dim-checkTypeErrorwas thrown with a plain string literal rather than wrapped informat(), diverging from the other 4 of 5 throws in the file that already useformat()— including a static-stringErroron line 113. Across thendarray/iternamespace, 8 of 14 sibling packages useformat()exclusively, and all 3 analogous dim-check sites insubarrays,stacks, andinterleave-subarrayswrap informat(). Message text is unchanged; this brings the package into conformance with the established pattern.ndarray/iter/columnsFixes a formatting inconsistency in
ndarray/iter/columnswhere oneTypeErrorthrow was passing a plain string literal directly rather than routing throughformat(), diverging from the other 4 of 5 throws in the same file and from all 3 analogous dim-checks in sibling packages (subarrays,stacks,interleave-subarrays). Across the 14ndarray/itersiblings, 8 useformat()exclusively; the remaining 6 shared this same single-site deviation. Message text is unchanged.ndarray/iter/matricesFixes a formatting inconsistency in
ndarray/iter/matriceswhere the minimum-dimensionsTypeErrorwas constructed with a plain string literal rather thanformat(), diverging from the other four throws in the same file (80% conformance) and from all three sibling packages with analogous dimension checks (subarrays,stacks,interleave-subarrays). Across the fourteenndarray/iterpackages, eight already useformat()exclusively; this was one of six exhibiting the same drift. Message text is unchanged.ndarray/iter/matrix-entriesFixes a formatting drift in
ndarray/iter/matrix-entrieswhere the minimum-dimensionsTypeErrorwas thrown with a plain string literal instead offormat(), inconsistent with the other 4/5 throws in the same file and with all 3 analogous dim-checks across sibling packages (subarrays,stacks,interleave-subarrays). Across the broaderndarray/iternamespace, 8 of 14 siblings useformat()exclusively; this package was among the 6 with this single plain-string outlier. The fix wraps the existing message text informat()without altering the message content.ndarray/iter/row-entriesFixes a formatting inconsistency in
ndarray/iter/row-entrieswhere the minimum-dimensionsTypeErrorwas constructed with a plain string literal rather thanformat(), making it the sole outlier among 5 throws in the file (the other 4, including a static-stringError, all useformat()). Across the 14ndarray/itersibling packages, 8 useformat()exclusively; all 3 siblings with analogous dimension-check throws (subarrays,stacks,interleave-subarrays) wrap them informat(). The fix wraps the throw informat()with the message text preserved verbatim.ndarray/iter/rowsFixes a formatting inconsistency in
ndarray/iter/rowswhere the dimension-checkTypeErrorwas constructed with a plain string literal instead offormat(), the pattern used by every other throw in the file (4 of the remaining 4 throws, including a static-stringErroron line 113). Across thendarray/iternamespace, 8 of 14 siblings useformat()exclusively, and all 3 analogous dim-check sites insubarrays,stacks, andinterleave-subarrayswrap their throws informat(). Message text is unchanged; this brings the one outlier throw in line with established convention.Related Issues
This pull request has no related issues.
Questions
No.
Other
Validation
What was checked:
package.jsonshape, README headings, test/benchmark/example file naming) — all identical.What was deliberately excluded:
publicSignature,validationPrologue,dependencies) — these reflect intentional semantic differences (e.g.entries/values/indicesuseoptions.orderwhereas the view-returning iterators useoptions.readonly,select-dimensiontakes adimargument,interleave-subarraystakesarrays+ndims, etc.).TypeErrorconstructor only and do not depend on exact message text (which is preserved regardless).Checklist
AI Assistance
How AI assistance was used:
Disclosure
This PR was authored by Claude Code as part of an automated cross-package drift detection routine: a randomly selected stdlib namespace (
ndarray/iter, seed20260426) was scanned for majority-vs-outlier conventions across structural and semantic features, drift findings were independently validated by three review agents, and only mechanical, behavior-preserving corrections were applied. Each per-package commit was generated by Claude Code; a human maintainer should audit before promoting from draft.@stdlib-js/reviewers
Generated by Claude Code