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

Function scan_cpp_files

ci/lint_cpp/check_namespace_includes.py:406–445  ·  view source on GitHub ↗

Scan all C++ files in a directory for includes after namespace declarations. Args: directory (str): Directory to scan for C++ files Returns: Dict[str, Any]: Dictionary mapping file paths to lists of violation data

(directory: str = ".")

Source from the content-addressed store, hash-verified

404
405
406def scan_cpp_files(directory: str = ".") -> dict[str, Any]:
407 """
408 Scan all C++ files in a directory for includes after namespace declarations.
409
410 Args:
411 directory (str): Directory to scan for C++ files
412
413 Returns:
414 Dict[str, Any]: Dictionary mapping file paths to lists of violation data
415 """
416 # Only check .h and .hpp files
417 cpp_extensions = [".h", ".hpp"]
418 violations: dict[str, Any] = {}
419
420 for root, dirs, files in os.walk(directory):
421 # Skip build directories, third-party code, and tests
422 if any(
423 part in root.lower()
424 for part in [
425 ".build",
426 ".pio",
427 ".venv",
428 "libdeps",
429 "third_party",
430 "vendor",
431 "tests",
432 ]
433 ):
434 continue
435
436 for file in files:
437 file_path = os.path.join(root, file)
438
439 # Check if it's a C++ file
440 if any(file.endswith(ext) for ext in cpp_extensions):
441 violation_data = find_includes_after_namespace(Path(file_path))
442 if violation_data:
443 violations[file_path] = violation_data
444
445 return violations
446
447
448def main() -> None:

Callers

nothing calls this directly

Calls 2

anyFunction · 0.85

Tested by

no test coverage detected