Make numpydoc lint --ignore ... parsing more robust#560
Conversation
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
rossbar
left a comment
There was a problem hiding this comment.
LGTM, though @stefmolin 's opinion would be the most valuable. Thanks @stefanv !
|
I should note that this is backward incompatible (but I don't think we've made a release with the needs to be rewritten as any of the following: |
|
I'm traveling now, but I will take a look when I'm back later this week. |
stefmolin
left a comment
There was a problem hiding this comment.
Functionality works as expected. I think we are missing a test case for this though (I left a suggestion).
Co-authored-by: Stefanie Molin <24376333+stefmolin@users.noreply.github.com>
ea04f40 to
a2b162f
Compare
a2b162f to
c790eeb
Compare
|
@stefmolin I addressed your feedback, thank you. This should be ready now. |
larsoner
left a comment
There was a problem hiding this comment.
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!
stefmolin
left a comment
There was a problem hiding this comment.
It's been a while so I took a fresh look. Some minor comments.
|
|
||
| args = vars(ap.parse_args(argv)) | ||
|
|
||
| # Parse --ignored=SA01,EX01 |
There was a problem hiding this comment.
Typo:
| # Parse --ignored=SA01,EX01 | |
| # Parse --ignore=SA01,EX01 |
| if args.get("ignore", None) is not None: | ||
| for checks in args["ignore"]: |
There was a problem hiding this comment.
nit: I prefer the walrus operator if I am going to use the value (also removing the None since it is the default):
| if args.get("ignore", None) is not None: | |
| for checks in args["ignore"]: | |
| if (ignore := args.get("ignore")) is not None: | |
| for checks in ignore: |
There was a problem hiding this comment.
I'm also wondering if we even need the is not None part and can just check if the get() is truthy.
| if args.get("ignore", None) is not None: | |
| for checks in args["ignore"]: | |
| if ignore := args.get("ignore"): | |
| for checks in ignore: |
Before, the only way to specify ignores is as:
and multiple invocations of the ignore flag overwrote one another.
Instead, ignored checks are now specified as:
The comma can also be whitespace:
Multiple ignore flags work correctly:
@stefmolin Would you be willing to take a look?