Check phase: Validate the scanned data. Args: data: ScannedData from the scan phase Returns: CheckResult with success flag and list of violations
(data: ScannedData)
| 1036 | |
| 1037 | |
| 1038 | def check_scanned_data(data: ScannedData) -> CheckResult: |
| 1039 | """ |
| 1040 | Check phase: Validate the scanned data. |
| 1041 | |
| 1042 | Args: |
| 1043 | data: ScannedData from the scan phase |
| 1044 | |
| 1045 | Returns: |
| 1046 | CheckResult with success flag and list of violations |
| 1047 | """ |
| 1048 | violations: list[str] = [] |
| 1049 | |
| 1050 | # 1. Check _build.hpp naming (must be _build.cpp.hpp if includes .cpp.hpp) |
| 1051 | violations.extend(_check_build_hpp_naming(data.src_dir)) |
| 1052 | |
| 1053 | # 2. Check hierarchical structure |
| 1054 | violations.extend(check_hierarchy(data.src_dir)) |
| 1055 | |
| 1056 | # 3. Check all .cpp.hpp files are referenced in _build.cpp.hpp |
| 1057 | violations.extend(_check_cpp_hpp_files(data.src_dir, data.cpp_hpp_by_dir)) |
| 1058 | |
| 1059 | # 3b. Check _build.cpp.hpp include ordering (same-level first, subdir last) |
| 1060 | violations.extend(_check_build_include_order(data.src_dir)) |
| 1061 | |
| 1062 | # 3c. Check _build.cpp.hpp includes ALL immediate subdirectory _build.cpp.hpp files |
| 1063 | violations.extend( |
| 1064 | _check_subdir_completeness(data.src_dir, data.independently_compiled_dirs) |
| 1065 | ) |
| 1066 | |
| 1067 | # 3d. Check alphabetical ordering within sections |
| 1068 | violations.extend(_check_alphabetical_order(data.src_dir)) |
| 1069 | |
| 1070 | # 4. Check no cross-directory includes (files from wrong directory) |
| 1071 | violations.extend(_check_no_cross_directory_includes(data.src_dir)) |
| 1072 | |
| 1073 | # 5. Check no invalid include types (.cpp, .c, etc.) |
| 1074 | violations.extend(_check_no_invalid_include_types(data.src_dir)) |
| 1075 | |
| 1076 | # 6. Validate build files in src/fl/build/ |
| 1077 | violations.extend(_check_build_file_naming(data.src_dir)) |
| 1078 | violations.extend(_check_build_file_preheaders(data.src_dir)) |
| 1079 | violations.extend(_check_build_file_content(data.src_dir, data.cpp_hpp_by_dir)) |
| 1080 | violations.extend(_check_no_orphan_cpp_files(data.src_dir)) |
| 1081 | |
| 1082 | # 7. Validate library.json srcFilter |
| 1083 | violations.extend(_check_library_json_srcfilter()) |
| 1084 | |
| 1085 | return CheckResult(success=len(violations) == 0, violations=violations) |
| 1086 | |
| 1087 | |
| 1088 | def check_single_file(file_path: Path) -> CheckResult: |
no test coverage detected