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

Function main

ci/lint_cpp/noexcept_special_members_checker.py:481–527  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

479
480
481def main() -> int:
482 fix_mode = "--fix" in sys.argv
483 dry_run = "--dry-run" in sys.argv
484
485 if fix_mode or dry_run:
486 src_fl = PROJECT_ROOT / "src" / "fl"
487 if not src_fl.exists():
488 print("ERROR: src/fl/ not found", file=sys.stderr)
489 return 1
490
491 exts = {".h", ".hpp", ".cpp"}
492 files = sorted(
493 p
494 for p in src_fl.rglob("*")
495 if p.suffix in exts or p.name.endswith(".cpp.hpp")
496 )
497 files = [
498 f
499 for f in files
500 if "/third_party/" not in str(f).replace("\\", "/")
501 and not str(f).endswith("noexcept.h")
502 ]
503
504 total_fixes = 0
505 for fp in files:
506 n, descs = fix_file(fp, dry_run=dry_run)
507 if n:
508 label = "Would fix" if dry_run else "Fixed"
509 print(f"{label} {fp.relative_to(PROJECT_ROOT)}: {n} violation(s)")
510 for d in descs:
511 print(d)
512 total_fixes += n
513 verb = "Would fix" if dry_run else "Fixed"
514 print(f"\n{verb} {total_fixes} violation(s) total")
515 return 0
516
517 # Lint mode
518 from ci.util.check_files import run_checker_standalone
519
520 checker = NoexceptSpecialMembersChecker()
521 run_checker_standalone(
522 checker,
523 [str(PROJECT_ROOT / "src" / "fl")],
524 "Missing FL_NOEXCEPT on special member functions",
525 extensions=[".h", ".hpp", ".cpp", ".cpp.hpp"],
526 )
527 return 0
528
529
530if __name__ == "__main__":

Calls 4

run_checker_standaloneFunction · 0.90
fix_fileFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected