Create all checker instances organized by which files they should check. Args: all_headers: Optional frozenset of all header file paths in the project (used for cross-file validation in some checkers)
(
all_headers: frozenset[str] | None = None,
)
| 167 | |
| 168 | |
| 169 | def create_checkers( |
| 170 | all_headers: frozenset[str] | None = None, |
| 171 | ) -> dict[str, list[FileContentChecker]]: |
| 172 | """Create all checker instances organized by which files they should check. |
| 173 | |
| 174 | Args: |
| 175 | all_headers: Optional frozenset of all header file paths in the project |
| 176 | (used for cross-file validation in some checkers) |
| 177 | """ |
| 178 | checkers_by_scope: dict[str, list[FileContentChecker]] = {} |
| 179 | |
| 180 | # Global checkers (run on all src/, examples/, tests/ files) |
| 181 | checkers_by_scope["global"] = [ |
| 182 | CppIncludeChecker(), |
| 183 | CppHppIncludesChecker(), |
| 184 | ImplHppIncludesChecker(), |
| 185 | IncludeAfterNamespaceChecker(), |
| 186 | MemberStyleChecker(), |
| 187 | NumericLimitMacroChecker(), |
| 188 | StaticInHeaderChecker(), |
| 189 | LoggingInIramChecker(), |
| 190 | PlatformIncludesChecker(), |
| 191 | PlatformTrampolineChecker(), # Enforce trampoline architecture in src/fl/** and root src/ |
| 192 | WeakAttributeChecker(), |
| 193 | AttributeChecker(), # Checks all C++ standard attributes (replaces MaybeUnusedChecker) |
| 194 | AsmJsLocationChecker(), # Checks EM_JS / EM_ASYNC_JS / EM_ASM live only in *.js.cpp.hpp |
| 195 | BannedMacrosChecker(), # Checks for banned preprocessor macros like __has_include |
| 196 | BuiltinMemcpyChecker(), # Checks for raw __builtin_memcpy — use FL_BUILTIN_MEMCPY |
| 197 | EspRomPrintfChecker(), # Checks for raw esp_rom_printf — use FastLED logging |
| 198 | FlIsDefinedChecker(), |
| 199 | BannedNamespaceChecker(), # Checks for banned namespace patterns like fl::fl |
| 200 | SingletonInHeadersChecker(), # Checks for Singleton<T> in headers (must use SingletonShared<T>) |
| 201 | SpanFromPointerChecker(), # Checks for span<T>(container.data(), container.size()) → span<T>(container) |
| 202 | BareAllocationChecker(), # Checks for bare new/delete/malloc/free — use fl::unique_ptr/fl::shared_ptr |
| 203 | BareSnprintfChecker(), # Bans bare C ::snprintf/::printf/::sprintf in src/ — use fl::snprintf (#2773 item 1.5) |
| 204 | BareLibmChecker(), # Bans bare C libm calls (::sqrtf, ::atan2, ::powf, ::ldexpf, ...) — use fl::sqrt/fl::atan2/... (#3002, #3012) |
| 205 | BareNoInlineChecker(), # Bans bare __attribute__((noinline)) in src/ — use FL_NO_INLINE (#2773 item 2.1 follow-up) |
| 206 | SleepForChecker(), # Checks for sleep_for() — bypasses async runner, use fl::yield/fl::async_run |
| 207 | ThreadLocalKeywordChecker(), # Checks for thread_local keyword — use fl::SingletonThreadLocal<T>::instance() |
| 208 | BannedDefineChecker(), # Checks for wrong #if patterns (e.g., #if ESP32 → #ifdef ESP32) |
| 209 | PlatformPragmaChecker(), # Checks for raw #pragma GCC/clang/warning — use FL_DISABLE_WARNING macros |
| 210 | RawPragmaChecker(), # Checks for raw _Pragma() — use FL_DISABLE_WARNING macros |
| 211 | RawNoexceptChecker(), # Checks for raw noexcept keyword — use FL_NOEXCEPT macro |
| 212 | # Note: Private libc++ headers checking is now integrated into BannedHeadersChecker |
| 213 | # Note: _build.hpp hierarchy checking is now integrated into test_unity_build.py |
| 214 | ] |
| 215 | |
| 216 | # Src-only checkers |
| 217 | checkers_by_scope["src"] = [ |
| 218 | ArduinoMacroUsageChecker(), # Checks for banned Arduino macros (INPUT, OUTPUT, DEFAULT) |
| 219 | UsingNamespaceFlChecker(), |
| 220 | StdNamespaceChecker(), |
| 221 | NamespaceIncludesChecker(), |
| 222 | ReinterpretCastChecker(), |
| 223 | RelativeIncludeChecker(), |
| 224 | FastLEDHeaderUsageChecker(), |
| 225 | StdintTypeChecker(), # Covers all src/ (excludes third_party/ internally) |
| 226 | CtypeGlobalChecker(), # Checks for global-scope ctype functions (use fl:: variants) |
no test coverage detected