Skip to content
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

[Backport maintenance/2.15.x] Fix missing-param-doc FP #7896

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7827.false_positive
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix ``missing-param-doc`` false positive when function parameter has an escaped underscore.

Closes #7827
2 changes: 1 addition & 1 deletion pylint/extensions/_check_docs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class GoogleDocstring(Docstring):

re_param_line = re.compile(
rf"""
\s* ((?:\\?\*{{0,2}})?\w+) # identifier potentially with asterisks
\s* ((?:\\?\*{{0,2}})?[\w\\]+) # identifier potentially with asterisks or escaped `\`
\s* ( [(]
{re_multiple_type}
(?:,\s+optional)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,15 @@ def test_finds_multiple_complex_types_google(
named_arg_nine,
named_arg_ten,
)

def test_escape_underscore(something: int, raise_: bool = False) -> bool:
"""Tests param with escaped _ is handled correctly.

Args:
something: the something
raise\\_: the other

Returns:
something
"""
return something and raise_