forked from pylint-dev/pylint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix no-self-use and docparams extension for async functions/methods (p…
…ylint-dev#4986) * Fixed 'no-self-check' for async functions. * fixed 'docparams' for async functions. * Added 'no-self-use' to the pylint disable comment in broken test. * Added small changelog entry to Pylint 2.11.0 milestone. * Added test: 'no-self-use' for async method. * Added test: revamped 'docparams' functional tests to test all missing documentation. Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
- Loading branch information
1 parent
e777697
commit 7390b6f
Showing
9 changed files
with
66 additions
and
8 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
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 |
---|---|---|
@@ -1,11 +1,41 @@ | ||
"""Fixture for testing missing documentation in docparams.""" | ||
|
||
|
||
def _private_func(param1): # [missing-return-doc, missing-return-type-doc] | ||
if param1: | ||
raise Exception('Example') | ||
def _private_func1(param1): # [missing-return-doc, missing-return-type-doc] | ||
"""This is a test docstring without returns""" | ||
return param1 | ||
|
||
|
||
def _private_func2(param1): # [missing-yield-doc, missing-yield-type-doc] | ||
"""This is a test docstring without yields""" | ||
yield param1 | ||
|
||
|
||
def _private_func3(param1): # [missing-raises-doc] | ||
"""This is a test docstring without raises""" | ||
raise Exception('Example') | ||
|
||
|
||
def public_func1(param1): # [missing-param-doc, missing-type-doc] | ||
"""This is a test docstring without params""" | ||
print(param1) | ||
|
||
|
||
async def _async_private_func1(param1): # [missing-return-doc, missing-return-type-doc] | ||
"""This is a test docstring without returns""" | ||
return param1 | ||
|
||
|
||
async def _async_private_func2(param1): # [missing-yield-doc, missing-yield-type-doc] | ||
"""This is a test docstring without yields""" | ||
yield param1 | ||
|
||
|
||
async def _async_private_func3(param1): # [missing-raises-doc] | ||
"""This is a test docstring without raises""" | ||
raise Exception('Example') | ||
|
||
|
||
async def async_public_func1(param1): # [missing-param-doc, missing-type-doc] | ||
"""This is a test docstring without params""" | ||
print(param1) |
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 |
---|---|---|
@@ -1,4 +1,14 @@ | ||
missing-return-doc:4:0:_private_func:Missing return documentation | ||
missing-return-type-doc:4:0:_private_func:Missing return type documentation | ||
missing-yield-doc:10:0:_private_func2:Missing yield documentation | ||
missing-yield-type-doc:10:0:_private_func2:Missing yield type documentation | ||
missing-return-doc:4:0:_private_func1:Missing return documentation | ||
missing-return-type-doc:4:0:_private_func1:Missing return type documentation | ||
missing-yield-doc:9:0:_private_func2:Missing yield documentation | ||
missing-yield-type-doc:9:0:_private_func2:Missing yield type documentation | ||
missing-raises-doc:14:0:_private_func3:"""Exception""" not documented as being raised | ||
missing-param-doc:19:0:public_func1:"""param1""" missing in parameter documentation | ||
missing-type-doc:19:0:public_func1:"""param1""" missing in parameter type documentation | ||
missing-return-doc:24:0:_async_private_func1:Missing return documentation | ||
missing-return-type-doc:24:0:_async_private_func1:Missing return type documentation | ||
missing-yield-doc:29:0:_async_private_func2:Missing yield documentation | ||
missing-yield-type-doc:29:0:_async_private_func2:Missing yield type documentation | ||
missing-raises-doc:34:0:_async_private_func3:"""Exception""" not documented as being raised | ||
missing-param-doc:39:0:async_public_func1:"""param1""" missing in parameter documentation | ||
missing-type-doc:39:0:async_public_func1:"""param1""" missing in parameter type documentation |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
no-self-use:16:4:Toto.function_method:Method could be a function | ||
no-self-use:24:4:Toto.async_function_method:Method could be a function |