Parse source and return all SRC001 violations.
(path: str, source: str)
| 96 | |
| 97 | |
| 98 | def check_file(path: str, source: str) -> list[tuple[int, str]]: |
| 99 | """Parse source and return all SRC001 violations.""" |
| 100 | try: |
| 101 | tree = ast.parse(source, filename=path) |
| 102 | except SyntaxError: |
| 103 | return [] |
| 104 | |
| 105 | source_lines = source.split("\n") |
| 106 | visitor = SubprocessCaptureVisitor(source_lines) |
| 107 | visitor.visit(tree) |
| 108 | return visitor.violations |
| 109 | |
| 110 | |
| 111 | def collect_python_files( |
no test coverage detected