From ffaa31febc7f7bb5b02f2ed7df4cdfbca2e00e65 Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Wed, 3 Jun 2026 23:48:34 -0400 Subject: [PATCH] [clang-tidy] Hash idf_component.yml and trigger hash hook on more inputs (#16753) Co-authored-by: J. Nick Koston Co-authored-by: J. Nick Koston --- .clang-tidy.hash | 2 +- .pre-commit-config.yaml | 2 +- script/clang_tidy_hash.py | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.clang-tidy.hash b/.clang-tidy.hash index 29c8b414f6..648b31f8f0 100644 --- a/.clang-tidy.hash +++ b/.clang-tidy.hash @@ -1 +1 @@ -a30d2e50f2cac76e9c504eb7e5b250070dc92df23469c44a7eb8e52e26fd375d +44db8a62d94c8fba83b95b73938db4377ebacc0adb504881387389f1cd8f2f3a diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a076128975..3b6278e6b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -63,7 +63,7 @@ repos: name: Update clang-tidy hash entry: python script/clang_tidy_hash.py --update-if-changed language: python - files: ^(\.clang-tidy|platformio\.ini|requirements_dev\.txt)$ + files: ^(\.clang-tidy|platformio\.ini|requirements_dev\.txt|sdkconfig\.defaults|esphome/idf_component\.yml)$ pass_filenames: false additional_dependencies: [] - id: ci-custom diff --git a/script/clang_tidy_hash.py b/script/clang_tidy_hash.py index f478535567..1a6e4eb7be 100755 --- a/script/clang_tidy_hash.py +++ b/script/clang_tidy_hash.py @@ -105,6 +105,12 @@ def calculate_clang_tidy_hash(repo_root: Path | None = None) -> str: sdkconfig_content = read_file_bytes(sdkconfig_path) hasher.update(sdkconfig_content) + # Hash esphome/idf_component.yml: its managed deps drive the ESP-IDF + # build's include set, which clang-tidy analyzes. + idf_component_path = repo_root / "esphome" / "idf_component.yml" + if idf_component_path.exists(): + hasher.update(read_file_bytes(idf_component_path)) + return hasher.hexdigest()