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

Function main

ci/lint_cpp/check_namespace_includes.py:448–519  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

446
447
448def main() -> None:
449 # Use the new FileContentChecker-based approach
450 src_dir = str(PROJECT_ROOT / "src")
451
452 # Collect files using collect_files_to_check
453 files_to_check = collect_files_to_check([src_dir], extensions=[".h", ".hpp"])
454
455 # Create checker and processor
456 checker = NamespaceIncludesChecker()
457 processor = MultiCheckerFileProcessor()
458
459 # Process all files in a single pass
460 processor.process_files_with_checkers(files_to_check, [checker])
461
462 # Get violations from checker
463 violations = checker.violations
464
465 if violations:
466 # Count total violations
467 total_violations = sum(len(v) for v in violations.values())
468 file_count = len(violations)
469
470 print("❌ Found #include directives after using namespace declarations")
471 print()
472 print(f"📁 Project Files ({file_count} files, {total_violations} violations):")
473 print()
474
475 # Sort files by relative path for consistent output
476 project_root = str(PROJECT_ROOT)
477 for file_path in sorted(violations.keys()):
478 # Convert to relative path
479 rel_path = os.path.relpath(file_path, project_root).replace("\\", "/")
480 violation_data = violations[file_path]
481
482 print(f"{rel_path}:")
483
484 # Group violations by namespace
485 namespace_groups: dict[str | None, list[tuple[int, str]]] = {}
486
487 for violation in violation_data:
488 namespace_key = None
489 if violation.namespace_info:
490 namespace_key = (
491 f"{violation.namespace_info.line_number}: "
492 f"{violation.namespace_info.snippet}"
493 )
494
495 if namespace_key not in namespace_groups:
496 namespace_groups[namespace_key] = []
497 namespace_groups[namespace_key].append(
498 (violation.include_line, violation.include_snippet)
499 )
500
501 # Print each namespace group
502 for namespace_key, includes in namespace_groups.items():
503 if namespace_key:
504 print(f" {namespace_key}")
505 else:

Callers 1

Calls 9

collect_files_to_checkFunction · 0.90
valuesMethod · 0.80
itemsMethod · 0.80
printFunction · 0.50
keysMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected