| 253 | return True |
| 254 | |
| 255 | def check_file_content(self, file_content: FileContent) -> list[str]: |
| 256 | if "(" not in file_content.content: |
| 257 | return [] |
| 258 | |
| 259 | violations: list[tuple[int, str]] = [] |
| 260 | in_multiline_comment = False |
| 261 | |
| 262 | for line_number, line in enumerate(file_content.lines, 1): |
| 263 | stripped = line.strip() |
| 264 | |
| 265 | if "/*" in stripped: |
| 266 | in_multiline_comment = True |
| 267 | if "*/" in stripped: |
| 268 | in_multiline_comment = False |
| 269 | continue |
| 270 | if in_multiline_comment: |
| 271 | continue |
| 272 | if stripped.startswith("//"): |
| 273 | continue |
| 274 | |
| 275 | code = stripped.split("//")[0].strip() |
| 276 | if not code or "(" not in code: |
| 277 | continue |
| 278 | if _SUPPRESS.search(line): |
| 279 | continue |
| 280 | if code.startswith("#") or code.startswith(":") or code.startswith("?"): |
| 281 | continue |
| 282 | |
| 283 | if not _is_function_declaration(code): |
| 284 | continue |
| 285 | |
| 286 | # Build full signature for multi-line |
| 287 | full_sig = code |
| 288 | paren_depth = code.count("(") - code.count(")") |
| 289 | lookahead = line_number |
| 290 | while paren_depth > 0 and lookahead < len(file_content.lines): |
| 291 | next_code = file_content.lines[lookahead].strip().split("//")[0].strip() |
| 292 | full_sig += " " + next_code |
| 293 | paren_depth += next_code.count("(") - next_code.count(")") |
| 294 | lookahead += 1 |
| 295 | |
| 296 | if _HAS_NOEXCEPT.search(full_sig): |
| 297 | continue |
| 298 | if _SPECIAL_SUFFIX.search(full_sig): |
| 299 | continue |
| 300 | if not _FUNC_END_PATTERN.search(full_sig): |
| 301 | continue |
| 302 | |
| 303 | violations.append((line_number, stripped)) |
| 304 | |
| 305 | if violations: |
| 306 | self.violations[file_content.path] = violations |
| 307 | |
| 308 | return [] |
| 309 | |
| 310 | |
| 311 | def main() -> None: |