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

Function is_valid_include_path

ci/lint_cpp/include_paths_checker.py:259–286  ·  view source on GitHub ↗

Check if include path follows the required style. Args: include_path: The path from #include "path" Returns: True if the path is valid (starts with valid prefix, is top-level, or is an external SDK header)

(include_path: str)

Source from the content-addressed store, hash-verified

257
258
259def is_valid_include_path(include_path: str) -> bool:
260 """Check if include path follows the required style.
261
262 Args:
263 include_path: The path from #include "path"
264
265 Returns:
266 True if the path is valid (starts with valid prefix, is top-level,
267 or is an external SDK header)
268 """
269 # Top-level includes are fine (e.g., "FastLED.h")
270 if is_top_level_include(include_path):
271 return True
272
273 # External SDK headers are allowed (e.g., "hardware/irq.h", "freertos/FreeRTOS.h")
274 if is_external_sdk_header(include_path):
275 return True
276
277 # Reject banned internal subpaths (e.g., fl/math/lib8tion/ -> fl/math/)
278 if get_banned_subpath_replacement(include_path) is not None:
279 return False
280
281 # Check if path starts with a valid FastLED prefix
282 for prefix in VALID_PREFIXES:
283 if include_path.startswith(prefix):
284 return True
285
286 return False
287
288
289def is_relative_path(include_path: str) -> bool:

Callers 1

check_file_contentMethod · 0.70

Calls 3

is_top_level_includeFunction · 0.70
is_external_sdk_headerFunction · 0.70

Tested by

no test coverage detected