Check if a line only contains allowed std:: symbols.
(line: str)
| 69 | |
| 70 | |
| 71 | def _has_allowed_std_symbol(line: str) -> bool: |
| 72 | """Check if a line only contains allowed std:: symbols.""" |
| 73 | # Extract just the code part (before comments) |
| 74 | code_part = line.split("//")[0] |
| 75 | if "std::" not in code_part: |
| 76 | return True |
| 77 | |
| 78 | # Check each std:: occurrence — if ALL are allowed, the line passes |
| 79 | import re |
| 80 | |
| 81 | std_usages = re.findall(r"std::\w+", code_part) |
| 82 | return all(usage in ALLOWED_STD_SYMBOLS for usage in std_usages) |
| 83 | |
| 84 | |
| 85 | class StdNamespaceChecker(FileContentChecker): |
no test coverage detected