Catch more class documentation anti-patterns

This commit is contained in:
Nyall Dawson 2025-03-31 08:39:55 +10:00
parent 9e60e9bc5b
commit 6e2a82c60a

View File

@ -310,14 +310,16 @@ class DoxygenParser:
has_brief_description |= bool(text.strip())
class_name = e.find("compoundname").text
if re.match(rf"\s*(the )?{class_name}.*", brief_description, re.IGNORECASE):
if re.match(
rf"\s*((?:the|a) )?{class_name}.*", brief_description, re.IGNORECASE
):
noncompliant_members.append(
{
"Brief description": f"Brief {brief_description} is non-compliant.\n\nDon't start a brief class descriptions with 'The MyClassName...' or 'MyClassName is responsible for...'. Use just 'Responsible for...'"
}
)
if re.match(
rf"\s*(?:this class|a class|it|this is|class)\b.*",
rf"\s*(?:this class|the class|a class|it|this is|class)\b.*",
brief_description,
re.IGNORECASE,
):