-
-
Notifications
You must be signed in to change notification settings - Fork 167
Constructor checking for AST validator #622
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
Open
mattgebert
wants to merge
9
commits into
numpy:main
Choose a base branch
from
mattgebert:ConstructorChecking_ASTValidator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d8f05e6
fix(validate.py): Considers subclass nesting when checking GL08 const…
mattgebert c7da072
test(validate.py): Added a test to check nested class docstring when …
mattgebert 2703b22
Merge branch 'numpy:main' into ConstructorChecking_ASTValidator
mattgebert 92d8305
fix(validate.py): Allows the validator to check AST constructor docst…
mattgebert 4b09325
Merge branch 'ConstructorChecking_ASTValidator' of https://github.com…
mattgebert 9f38b98
test(test_validate_hook.py,-example_module.py): Wrote new example_mod…
mattgebert af861c3
ci(test.yml): Added --pre option to prerelease job to ensure pre-rele…
mattgebert c9d2384
refactor(tests): Remove `__init__.py` module status of `tests\hooks\`…
mattgebert b62c21f
ci(test.yml): Added explicit call to hook tests to see if included in…
mattgebert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.
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 was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the way to do this. The
DocstringVisitor
class is already traversing the tree and capturing node ancestry (currently, just the name, but after #623, it will be all AST node ancestors). This is then used to instantiate theAstValidator
, so we should be able to use that information to modify the check for what you are trying to achieve. A lot of the logic here is pretty much doing what those classes are doing, but for a second time, which I would like to avoid.You may be able to simply filter out any cases that shouldn't be flagged in
DocstringVisitor._get_numpydoc_issues()
, at which point you would have access to the AST node and its ancestry. This is how the ignore rules are applied for the hook.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant - I was actually hoping this could be the case prior to making these changes.
Once #623 is merged I'll be happy update this logic and use the ancestry.