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

Function main

ci/ci-iwyu.py:734–905  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

732
733
734def main() -> int:
735 args = parse_args()
736
737 iwyu_available, iwyu_prefix = check_iwyu_available()
738 if not iwyu_available:
739 print("Error: include-what-you-use not found")
740 print("Install it with:")
741 print(" Ubuntu/Debian: sudo apt install iwyu")
742 print(" macOS: brew install include-what-you-use")
743 print(" Or it should be available via: uv run clang-tool-chain-iwyu")
744 return 1
745
746 if not args.quiet:
747 if iwyu_prefix:
748 print(f"Found include-what-you-use via clang-tool-chain")
749 else:
750 print("Found system include-what-you-use")
751
752 # --- Single file mode ---
753 if args.file:
754 rel, removals = scan_single_file(args.file)
755 if removals:
756 print(f"❌ IWYU violations in {rel}:")
757 for r in removals:
758 print(f" - {r}")
759 return 1
760 if not args.quiet:
761 print(f"✅ {args.file} passes IWYU")
762 return 0
763
764 # --- No board: parallel header scan (fast, ~2 min) ---
765 if not args.board:
766 no_cache: bool = getattr(args, "no_cache", False)
767 cache = IWYUCache(enabled=not no_cache)
768
769 violations = scan_fl_headers(quiet=args.quiet, cache=cache)
770 if args.json:
771 print(json.dumps(violations, indent=2))
772 if violations:
773 if args.fix:
774 # Clear cache before fix passes — files are about to change
775 cache.clear()
776 max_passes = 5
777 for pass_num in range(1, max_passes + 1):
778 print(
779 f"\n🔧 Fix pass {pass_num}: fixing {len(violations)} file(s)..."
780 )
781 fix_result = fix_iwyu_violations(violations)
782 if fix_result != 0:
783 return fix_result
784 # Re-scan to check for remaining violations (no cache during fix)
785 print(f"\n🔍 Re-scanning after pass {pass_num}...")
786 violations = scan_fl_headers(quiet=args.quiet)
787 if not violations:
788 print("✅ All violations fixed successfully")
789 return 0
790 # Exhausted passes
791 print(

Callers 1

ci-iwyu.pyFile · 0.70

Calls 15

clearMethod · 0.95
IWYUCacheClass · 0.90
create_boardFunction · 0.90
was_compiled_with_fbuildFunction · 0.90
get_compile_commandsFunction · 0.90
check_iwyu_availableFunction · 0.85
scan_single_fileFunction · 0.85
scan_fl_headersFunction · 0.85
fix_iwyu_violationsFunction · 0.85

Tested by

no test coverage detected