Skip to content

Commit

Permalink
escape arg underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Nov 30, 2022
1 parent 1ff7c7a commit ba5093b
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 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 @@ -644,7 +644,7 @@ def match_param_docs(self) -> tuple[set[str], set[str]]:
entries = self._parse_section(self.re_param_section)
entries.extend(self._parse_section(self.re_keyword_param_section))
for entry in entries:
match = self.re_param_line.match(entry)
match = self.re_param_line.match(entry.replace("\\", ""))
if not match:
continue

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 _ is handled correctly.
Args:
something: the something
raise\\_: the other
Returns:
something
"""
return something and raise_

0 comments on commit ba5093b

Please sign in to comment.