Skip to content

Make numpydoc lint --ignore ... parsing more robust#560

Open
stefanv wants to merge 7 commits into
numpy:mainfrom
stefanv:more-robust-lint-ignore
Open

Make numpydoc lint --ignore ... parsing more robust#560
stefanv wants to merge 7 commits into
numpy:mainfrom
stefanv:more-robust-lint-ignore

Conversation

@stefanv
Copy link
Copy Markdown
Contributor

@stefanv stefanv commented May 24, 2024

Before, the only way to specify ignores is as:

  numpydoc lint filename --ignore EX01 SA01

and multiple invocations of the ignore flag overwrote one another.

Instead, ignored checks are now specified as:

  numpydoc lint --ignore=EX01,SA01 filename

The comma can also be whitespace:

  numpydoc lint --ignore="EX01 SA01" filename

Multiple ignore flags work correctly:

  numpydoc lint --ignore EX01 --ignore SA01 filename

@stefmolin Would you be willing to take a look?

Before, the only way to specify ignores is as:

  numpydoc lint filename --ignore EX01 SA01

and multiple invocations of the ignore flag overwrote one another.

Instead, ignored checks are now specified as:

  numpydoc lint --ignore=EX01,SA01 filename

The comma can also be whitespace:

  numpydoc lint --ignore="EX01 SA01" filename

Multiple ignore flags work correctly:

  numpydoc lint --ignore EX01 --ignore SA01 filename
Copy link
Copy Markdown
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

LGTM, though @stefmolin 's opinion would be the most valuable. Thanks @stefanv !

@stefanv
Copy link
Copy Markdown
Contributor Author

stefanv commented May 24, 2024

I should note that this is backward incompatible (but I don't think we've made a release with the numpydoc lint interface yet?). Specifically:

numpydoc lint foo.py --ignore EX01 SA01

needs to be rewritten as any of the following:

numpydoc lint --ignore EX01,SA01 foo.py  # --ignore can be before or after foo.py
numpydoc lint --ignore=EX01,SA01 foo.py
numpydoc lint --ignore EX01 --ignore SA01 foo.py

@stefmolin
Copy link
Copy Markdown
Contributor

I'm traveling now, but I will take a look when I'm back later this week.

Copy link
Copy Markdown
Contributor

@stefmolin stefmolin left a comment

Choose a reason for hiding this comment

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

Functionality works as expected. I think we are missing a test case for this though (I left a suggestion).

Comment thread numpydoc/tests/test_main.py Outdated
Comment thread numpydoc/cli.py
rossbar and others added 2 commits June 19, 2024 04:37
Co-authored-by: Stefanie Molin <24376333+stefmolin@users.noreply.github.com>
@stefanv stefanv force-pushed the more-robust-lint-ignore branch from ea04f40 to a2b162f Compare May 22, 2026 23:31
@stefanv stefanv force-pushed the more-robust-lint-ignore branch from a2b162f to c790eeb Compare May 22, 2026 23:56
@stefanv
Copy link
Copy Markdown
Contributor Author

stefanv commented May 23, 2026

@stefmolin I addressed your feedback, thank you. This should be ready now.

Copy link
Copy Markdown
Collaborator

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

LGTM, @stefmolin feel free to look again if you want. If not, no sweat -- it seems like the review comment about needing a test has been addressed so I'm happy to click the green button!

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.

4 participants