mirror of
https://github.com/esphome/esphome.git
synced 2026-09-22 12:38:40 +00:00
[core] Deduplicate entity type boilerplate with X-macro pattern (#15618)
This commit is contained in:
+1
-1
@@ -672,7 +672,7 @@ def lint_using_esp_idf_deprecated(fname, line, col, content):
|
||||
)
|
||||
|
||||
|
||||
@lint_content_check(include=["*.h"])
|
||||
@lint_content_check(include=["*.h"], exclude=["esphome/core/entity_types.h"])
|
||||
def lint_pragma_once(fname, content):
|
||||
if "#pragma once" not in content:
|
||||
return (
|
||||
|
||||
+6
-1
@@ -174,7 +174,12 @@ def build_all_include(header_files: list[str] | None = None) -> None:
|
||||
if line
|
||||
]
|
||||
|
||||
headers = [f'#include "{h}"' for h in header_files]
|
||||
from esphome.writer import ENTITY_TYPES_H_TARGET
|
||||
|
||||
# X-macro files are included multiple times with different macro definitions
|
||||
# and must not be included bare in the all-include header
|
||||
exclude = {ENTITY_TYPES_H_TARGET}
|
||||
headers = [f'#include "{h}"' for h in header_files if h not in exclude]
|
||||
headers.sort()
|
||||
headers.append("")
|
||||
content = "\n".join(headers)
|
||||
|
||||
Reference in New Issue
Block a user