From 4f10a0ccf73e22b283cd0f5e3aa57e8f1368d382 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 14 Jul 2025 08:53:32 -1000 Subject: [PATCH] more aggressive fix --- script/clang-tidy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/script/clang-tidy b/script/clang-tidy index 934c454655..4fca12ab27 100755 --- a/script/clang-tidy +++ b/script/clang-tidy @@ -105,7 +105,7 @@ def clang_options(idedata): # idedata contains include directories for all toolchains of this platform, only use those from the one in use toolchain_dir = os.path.normpath(f"{idedata['cxx_path']}/../../") for directory in idedata["includes"]["toolchain"]: - if directory.startswith(toolchain_dir): + if directory.startswith(toolchain_dir) or "/.platformio/" in directory: cmd.extend(["-isystem", directory]) # add library include directories using -isystem to suppress their errors @@ -129,6 +129,11 @@ def clang_options(idedata): # add the esphome include directory using -I cmd.extend(["-I", root_path]) + # Also ensure any remaining directories with .platformio are system includes + for i in range(len(cmd)): + if cmd[i] == "-I" and i + 1 < len(cmd) and "/.platformio/" in cmd[i + 1]: + cmd[i] = "-isystem" + return cmd