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

Function collect_files_to_check

ci/util/check_files.py:305–349  ·  view source on GitHub ↗

Collect all files to check from the given directories.

(
    test_directories: list[str], extensions: list[str] | None = None
)

Source from the content-addressed store, hash-verified

303
304
305def collect_files_to_check(
306 test_directories: list[str], extensions: list[str] | None = None
307) -> list[str]:
308 """Collect all files to check from the given directories."""
309 if extensions is None:
310 extensions = [".cpp", ".h", ".hpp"]
311
312 files_to_check: list[str] = []
313
314 # Search each directory
315 for directory in test_directories:
316 if os.path.exists(directory):
317 for root, dirs, files in os.walk(directory):
318 # Skip build artifact directories (.build*, build, .venv, .cache, __pycache__)
319 dirs[:] = [
320 d
321 for d in dirs
322 if not d.startswith(".build")
323 and d
324 not in {"build", ".venv", ".cache", "__pycache__", "node_modules"}
325 ]
326
327 # Skip directories with .cpp_no_lint marker file
328 if os.path.exists(os.path.join(root, ".cpp_no_lint")):
329 continue
330
331 for file in files:
332 if any(file.endswith(ext) for ext in extensions):
333 file_path = os.path.join(root, file)
334 files_to_check.append(file_path)
335
336 # Only add main src directory files if SRC_ROOT itself is in test_directories
337 # This prevents unintentionally including src/*.{cpp,h} when testing subdirectories
338 src_root_str = str(SRC_ROOT)
339 if src_root_str in test_directories or any(
340 d == src_root_str for d in test_directories
341 ):
342 for file in os.listdir(SRC_ROOT):
343 file_path = os.path.join(SRC_ROOT, file)
344 if os.path.isfile(file_path) and any(
345 file_path.endswith(ext) for ext in extensions
346 ):
347 files_to_check.append(file_path)
348
349 return files_to_check
350
351
352def run_checker_standalone(

Callers 10

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
run_checker_standaloneFunction · 0.85

Calls 2

anyFunction · 0.85
appendMethod · 0.45