Fix parsing of __init__ GL08 error on top-level classes with correct docstrings - #704
Open
flowln wants to merge 2 commits into
Open
Fix parsing of __init__ GL08 error on top-level classes with correct docstrings#704flowln wants to merge 2 commits into
__init__ GL08 error on top-level classes with correct docstrings#704flowln wants to merge 2 commits into
Conversation
The test is kept passing, though it shows a bug currently in the code: when adding a __init__ parameter documentation to a top-level class of a module, it is currently not being considered for passing the need to document the __init__ method itself. Signed-off-by: Sofia Donato Ferreira <sofia.ferreira@lnls.br>
When considering the ancestors of a __init__ method inside a top-level class, we often get the following: <module node>.<class node> (<method node> is the node being considered) This means that in those cases, len(ancestors) == 2, since the method node is not included in the ancestors list. This fixes the error introduced in the previous patch, as well as a previous instance of something similar, where __init__ doesn't provide a docstring, and the class docstring doesn't have a Parameters section, but since the __init__ method has no parameters outside of self, it ought to be considered correct to not have a docstring there too. Signed-off-by: Sofia Donato Ferreira <sofia.ferreira@lnls.br>
flowln
added a commit
to cnpem/sophys-common
that referenced
this pull request
Aug 21, 2026
The GL08 ignores at the __init__ methods are only needed since numpy/numpydoc#704 is not in yet. Signed-off-by: Sofia Donato Ferreira <sofia.ferreira@lnls.br>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When adding a
__init__parameter documentation to a top-level class of a module, it is currently not being considered for passing the need to document the__init__method itself. The first commit modifies a test case to expose the faulty behavior, and the subsequent patch fixes that case by ensuring non-nested classes get properly parsed.