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

Function _check_cpp_hpp_files

ci/lint_cpp/test_unity_build.py:311–347  ·  view source on GitHub ↗

Check that all .cpp.hpp files are referenced in their directory's _build.cpp.hpp. Returns: list of violation strings

(src_dir: Path, cpp_hpp_by_dir: CppHppByDir)

Source from the content-addressed store, hash-verified

309
310
311def _check_cpp_hpp_files(src_dir: Path, cpp_hpp_by_dir: CppHppByDir) -> list[str]:
312 """
313 Check that all .cpp.hpp files are referenced in their directory's _build.cpp.hpp.
314
315 Returns:
316 list of violation strings
317 """
318 violations: list[str] = []
319
320 for dir_path, cpp_hpp_files in sorted(cpp_hpp_by_dir.items()):
321 # Skip the build directory itself — build files aren't tracked by _build.cpp.hpp
322 build_dir = src_dir / "fl" / "build"
323 if dir_path == build_dir or str(dir_path).startswith(str(build_dir)):
324 continue
325
326 build_hpp = dir_path / BUILD_HPP
327
328 if not build_hpp.exists():
329 rel_dir = dir_path.relative_to(PROJECT_ROOT)
330 violations.append(f"Missing {BUILD_HPP} in {rel_dir.as_posix()}/")
331 continue
332
333 content = build_hpp.read_text(encoding="utf-8")
334
335 for cpp_hpp in sorted(cpp_hpp_files):
336 # Skip the _build.cpp.hpp file itself (shouldn't include itself)
337 if cpp_hpp.name == BUILD_HPP:
338 continue
339
340 rel_path = cpp_hpp.relative_to(src_dir)
341 include_path = rel_path.as_posix()
342
343 if include_path not in content:
344 rel_build = build_hpp.relative_to(PROJECT_ROOT)
345 violations.append(f"{rel_build.as_posix()}: missing {include_path}")
346
347 return violations
348
349
350SECTION_COMMENT_CURRENT_DIR = "// begin current directory includes"

Callers 2

check_scanned_dataFunction · 0.85
check_single_fileFunction · 0.85

Calls 2

itemsMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected