From 7d87b320331b44afab0a5caaa52c2a93b01260bd Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 9 Apr 2026 14:52:04 -1000 Subject: [PATCH] [core] Exclude entity_types.h from clang-tidy all-include.cpp The X-macro file requires macros to be defined before inclusion and cannot be included bare in the clang-tidy all-include header. --- script/helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/helpers.py b/script/helpers.py index c9c550d889..00969efe7c 100644 --- a/script/helpers.py +++ b/script/helpers.py @@ -167,11 +167,15 @@ def build_all_include(header_files: list[str] | None = None) -> None: cmd = ["git", "ls-files", "esphome/**/*.h"] proc = subprocess.run(cmd, capture_output=True, text=True, check=True) + # X-macro files are included multiple times with different macro definitions + # and must not be included bare + exclude = {"esphome/core/entity_types.h"} + # Process git output - git already returns paths relative to repo root header_files = [ line.replace(os.path.sep, "/") for line in proc.stdout.strip().split("\n") - if line + if line and line.replace(os.path.sep, "/") not in exclude ] headers = [f'#include "{h}"' for h in header_files]