This repository was archived by the owner on Nov 3, 2023. It is now read-only.
Add the ability to skip checking some functions.#587
Open
mgilson wants to merge 1 commit intoPyCQA:masterfrom
Open
Add the ability to skip checking some functions.#587mgilson wants to merge 1 commit intoPyCQA:masterfrom
mgilson wants to merge 1 commit intoPyCQA:masterfrom
Conversation
There are times when you might not want to check a function's docstring. Specifically, we frequently want to ignore test files. There is already an exemption that causes test functions to be considered non-public. This extends on that idea and makes it configurable so a user can cause a test function to be allowed to have no docstring.
f22663b to
140300c
Compare
aphedges
reviewed
Apr 11, 2022
Contributor
aphedges
left a comment
There was a problem hiding this comment.
From looking at the code itself, this looks good except for a small concern. I'll try it out later this week to see if it works well.
| name_skip = ( | ||
| ignore_functions is not None | ||
| and not definition.docstring | ||
| and bool(ignore_functions.findall(definition.name)) |
Contributor
There was a problem hiding this comment.
search() is probably a better option than findall() because it only needs to find one instance of the pattern instead of all. However, function names should short enough that the performance difference is negligible, so I'm not sure a change is needed.
Author
There was a problem hiding this comment.
Yeah, I was just following along with the prior art for decorators (e.g. line 151).
I'm happy to change just this one (or both) to use pattern.search instead.
psycoder21
approved these changes
May 24, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are times when you might not want to check a function's
docstring. Specifically, we frequently want to ignore
test files. There is already an exemption that causes test
functions to be considered non-public. This extends on
that idea and makes it configurable so a user can cause
a test function to be allowed to have no docstring.
This is a potential implementation for #537, #515
Thanks for submitting a PR!
Please make sure to check for the following items:
If you've added an error code or changed an error code behavior,
you should probably add or change a test case file under
tests/test_cases/and addit to the list under
tests/test_definitions.py.If you've added or changed a command line option,
you should probably add or change a test in
tests/test_integration.py.Make sure to include the PR number after you open and get one.
Please don't get discouraged as it may take a while to get a review.