MCPcopy Create free account
hub / github.com/FastLED/FastLED / main

Function main

ci/refactor/add_fl_noexcept.py:468–528  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

466
467
468def main() -> int:
469 parser = argparse.ArgumentParser(
470 description=(
471 "Add FL_NOEXCEPT to functions using clang-query AST analysis "
472 "with multi-line-aware insertion."
473 )
474 )
475 parser.add_argument(
476 "--scope",
477 choices=list(_SCOPES.keys()),
478 default="all",
479 help="Which code scope to process (default: all)",
480 )
481 parser.add_argument(
482 "--apply",
483 action="store_true",
484 help="Apply changes (default: dry-run)",
485 )
486 args = parser.parse_args()
487
488 clang_query = _find_clang_query()
489 if not clang_query:
490 print("ERROR: clang-query not found.")
491 print("Install LLVM: https://github.com/llvm/llvm-project/releases")
492 return 1
493
494 print(f"Using: {clang_query}")
495 print(f"Scope: {args.scope}")
496 print(f"Mode: {'apply' if args.apply else 'dry-run'}")
497 print()
498
499 all_hits: list[tuple[str, int]] = []
500 for tu, file_regex in _SCOPES[args.scope]:
501 tu_path = PROJECT_ROOT / tu
502 if not tu_path.exists():
503 print(f"WARNING: Translation unit not found: {tu}")
504 continue
505
506 print(f"Running clang-query on {tu} ...")
507 hits = _run_clang_query(clang_query, tu, file_regex)
508 all_hits.extend(hits)
509
510 if not all_hits:
511 print("\nAll functions have FL_NOEXCEPT. Nothing to do.")
512 return 0
513
514 print(f"Found {len(all_hits)} functions missing FL_NOEXCEPT")
515 print()
516
517 result = _apply_fixes(all_hits, args.apply)
518
519 print()
520 verb = "Applied" if args.apply else "Would apply"
521 print(
522 f"{verb}: {result.changes} changes across {result.files} files ({result.skipped} skipped)"
523 )
524
525 if not args.apply and result.changes > 0:

Callers 1

add_fl_noexcept.pyFile · 0.70

Calls 7

listClass · 0.85
parse_argsMethod · 0.80
_find_clang_queryFunction · 0.70
_run_clang_queryFunction · 0.70
_apply_fixesFunction · 0.70
printFunction · 0.50
keysMethod · 0.45

Tested by

no test coverage detected