Run linting on specific files, auto-detecting type by extension. Args: files: List of absolute file paths to lint strict: If True, run pyright on Python files and IWYU on C++ files
(
files: list[str], strict: bool, use_rust_cpp_lint: bool
)
| 39 | |
| 40 | |
| 41 | def run_single_file_mode( |
| 42 | files: list[str], strict: bool, use_rust_cpp_lint: bool |
| 43 | ) -> bool: |
| 44 | """Run linting on specific files, auto-detecting type by extension. |
| 45 | |
| 46 | Args: |
| 47 | files: List of absolute file paths to lint |
| 48 | strict: If True, run pyright on Python files and IWYU on C++ files |
| 49 | """ |
| 50 | success = True |
| 51 | for file_path in files: |
| 52 | ext = Path(file_path).suffix.lower() |
| 53 | if ext in CPP_EXTENSIONS: |
| 54 | if not run_cpp_lint_single_file( |
| 55 | file_path, strict=strict, use_rust_cpp_lint=use_rust_cpp_lint |
| 56 | ): |
| 57 | success = False |
| 58 | elif ext in PYTHON_EXTENSIONS: |
| 59 | if not run_python_lint_single_file(file_path, strict=strict): |
| 60 | success = False |
| 61 | elif ext in JS_EXTENSIONS: |
| 62 | if not run_js_lint_single_file(file_path): |
| 63 | success = False |
| 64 | else: |
| 65 | print(f"⚠️ Unknown file type: {file_path} (skipping)") |
| 66 | return success |
| 67 | |
| 68 | |
| 69 | def cleanup_visual_studio_files() -> None: |
no test coverage detected