Skip to content

Commit

Permalink
Merge 6097f34 into 30c931f
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Dec 4, 2022
2 parents 30c931f + 6097f34 commit 48b22e4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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_

0 comments on commit 48b22e4

Please sign in to comment.