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

Use ruff for linting and formatting #555

Merged
merged 5 commits into from
May 11, 2024
Merged

Conversation

jarrodmillman
Copy link
Member

@jarrodmillman jarrodmillman commented May 11, 2024

A couple of issues:

  1. We don't appear to be testing BadExamples in numpydoc/tests/test_validate.py.
  2. I had to fix the line numbers (see 2e6d88b) to get the prerelease tests to pass, but it wasn't necessary for the standard tests. For the standard tests we run pytest -v --pyargs numpydoc. For the prerelease test we run pytest -v --pyargs ..

numpydoc/tests/hooks is in the source directory:

$ ls -1 numpydoc/tests/
hooks
test_docscrape.py
test_full.py
test_main.py
test_numpydoc.py
test_validate.py
test_xref.py
tinybuild

but isn't in the installed package

$ ls -1 ~/.venv/nx/lib64/python3.11/site-packages/numpydoc/tests/
test_docscrape.py
test_full.py
test_main.py
test_numpydoc.py
test_validate.py
test_xref.py
tinybuild

I ignore a large number of linting checks because they don't have automated fixes (or their automated fixes are unsafe). I think we should eventually enable them one by one and implement the fixes in follow-up PRs. I would like to keep them separate because they will require more attention and careful review than these changes. I would like to get this PR in relatively quickly because I think moving to ruff is worth it. It is much faster, implements multiple tools, is being rapidly developed, and has been adding features specific for our community.

@jarrodmillman jarrodmillman marked this pull request as draft May 11, 2024 16:05
def f():
def _function_without_seealso_and_examples():
"""
A function whose docstring has no examples or see also section.

Expect SA01 and EX01 errors if validation enabled.
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

I did not know a function with only a docstring is valid!

Copy link
Contributor

@stefanv stefanv left a comment

Choose a reason for hiding this comment

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

Looks good to me; I agree that it's better to get the toolchain in place quickly, and to the iteratively refine.

@jarrodmillman jarrodmillman marked this pull request as ready for review May 11, 2024 18:04
@jarrodmillman jarrodmillman marked this pull request as draft May 11, 2024 18:05
@jarrodmillman jarrodmillman marked this pull request as ready for review May 11, 2024 18:14
@jarrodmillman jarrodmillman merged commit acad4ec into numpy:main May 11, 2024
23 checks passed
@stefanv stefanv added this to the 1.8.0 milestone May 11, 2024
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.

2 participants