refactor: merge two-condition argument-validation blocks into single if-statement#11921
Open
Planeshifter wants to merge 1 commit intodevelopfrom
Open
refactor: merge two-condition argument-validation blocks into single if-statement#11921Planeshifter wants to merge 1 commit intodevelopfrom
Planeshifter wants to merge 1 commit intodevelopfrom
Conversation
… conventions Merged the two-block argument validation prologue in `lib/main.js` and `src/main.c` into a single `if`-block, matching the convention used by 10/12 sibling packages in `@stdlib/stats/base/dists/negative-binomial` (83% conformance) and 6/7 native-binding C siblings (86% conformance). Behavior is unchanged: invalid inputs still return NaN.
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
stats/base/dists/negative-binomial
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/base/dists/negative-binomialwith namespace majority patterns (random namespace pick, seed20260504).Namespace summary
stats/base/dists/negative-binomialcdf,ctor,kurtosis,logpmf,mean,mgf,mode,pmf,quantile,skewness,stdev,variance); none autogeneratedpackage.jsontop-level keys (18 keys, 100%), universal keywords (10, 100%), JSDoc@examplepresence (100%),returnKind(value, 100%), validation-prologue structure (single-block-or, 10/12 = 83%;ctorexcluded as it throws rather than returning NaN)r-parameter description text (6/6 split between "successes" and "failures" — flagged for future work);lib/factory.jspresence (5/12 = 42%, function-class-specific)Related Issues
No.
Questions
No.
Other
meanMerges the two-condition argument-validation blocks in
lib/main.jsandsrc/main.cinto a singleif-statement, matching the convention used by 10 of 12 JS siblings (83%) and 6 of 7 native-binding C siblings (86%) in thenegative-binomialnamespace. No logic change; the NaN-return path and guarded conditions are identical.Validation
Three independent passes audited the single drift finding before it advanced to a commit:
package.jsonshape, README L2 sections, and keywords are uniform across the namespace; the only structural split is the native-binding bundle (binding.gyp,src/,include/,manifest.json,lib/native.js,directories.{include,src},gypfile), which tracks an intentional implementation choice and is below the 75% threshold.lib/main.js,lib/index.js, and validation prologues identifiedmeanas the sole JS package using a two-block prologue.semantic-review,cross-reference,structural-review) returnedconfirmed-drift,ok-to-apply, andno-driftrespectively. The cross-reference pass verified test/example/consumer code does not depend on the deviating structure, and additionally surfaced the parallel two-block layout inmean/src/main.c, which is corrected in the same commit.Deliberately excluded:
r-parameter descriptions (6/6 split, no clear majority) — flagged for a follow-up that reconciles the JSDoc with the README narrative (which uniformly says "successes").p < 0.0vsp <= 0.0variation inpmf/logpmfprologues —pmfandlogpmfcarry trailingp === 0.0branches that imply the deviation is intentional, not drift.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was generated by Claude Code running the cross-package drift-detection routine: structural and semantic features were extracted across the namespace, the majority pattern computed at a 75% threshold, and the single surviving outlier validated by three independent review passes (semantic, cross-reference, structural) before the mechanical merge was applied. The diff is purely cosmetic — no behavior change.
@stdlib-js/reviewers
Generated by Claude Code