Skip to content
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

Rework hook output to remove the table #611

Merged
merged 4 commits into from
Mar 11, 2025

Conversation

stefmolin
Copy link
Contributor

@stefmolin stefmolin commented Mar 6, 2025

  • Replace table output with single lines to avoid wrapped tables that break the ability to cmd+click on the output and go to that line of the file regardless of length
  • Switch hook's require_serial setting to False
  • Remove tabulate dependency
  • Fix failing test suite on Sphinx >= 7.3 (AttributeError: 'MockBuilder' object has no attribute '_translator')

Example output:

numpydoc/numpydoc.py:388: GL08 The object does not have a docstring

numpydoc/numpydoc.py:399: GL01 Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)

numpydoc/numpydoc.py:399: GL02 Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)

numpydoc/numpydoc.py:399: GL03 Double line break found; please use only one blank line to separate sections or paragraphs, and do not leave blank lines at the end of docstrings

numpydoc/numpydoc.py:399: PR01 Parameters {'lines', 'content_old'} not documented

numpydoc/numpydoc.py:399: RT01 No Returns section found

Closes #606


To test out the changes, you can run pre-commit try-repo . --files numpydoc/* after checking out the changes. Alternatively, you can point your pre-commit-config.yaml at my fork:

- repo: https://github.com/stefmolin/numpydoc
  rev: b8dc0a3407620c3b37fab4bf862bca077ba146ec
  hooks:
    - id: numpydoc-validation

@stefanv
Copy link
Contributor

stefanv commented Mar 6, 2025

This looks great! Shall we get rid of the newline in between lines?

@stefanv
Copy link
Contributor

stefanv commented Mar 6, 2025

CI error is:

E       AttributeError: 'MockBuilder' object has no attribute '_translator'

@stefmolin
Copy link
Contributor Author

This looks great! Shall we get rid of the newline in between lines?

I find it gets very hard to read with the long descriptions that wrap the line if there is no line between:

numpydoc/numpydoc.py:388: GL08 The object does not have a docstring
numpydoc/numpydoc.py:399: GL01 Docstring text (summary) should start in the line immediately
after the opening quotes (not in the same line, or leaving a blank line in between)
numpydoc/numpydoc.py:399: GL02 Closing quotes should be placed in the line after the last text
in the docstring (do not close the quotes in the same line as the text, or leave a blank line
between the last text and the quotes)
numpydoc/numpydoc.py:399: GL03 Double line break found; please use only one blank line to
separate sections or paragraphs, and do not leave blank lines at the end of docstrings
numpydoc/numpydoc.py:399: PR01 Parameters {'lines', 'content_old'} not documented
numpydoc/numpydoc.py:399: RT01 No Returns section found

@stefmolin
Copy link
Contributor Author

CI error is:

E       AttributeError: 'MockBuilder' object has no attribute '_translator'

This was unrelated to the changes, but I fixed it here. Let me know if you would prefer a separate PR.

@stefanv
Copy link
Contributor

stefanv commented Mar 8, 2025

No, I think that's all good!

@stefanv
Copy link
Contributor

stefanv commented Mar 8, 2025

@larsoner Does this look OK to you?

@larsoner larsoner merged commit a36287a into numpy:main Mar 11, 2025
30 checks passed
@larsoner
Copy link
Collaborator

Yep, thanks @stefmolin !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thoughts on a new display format for numpydoc lint and pre-commit hook findings
3 participants