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

Function main

ci/lint_cpp/banned_macros_checker.py:180–230  ·  view source on GitHub ↗

Run banned macros checker standalone.

()

Source from the content-addressed store, hash-verified

178
179
180def main() -> None:
181 """Run banned macros checker standalone."""
182 import sys
183 from pathlib import Path
184
185 from ci.util.check_files import (
186 MultiCheckerFileProcessor,
187 collect_files_to_check,
188 run_checker_standalone,
189 )
190
191 # Check if a single file path was provided as argument
192 if len(sys.argv) > 1:
193 # Single file mode
194 file_path = Path(sys.argv[1]).resolve()
195 if not file_path.exists():
196 print(f"Error: File not found: {file_path}")
197 sys.exit(1)
198
199 checker = BannedMacrosChecker()
200 processor = MultiCheckerFileProcessor()
201 processor.process_files_with_checkers([str(file_path)], [checker])
202
203 # Check for violations
204 if hasattr(checker, "violations") and checker.violations:
205 violations = checker.violations
206 print(
207 f"❌ Found banned preprocessor macros - use FL_* wrappers instead ({len(violations)} file(s)):\n"
208 )
209 for file_path_str, violation_list in violations.items():
210 rel_path = Path(file_path_str).relative_to(PROJECT_ROOT)
211 print(f"{rel_path}:")
212 for line_num, message in violation_list:
213 print(f" Line {line_num}: {message}")
214 sys.exit(1)
215 else:
216 print("✅ No banned preprocessor macros found.")
217 sys.exit(0)
218 else:
219 # Normal mode - scan all directories
220 checker = BannedMacrosChecker()
221 run_checker_standalone(
222 checker,
223 [
224 str(PROJECT_ROOT / "src"),
225 str(PROJECT_ROOT / "examples"),
226 str(PROJECT_ROOT / "tests"),
227 ],
228 "Found banned preprocessor macros - use FL_* wrappers instead",
229 extensions=[".cpp", ".h", ".hpp", ".ino", ".cpp.hpp"],
230 )
231
232
233if __name__ == "__main__":

Callers 1

Calls 7

run_checker_standaloneFunction · 0.90
itemsMethod · 0.80
BannedMacrosCheckerClass · 0.70
printFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected