()
| 318 | |
| 319 | |
| 320 | def main() -> int: |
| 321 | parser = argparse.ArgumentParser( |
| 322 | description=( |
| 323 | "Check for missing FL_NOEXCEPT in src/fl, src/platforms, and " |
| 324 | "src/third_party using clang-query AST analysis." |
| 325 | ) |
| 326 | ) |
| 327 | parser.add_argument( |
| 328 | "--scope", |
| 329 | choices=sorted(_SCOPES.keys()), |
| 330 | default="all", |
| 331 | help="Which owned src scope to check (default: all)", |
| 332 | ) |
| 333 | parser.add_argument( |
| 334 | "--baseline", |
| 335 | type=Path, |
| 336 | default=DEFAULT_BASELINE, |
| 337 | help="Baseline file for existing missing annotations", |
| 338 | ) |
| 339 | parser.add_argument( |
| 340 | "--no-baseline", |
| 341 | action="store_true", |
| 342 | help="Report every current finding instead of only new findings", |
| 343 | ) |
| 344 | parser.add_argument( |
| 345 | "--update-baseline", |
| 346 | action="store_true", |
| 347 | help="Rewrite the baseline with the current findings", |
| 348 | ) |
| 349 | args = parser.parse_args() |
| 350 | |
| 351 | try: |
| 352 | hits = find_missing_noexcept(args.scope) |
| 353 | except NoexceptCheckError as exc: |
| 354 | print(f"ERROR: {exc}") |
| 355 | return 1 |
| 356 | |
| 357 | if args.update_baseline: |
| 358 | write_baseline(hits, args.baseline) |
| 359 | print(f"Wrote {len(hits)} FL_NOEXCEPT baseline entries to {args.baseline}") |
| 360 | return 0 |
| 361 | |
| 362 | if args.no_baseline: |
| 363 | report_hits = hits |
| 364 | stale: list[str] = [] |
| 365 | else: |
| 366 | report_hits, stale = diff_against_baseline(hits, load_baseline(args.baseline)) |
| 367 | |
| 368 | if stale: |
| 369 | print(f"NOTE: {len(stale)} stale FL_NOEXCEPT baseline entrie(s) can be pruned.") |
| 370 | print(" Re-run with --update-baseline after intentional cleanup.") |
| 371 | print() |
| 372 | |
| 373 | if not report_hits: |
| 374 | print("All non-baselined owned src functions have FL_NOEXCEPT.") |
| 375 | print(f"Known baseline entries: {len(hits) - len(report_hits)}") |
| 376 | return 0 |
| 377 |
no test coverage detected