-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix differing param doc false positive (#6980)
* Read `posonly` args and annotations on `check_arguments_in_docstring` Co-authored-by: Pierre Sassoulas <[email protected]>
- Loading branch information
1 parent
680edeb
commit c159024
Showing
7 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Fixture for testing missing documentation in docparams (Python >=3.8 only).""" | ||
|
||
|
||
def differing_param_doc_pos_only(par1: int, /) -> int: # [differing-param-doc] | ||
"""This is a test docstring documenting one non-existing param | ||
:param par1: some param | ||
:param param: some param | ||
:return: the sum of the params | ||
""" | ||
|
||
return par1 | ||
|
||
|
||
def missing_type_doc_pos_only(par1, /) -> int: # [missing-type-doc] | ||
"""This is a test docstring params where the type is not specified | ||
:param par1: some param | ||
:return: the param | ||
""" | ||
|
||
return par1 | ||
|
||
|
||
def params_are_documented(par1: int, /, par2: int, *, par3: int) -> int: | ||
"""This is a test docstring params where nothing is raised as it is all documented | ||
:param par1: some param | ||
:param par2: some other param | ||
:param par3: some other param | ||
:return: the sum of params | ||
""" | ||
|
||
return par1 + par2 + par3 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[MAIN] | ||
load-plugins = pylint.extensions.docparams | ||
|
||
[BASIC] | ||
accept-no-param-doc = no | ||
accept-no-raise-doc = no | ||
accept-no-return-doc = no | ||
accept-no-yields-doc = no | ||
|
||
[testoptions] | ||
min_pyver=3.8 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
differing-param-doc:4:0:4:32:differing_param_doc_pos_only:"""param"" differing in parameter documentation":UNDEFINED | ||
missing-type-doc:15:0:15:29:missing_type_doc_pos_only:"""par1"" missing in parameter type documentation":UNDEFINED |