Create lint stages based on arguments.
(args: LintArgs)
| 165 | |
| 166 | |
| 167 | def create_stages(args: LintArgs) -> list[LintStage]: |
| 168 | """Create lint stages based on arguments.""" |
| 169 | stages: list[LintStage] = [] |
| 170 | |
| 171 | # Determine which stages to run |
| 172 | run_python = not args.js_only and not args.cpp_only |
| 173 | run_cpp = not args.js_only |
| 174 | run_js = not args.cpp_only |
| 175 | |
| 176 | # Python pipeline (ruff -> ty -> pyright) |
| 177 | # Run as a single stage to match bash behavior |
| 178 | if run_python: |
| 179 | stages.append( |
| 180 | LintStage( |
| 181 | name="python_pipeline", |
| 182 | display_name="PYTHON PIPELINE", |
| 183 | run_fn=lambda: run_python_pipeline( |
| 184 | args.no_fingerprint, args.run_pyright |
| 185 | ), |
| 186 | timeout=360.0, # Combined timeout for all Python stages |
| 187 | ) |
| 188 | ) |
| 189 | |
| 190 | # C++ stage (includes IWYU check within the same stage) |
| 191 | if run_cpp: |
| 192 | |
| 193 | def run_cpp_and_iwyu() -> bool: |
| 194 | """Run C++ linting and IWYU analysis together.""" |
| 195 | if not run_cpp_lint( |
| 196 | args.no_fingerprint, |
| 197 | args.run_full, |
| 198 | args.run_iwyu, |
| 199 | args.use_rust_cpp_lint, |
| 200 | ): |
| 201 | return False |
| 202 | if not run_iwyu_pragma_check(): |
| 203 | return False |
| 204 | if not run_iwyu_analysis( |
| 205 | args.run_full, args.run_iwyu, args.run_pyright, args.iwyu_fix |
| 206 | ): |
| 207 | return False |
| 208 | if not run_clang_tidy(args.no_fingerprint, args.run_tidy): |
| 209 | return False |
| 210 | if not run_noexcept_check(args.run_tidy): |
| 211 | return False |
| 212 | return True |
| 213 | |
| 214 | stages.append( |
| 215 | LintStage( |
| 216 | name="cpp_linting", |
| 217 | display_name="C++ LINTING", |
| 218 | run_fn=run_cpp_and_iwyu, |
| 219 | timeout=600.0, # Combined timeout for C++ + IWYU + clang-tidy |
| 220 | ) |
| 221 | ) |
| 222 | |
| 223 | # JavaScript stage |
| 224 | if run_js: |
no test coverage detected