Main entry point for lint.py.
()
| 261 | |
| 262 | |
| 263 | def main() -> int: |
| 264 | """Main entry point for lint.py.""" |
| 265 | # Parse arguments |
| 266 | args = parse_lint_args() |
| 267 | |
| 268 | # Unset VIRTUAL_ENV to avoid warnings |
| 269 | os.environ.pop("VIRTUAL_ENV", None) |
| 270 | |
| 271 | # Single-file mode |
| 272 | if args.files: |
| 273 | print(f"🔍 Single-file lint mode ({len(args.files)} file(s))") |
| 274 | print("=" * 50) |
| 275 | install_signal_handler() |
| 276 | success = run_single_file_mode( |
| 277 | args.files, |
| 278 | strict=args.run_pyright, |
| 279 | use_rust_cpp_lint=args.use_rust_cpp_lint, |
| 280 | ) |
| 281 | return 0 if success else 1 |
| 282 | |
| 283 | # Cleanup Visual Studio files and crash dumps |
| 284 | cleanup_visual_studio_files() |
| 285 | cleanup_crash_dump_files() |
| 286 | |
| 287 | # Print header |
| 288 | print_header(args.js_only, args.cpp_only) |
| 289 | |
| 290 | # Install interrupt handler |
| 291 | install_signal_handler() |
| 292 | |
| 293 | try: |
| 294 | # Create stages |
| 295 | stages = create_stages(args) |
| 296 | |
| 297 | # Create duration tracker |
| 298 | tracker = DurationTracker() |
| 299 | |
| 300 | # Determine if we should run in parallel |
| 301 | # Parallel mode: 2+ stages and not in single-mode (--cpp/--js) |
| 302 | parallel = len(stages) > 1 and not args.js_only and not args.cpp_only |
| 303 | |
| 304 | # Create orchestrator |
| 305 | orchestrator = LintOrchestrator(stages, tracker, parallel) |
| 306 | |
| 307 | # Run all stages |
| 308 | success = orchestrator.run() |
| 309 | |
| 310 | # Print footer |
| 311 | print_footer(args.js_only, args.cpp_only) |
| 312 | |
| 313 | # Print summary table |
| 314 | print(tracker.generate_summary()) |
| 315 | |
| 316 | # Print AI hints |
| 317 | print_ai_hints() |
| 318 | |
| 319 | # Return exit code |
| 320 | return 0 if success else 1 |
no test coverage detected