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)
| 257 | |
| 258 | |
| 259 | def 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 | |
| 289 | def is_relative_path(include_path: str) -> bool: |
no test coverage detected