Run builtin_memcpy checker standalone.
()
| 88 | |
| 89 | |
| 90 | def main() -> None: |
| 91 | """Run builtin_memcpy checker standalone.""" |
| 92 | import sys |
| 93 | from pathlib import Path |
| 94 | |
| 95 | from ci.util.check_files import ( |
| 96 | MultiCheckerFileProcessor, |
| 97 | run_checker_standalone, |
| 98 | ) |
| 99 | |
| 100 | if len(sys.argv) > 1: |
| 101 | file_path = Path(sys.argv[1]).resolve() |
| 102 | if not file_path.exists(): |
| 103 | print(f"Error: File not found: {file_path}") |
| 104 | sys.exit(1) |
| 105 | |
| 106 | checker = BuiltinMemcpyChecker() |
| 107 | processor = MultiCheckerFileProcessor() |
| 108 | processor.process_files_with_checkers([str(file_path)], [checker]) |
| 109 | |
| 110 | if hasattr(checker, "violations") and checker.violations: |
| 111 | violations = checker.violations |
| 112 | print( |
| 113 | f"❌ Found raw __builtin_memcpy usage — use FL_BUILTIN_MEMCPY instead ({len(violations)} file(s)):\n" |
| 114 | ) |
| 115 | for file_path_str, violation_list in violations.items(): |
| 116 | rel_path = Path(file_path_str).relative_to(PROJECT_ROOT) |
| 117 | print(f"{rel_path}:") |
| 118 | for line_num, message in violation_list: |
| 119 | print(f" Line {line_num}: {message}") |
| 120 | sys.exit(1) |
| 121 | else: |
| 122 | print("✅ No raw __builtin_memcpy usage found.") |
| 123 | sys.exit(0) |
| 124 | else: |
| 125 | checker = BuiltinMemcpyChecker() |
| 126 | run_checker_standalone( |
| 127 | checker, |
| 128 | [ |
| 129 | str(PROJECT_ROOT / "src"), |
| 130 | str(PROJECT_ROOT / "examples"), |
| 131 | str(PROJECT_ROOT / "tests"), |
| 132 | ], |
| 133 | "Found raw __builtin_memcpy usage — use FL_BUILTIN_MEMCPY instead", |
| 134 | extensions=[".cpp", ".h", ".hpp", ".ino", ".cpp.hpp"], |
| 135 | ) |
| 136 | |
| 137 | |
| 138 | if __name__ == "__main__": |
no test coverage detected