Skip to content

Commit 0990db1

Browse files
committed
Simplify common_type_error validation logic
As per feedback in #447
1 parent cdfd705 commit 0990db1

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

numpydoc/validate.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,8 @@ def validate(obj_name):
584584
("string", "str"),
585585
]
586586
for wrong_type, right_type in common_type_errors:
587-
param_type = doc.parameter_type(param)
588-
if wrong_type in param_type:
589-
# Ignore if wrong_type is used as a substring
590-
if (
591-
re.match(f"\w+{wrong_type}", param_type) or
592-
re.match(f"{wrong_type}\w+", param_type)
593-
):
594-
continue
595-
587+
if wrong_type in set(re.split(r"\W", doc.parameter_type(
588+
param))):
596589
errs.append(
597590
error(
598591
"PR06",

0 commit comments

Comments
 (0)