Skip to content

docs: fix REPL examples in stats/ttest #2707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

Snehil-Shah
Copy link
Member

Description

What is the purpose of this pull request?

This pull request:

  • fixes incorrect REPL example code

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

While trying to commit, I encountered a bunch of REPL lint errors.

{
  "file": "/workspaces/stdlib/lib/node_modules/@stdlib/stats/ttest/docs/repl.txt",
  "errors": [
    {
      "id": "@stdlib/_tools/repl-txt/rules/doctest",
      "severity": "error",
      "message": "Malformed return annotation. Encountered error while parsing: Bad object",
      "start": 81,
      "end": 184
    },
    {
      "id": "@stdlib/_tools/repl-txt/rules/doctest",
      "severity": "error",
      "message": "Malformed return annotation. Encountered error while parsing: Bad object",
      "start": 81,
      "end": 184
    },
    {
      "id": "@stdlib/_tools/repl-txt/rules/doctest",
      "severity": "error",
      "message": "`Paired t-test` should be wrapped in single quotes",
      "start": 81,
      "end": 184
    },
    {
      "id": "@stdlib/_tools/repl-txt/rules/doctest",
      "severity": "error",
      "message": "`One-sample t-test` should be wrapped in single quotes",
      "start": 81,
      "end": 184
    },
    {
      "id": "@stdlib/_tools/repl-txt/rules/doctest",
      "severity": "error",
      "message": "Malformed return annotation. Encountered error while parsing: Bad object",
      "start": 81,
      "end": 184
    },
    {
      "id": "@stdlib/_tools/repl-txt/rules/doctest",
      "severity": "error",
      "message": "`One-sample t-test` should be wrapped in single quotes",
      "start": 81,
      "end": 184
    },
    {
      "id": "@stdlib/_tools/repl-txt/rules/doctest",
      "severity": "error",
      "message": "`One-sample t-test` should be wrapped in single quotes",
      "start": 81,
      "end": 184
    },
    {
      "id": "@stdlib/_tools/repl-txt/rules/code-semicolons",
      "severity": "error",
      "message": "Semicolons must not be omitted if output is suppressed",
      "start": 81,
      "end": 184
    },
    {
      "id": "@stdlib/_tools/repl-txt/rules/code-semicolons",
      "severity": "error",
      "message": "Semicolons must not be omitted if output is suppressed",
      "start": 81,
      "end": 184
    }
  ]
}

I am to be blamed for the error due to code-semicolons rule originating in #2435. The updated rule doesn't work for multi-line inputs, as it's checking line by line. For instance, the line for ( i = 0; i < 20; i++ ) { doesn't have both the output and semicolon.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kgryte
Copy link
Member

kgryte commented Jul 29, 2024

@Snehil-Shah Can you wrap the output of out.print() in single quotes? Hopefully that will resolve some of the lint errors.

@kgryte
Copy link
Member

kgryte commented Jul 29, 2024

The use of print() should have been changed a while ago, but I don't believe @Planeshifter has gotten around to refactoring the various stats testing packages.

@Snehil-Shah
Copy link
Member Author

I tried; apparently, it's a problem with multi-line outputs.

{
  "message": "Displayed return value is `Paired t-test`, but expected `Paired t-test\n\nAlternative hypothesis: True difference in means is not equal to 0\n\n pValue: 0.9339\n statistic: 0.0832\n df: 99\n 95% confidence interval: [-0.5539,0.6024]\n\nTest Decision: Fail to reject null in favor of alternative at 5% significance level\n` instead"
}

Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's land this; doctest linting has a few edge cases we need to fix but that shouldn't hold up this change.

@Planeshifter Planeshifter merged commit ea517aa into stdlib-js:develop Aug 1, 2024
6 of 7 checks passed
gunjjoshi pushed a commit to gunjjoshi/stdlib that referenced this pull request Aug 21, 2024
PR-URL: stdlib-js#2707

Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Reviewed-by: Athan Reines <kgryte@gmail.com> 
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants