ci: clang-tidy: fix attempt (#25328)

This commit is contained in:
Jacob Dahl 2025-07-31 09:35:38 -08:00 committed by GitHub
parent c546e7c1f7
commit 9e811136a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 10 deletions

View File

@ -19,7 +19,7 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Testing (clang-tidy-quiet) - name: Testing (clang-tidy)
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
with: with:
image: px4io/px4-dev-clang:2021-09-08 image: px4io/px4-dev-clang:2021-09-08
@ -27,4 +27,4 @@ jobs:
run: | run: |
cd /workspace cd /workspace
git config --global --add safe.directory /workspace git config --global --add safe.directory /workspace
make clang-tidy-quiet make clang-tidy

View File

@ -468,7 +468,7 @@ python_coverage:
# static analyzers (scan-build, clang-tidy, cppcheck) # static analyzers (scan-build, clang-tidy, cppcheck)
# -------------------------------------------------------------------- # --------------------------------------------------------------------
.PHONY: scan-build px4_sitl_default-clang clang-tidy clang-tidy-fix clang-tidy-quiet .PHONY: scan-build px4_sitl_default-clang clang-tidy clang-tidy-fix
.PHONY: cppcheck shellcheck_all validate_module_configs .PHONY: cppcheck shellcheck_all validate_module_configs
scan-build: scan-build:
@ -494,10 +494,6 @@ clang-tidy: px4_sitl_default-clang
clang-tidy-fix: px4_sitl_default-clang clang-tidy-fix: px4_sitl_default-clang
@cd "$(SRC_DIR)"/build/px4_sitl_default-clang && "$(SRC_DIR)"/Tools/run-clang-tidy.py -header-filter=".*\.hpp" -j$(j_clang_tidy) -fix -p . @cd "$(SRC_DIR)"/build/px4_sitl_default-clang && "$(SRC_DIR)"/Tools/run-clang-tidy.py -header-filter=".*\.hpp" -j$(j_clang_tidy) -fix -p .
# modified version of run-clang-tidy.py to return error codes and only output relevant results
clang-tidy-quiet: px4_sitl_default-clang
@cd "$(SRC_DIR)"/build/px4_sitl_default-clang && "$(SRC_DIR)"/Tools/run-clang-tidy.py -header-filter=".*\.hpp" -j$(j_clang_tidy) -p .
# TODO: Fix cppcheck errors then try --enable=warning,performance,portability,style,unusedFunction or --enable=all # TODO: Fix cppcheck errors then try --enable=warning,performance,portability,style,unusedFunction or --enable=all
cppcheck: px4_sitl_default cppcheck: px4_sitl_default
@mkdir -p "$(SRC_DIR)"/build/cppcheck @mkdir -p "$(SRC_DIR)"/build/cppcheck

View File

@ -110,10 +110,11 @@ def run_tidy(args, tmpdir, build_path, queue):
args.extra_arg, args.extra_arg_before) args.extra_arg, args.extra_arg_before)
try: try:
subprocess.check_call(invocation, stdin=None, stdout=open(os.devnull, 'wb'), stderr=subprocess.STDOUT) subprocess.check_call(invocation, stdin=None, stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
sys.stdout.write(' '.join(invocation) + '\n') sys.stdout.write(f'failed on {name} --> {" ".join(invocation)}\n')
subprocess.call(invocation) # Now run again to see the actual output
subprocess.call(invocation, stdin=None)
global tidy_failures global tidy_failures
tidy_failures = tidy_failures + 1 tidy_failures = tidy_failures + 1