Scan phase: Collect all data needed for validation. Returns: ScannedData if src/ exists, None otherwise
()
| 998 | |
| 999 | |
| 1000 | def scan() -> ScannedData | None: |
| 1001 | """ |
| 1002 | Scan phase: Collect all data needed for validation. |
| 1003 | |
| 1004 | Returns: |
| 1005 | ScannedData if src/ exists, None otherwise |
| 1006 | """ |
| 1007 | src_dir = PROJECT_ROOT / SRC_DIR_NAME |
| 1008 | if not src_dir.exists(): |
| 1009 | return None |
| 1010 | |
| 1011 | # 1. Find all _build.cpp.hpp files |
| 1012 | all_build_hpp_files = list(src_dir.rglob(BUILD_HPP)) |
| 1013 | |
| 1014 | # 2. Find all build files in src/fl/build/ |
| 1015 | build_dir = src_dir / "fl" / "build" |
| 1016 | if build_dir.exists(): |
| 1017 | all_build_files = list(build_dir.glob("*.cpp")) |
| 1018 | else: |
| 1019 | all_build_files = [] |
| 1020 | |
| 1021 | # 3. Group .cpp.hpp files by directory |
| 1022 | cpp_hpp_by_dir: CppHppByDir = defaultdict(list) |
| 1023 | for cpp_hpp in src_dir.rglob(CPP_HPP_PATTERN): |
| 1024 | cpp_hpp_by_dir[cpp_hpp.parent].append(cpp_hpp) |
| 1025 | |
| 1026 | # 4. Compute independently compiled directories |
| 1027 | independently_compiled_dirs = _get_independently_compiled_dirs(src_dir) |
| 1028 | |
| 1029 | return ScannedData( |
| 1030 | src_dir=src_dir, |
| 1031 | all_build_hpp_files=all_build_hpp_files, |
| 1032 | all_build_files=all_build_files, |
| 1033 | cpp_hpp_by_dir=cpp_hpp_by_dir, |
| 1034 | independently_compiled_dirs=independently_compiled_dirs, |
| 1035 | ) |
| 1036 | |
| 1037 | |
| 1038 | def check_scanned_data(data: ScannedData) -> CheckResult: |
no test coverage detected