mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 02:02:51 +00:00
[remote_base] List the hob2hood, nexus and onkyori protocol defines in defines.h (#20577)
This commit is contained in:
@@ -169,6 +169,7 @@
|
||||
#define USE_REMOTE_PROTOCOL_DYSON
|
||||
#define USE_REMOTE_PROTOCOL_GOBOX
|
||||
#define USE_REMOTE_PROTOCOL_HAIER
|
||||
#define USE_REMOTE_PROTOCOL_HOB2HOOD
|
||||
#define USE_REMOTE_PROTOCOL_JVC
|
||||
#define USE_REMOTE_PROTOCOL_KEELOQ
|
||||
#define USE_REMOTE_PROTOCOL_LG
|
||||
@@ -177,6 +178,8 @@
|
||||
#define USE_REMOTE_PROTOCOL_MIRAGE
|
||||
#define USE_REMOTE_PROTOCOL_NEC
|
||||
#define USE_REMOTE_PROTOCOL_NEXA
|
||||
#define USE_REMOTE_PROTOCOL_NEXUS
|
||||
#define USE_REMOTE_PROTOCOL_ONKYORI
|
||||
#define USE_REMOTE_PROTOCOL_PANASONIC
|
||||
#define USE_REMOTE_PROTOCOL_PIONEER
|
||||
#define USE_REMOTE_PROTOCOL_PRONTO
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Every gated protocol source needs its define listed for static analysis."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from esphome.components.remote_base import _PROTOCOL_STEMS, protocol_define
|
||||
|
||||
DEFINES_H = Path(__file__).parents[4] / "esphome" / "core" / "defines.h"
|
||||
|
||||
|
||||
def test_every_protocol_define_is_listed_in_defines_h() -> None:
|
||||
"""A protocol compiled only behind its define would drop out of clang-tidy without this line."""
|
||||
defines = DEFINES_H.read_text(encoding="utf-8")
|
||||
missing = [
|
||||
stem
|
||||
for stem in _PROTOCOL_STEMS
|
||||
if f"#define {protocol_define(stem)}\n" not in defines
|
||||
]
|
||||
assert not missing, (
|
||||
f"Add #define {', '.join(protocol_define(s) for s in missing)} to {DEFINES_H.name}"
|
||||
)
|
||||
Reference in New Issue
Block a user