Parse command-line arguments for linting. Args: argv: Command-line arguments (defaults to sys.argv[1:]) Returns: LintArgs object with parsed arguments
(argv: list[str] | None = None)
| 28 | |
| 29 | |
| 30 | def parse_lint_args(argv: list[str] | None = None) -> LintArgs: |
| 31 | """ |
| 32 | Parse command-line arguments for linting. |
| 33 | |
| 34 | Args: |
| 35 | argv: Command-line arguments (defaults to sys.argv[1:]) |
| 36 | |
| 37 | Returns: |
| 38 | LintArgs object with parsed arguments |
| 39 | """ |
| 40 | parser = argparse.ArgumentParser( |
| 41 | description="FastLED Comprehensive Linting Suite", |
| 42 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 43 | epilog=""" |
| 44 | This script runs comprehensive linting for Python, C++, and JavaScript. |
| 45 | |
| 46 | Python linting includes: |
| 47 | - ruff (lint + format) + KBI checker + ty |
| 48 | - Use --strict to also run pyright (strict type checking, adds ~12s) |
| 49 | |
| 50 | C++ linting includes: |
| 51 | - clang-format and custom checkers |
| 52 | - IWYU (Include-What-You-Use) runs with --full, --iwyu, or --strict |
| 53 | - clang-tidy static analysis runs with --tidy |
| 54 | |
| 55 | JavaScript linting: |
| 56 | - FAST ONLY (skips if not available) |
| 57 | |
| 58 | Examples: |
| 59 | bash lint # Run all linters (Python, C++, JavaScript) |
| 60 | bash lint --strict # Also run pyright + IWYU on single files (strict mode) |
| 61 | bash lint --js # JavaScript linting only |
| 62 | bash lint --cpp # C++ linting only |
| 63 | bash lint --cpp --rust # Use Rust-backed checker subset where available |
| 64 | bash lint --full # Include IWYU (Include-What-You-Use) on all files |
| 65 | bash lint --iwyu # Run IWYU only |
| 66 | bash lint --tidy # Run clang-tidy static analysis |
| 67 | bash lint --no-fingerprint # Force re-run all linters |
| 68 | bash lint --strict file.cpp # Single file with IWYU enabled |
| 69 | """, |
| 70 | ) |
| 71 | |
| 72 | parser.add_argument( |
| 73 | "--js", |
| 74 | action="store_true", |
| 75 | help="Run JavaScript linting only", |
| 76 | ) |
| 77 | |
| 78 | parser.add_argument( |
| 79 | "--cpp", |
| 80 | action="store_true", |
| 81 | help="Run C++ linting only", |
| 82 | ) |
| 83 | |
| 84 | parser.add_argument( |
| 85 | "--no-fingerprint", |
| 86 | action="store_true", |
| 87 | help="Force re-run all linters (skip timestamp checks)", |
no test coverage detected