-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
False positive missing-param-doc on numpy style when : <type>
omitted
#5222
Comments
: <type>
omitted : <type>
omitted
With respect to So this should work: def func(arg1: bool, arg2: bool):
"""Return args.
Parameters
----------
arg1 : bool
arg1
arg2
arg2
Returns
----------
bool
bool (?, the type is required for return type documentation)
"""
return arg1, arg2
|
@DanielNoord, absolutely, apologises for confusing the issue. Do you want me to close and raise a new tidier version? and thank you for the immediate response! |
No worries. It is already really helpful to have some code that should reproduce the issue. No need to open a new one. It is strange as I feel I have visited this part of the code recently and fixed something similar, but I can't find that PR. I will assign myself and investigate in the coming days! |
Tremendous, thanks! Might you have been looking at this issue? It was the only one I could find along simlar lines. |
No, but I might as well look at that one at the same time 😄 |
😄 wow, two for the price of one! Thanks again! |
@maread99 Could you check if there are any spaces after I can get this test to pass on main: @set_config(default_docstring_type="numpy")
def test_no_type_func_params_in_numpy_docstring(self) -> None:
"""Example of a function with NumPy style parameter without type annotation
documentation in the docstring
"""
node = astroid.extract_node(
"""
def func(arg1: bool, arg2: bool):
'''Return args.
Parameters
----------
arg1 : bool
arg1
arg2
arg2
Returns
----------
bool
bool
'''
return arg1, arg2
"""
)
with self.assertNoMessages():
self.checker.visit_functiondef(node) If I add a space after the Please let me know if I missed anything in this test, but I feel like this fits your example. Edit: Never mind. Managed to make it fail :) |
I checked anyway - no trailing whitespace I'm afraid (I format to black quite religiously). |
I looked into it yesterday. This is dependent on quite complicated regex patterns that I did not at look before. Sadly I won't be able to fix this as easily as I hoped. I will take another look next week! |
Looks like you got there earlier than anticipated! Thank you for resolving this! |
Yeah I couldn't let an incomprehensible regex pattern ruin my Saturday 😄 |
Daniel you're making our issue number trend look like the 2008 crash on the stock market with all those incomprehensible regex fixes lately. 😄 |
I actually don't mind working with regex (I know, weird..). The problem is that the docstring checker uses a lot of nested patterns which makes it difficult to see what is actually catching what. |
Bug description
Configuration
Command used
Pylint output
Expected behavior
Would not have expected either
missing-param-doc
ormissing-return-type-doc
checks to have failed.Pylint version
OS / Environment
VS Code 1.61.2
Windows 10 Pro 21H1
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: