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

Function _check_build_file_naming

ci/lint_cpp/test_unity_build.py:854–894  ·  view source on GitHub ↗

Validate that every .cpp file in src/fl/build/ follows the naming convention and maps to a valid directory. Returns: list of violation strings

(src_dir: Path)

Source from the content-addressed store, hash-verified

852
853
854def _check_build_file_naming(src_dir: Path) -> list[str]:
855 """
856 Validate that every .cpp file in src/fl/build/ follows the naming convention
857 and maps to a valid directory.
858
859 Returns:
860 list of violation strings
861 """
862 violations: list[str] = []
863 build_dir = src_dir / "fl" / "build"
864 if not build_dir.exists():
865 violations.append("Missing build directory: src/fl/build/")
866 return violations
867
868 actual_files = {f.name for f in build_dir.glob("*.cpp")}
869 expected_files = {f.split("/")[-1] for f in EXPECTED_BUILD_FILES}
870
871 # Check for unexpected files
872 unexpected = actual_files - expected_files
873 for f in sorted(unexpected):
874 violations.append(
875 f"src/fl/build/{f}: Unexpected build file. "
876 f"Not in EXPECTED_BUILD_FILES list."
877 )
878
879 # Check for missing files
880 missing = expected_files - actual_files
881 for f in sorted(missing):
882 violations.append(f"src/fl/build/{f}: Expected build file is missing.")
883
884 # Validate each file maps to a valid directory
885 for build_file in sorted(build_dir.glob("*.cpp")):
886 dir_path, _ = _parse_build_filename(build_file.name)
887 mapped_dir = src_dir / dir_path if dir_path else src_dir
888 if not mapped_dir.exists():
889 rel_file = build_file.relative_to(PROJECT_ROOT).as_posix()
890 violations.append(
891 f"{rel_file}: Maps to non-existent directory '{dir_path or 'src/'}'."
892 )
893
894 return violations
895
896
897def _check_no_orphan_cpp_files(src_dir: Path) -> list[str]:

Callers 1

check_scanned_dataFunction · 0.85

Calls 2

_parse_build_filenameFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected