1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-01 10:52:19 +01:00

Speed up clang-tidy CI by 80%+ with incremental checking (#9396)

This commit is contained in:
J. Nick Koston
2025-07-09 11:00:44 -10:00
committed by GitHub
parent 0ffc446315
commit 6616567b05
11 changed files with 1774 additions and 53 deletions

View File

@@ -22,6 +22,7 @@ from helpers import (
git_ls_files,
load_idedata,
print_error_for_file,
print_file_list,
root_path,
temp_header_file,
)
@@ -218,13 +219,14 @@ def main():
)
args = parser.parse_args()
idedata = load_idedata(args.environment)
options = clang_options(idedata)
files = []
for path in git_ls_files(["*.cpp"]):
files.append(os.path.relpath(path, os.getcwd()))
# Print initial file count if it's large
if len(files) > 50:
print(f"Found {len(files)} total files to process")
if args.files:
# Match against files specified on command-line
file_name_re = re.compile("|".join(args.files))
@@ -240,10 +242,28 @@ def main():
if args.split_num:
files = split_list(files, args.split_num)[args.split_at - 1]
print(f"Split {args.split_at}/{args.split_num}: checking {len(files)} files")
# Print file count before adding header file
print(f"\nTotal files to check: {len(files)}")
# Early exit if no files to check
if not files:
print("No files to check - exiting early")
return 0
# Only build header file if we have actual files to check
if args.all_headers and args.split_at in (None, 1):
build_all_include()
files.insert(0, temp_header_file)
print(f"Added all-include header file, new total: {len(files)}")
# Print final file list before loading idedata
print_file_list(files, "Final files to process:")
# Load idedata and options only if we have files to check
idedata = load_idedata(args.environment)
options = clang_options(idedata)
tmpdir = None
if args.fix: