refactor: use format for error construction in stats/incr/pcorrmat#12268
Merged
Conversation
Normalize a stray plain-string-concatenation throw at `lib/main.js:299` to use the `format` helper from `@stdlib/string/format`. The `format` import was already present and used by every other throw in the same file (six of seven) and by the analogous throw in sibling matrix packages `covmat` and `pcorrdistmat` (100% of throw-bearing matrix packages in `stats/incr`). Behavior is unchanged: the same `Error` is thrown with the same fields substituted; the surrounding text is preserved and the substituted values are wrapped in backticks to match the sibling pattern.
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
approved these changes
May 24, 2026
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.
Description
This pull request:
@stdlib/stats/incr/pcorrmatto use theformathelper from@stdlib/string/format, matching the canonical pattern already used by every other throw in the same file and by sibling matrix packages (covmat,pcorrdistmat). Behavior is unchanged; the sameErroris thrown with the same fields substituted into the message.Questions
No.
Other
@stdlib/stats/incr/pcorrmatlib/main.js:299constructed its error message with'…' + order + '…' + numel(...) + '…'. The surrounding code already requires@stdlib/string/formatand uses it in every other throw in the file (six of seven before this change). The analogous "means length must match matrix dimensions" throw incovmat/lib/main.js:228andpcorrdistmat/lib/main.jsboth useformat( '… Expected: \%u`. Actual: `%u`.', order, numel( means.shape ) )— 100% conformance among throw-bearing matrix packages instats/incr`. Rewrite mirrors that pattern verbatim; substituted values are now backtick-wrapped to match. Tests assert on error type only, not message text, and no examples trigger this path.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored with assistance from Claude Code, which ran a cross-package API drift detection routine over the
stats/incrnamespace. The routine performed structural and semantic feature extraction across all 108 member packages, identifiedpcorrmat/lib/main.js:299as the sole outlier on error-construction conformance (98% of throw-bearing siblings useformatexclusively), and proposed the one-line fix after passing two-agent validation (semantic-review confirmed the deviation was unintentional; cross-reference confirmed no test or example relies on the exact message text).@stdlib-js/reviewers
Generated by Claude Code