Check if the include path looks like a relative include to FastLED platform code. These are paths that should use "platforms/" prefix but don't. For example: "esp/foo.h" should be "platforms/esp/foo.h" For ambiguous prefixes like avr/ and arm/, we only flag them as FastLED platform
(include_path: str)
| 222 | |
| 223 | |
| 224 | def is_fastled_platform_relative(include_path: str) -> bool: |
| 225 | """Check if the include path looks like a relative include to FastLED platform code. |
| 226 | |
| 227 | These are paths that should use "platforms/" prefix but don't. |
| 228 | For example: "esp/foo.h" should be "platforms/esp/foo.h" |
| 229 | |
| 230 | For ambiguous prefixes like avr/ and arm/, we only flag them as FastLED |
| 231 | platform code if they look like FastLED code (e.g., .hpp files, specific |
| 232 | FastLED naming patterns). |
| 233 | """ |
| 234 | # Check unambiguous FastLED platform subdirs |
| 235 | for subdir in FASTLED_PLATFORM_SUBDIRS: |
| 236 | if include_path.startswith(subdir): |
| 237 | return True |
| 238 | |
| 239 | # For ambiguous prefixes, check if it looks like FastLED code |
| 240 | for prefix in AMBIGUOUS_PREFIXES: |
| 241 | if include_path.startswith(prefix): |
| 242 | if looks_like_fastled_code(include_path): |
| 243 | return True |
| 244 | |
| 245 | return False |
| 246 | |
| 247 | |
| 248 | def get_banned_subpath_replacement(include_path: str) -> str | None: |
no test coverage detected