diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 9bb584a0b2..b373c59765 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -19,7 +19,7 @@ jobs: with: fetch-depth: 0 - - name: Testing (clang-tidy-quiet) + - name: Testing (clang-tidy) uses: addnab/docker-run-action@v3 with: image: px4io/px4-dev-clang:2021-09-08 @@ -27,4 +27,4 @@ jobs: run: | cd /workspace git config --global --add safe.directory /workspace - make clang-tidy-quiet + make clang-tidy diff --git a/Makefile b/Makefile index 22e08e039e..7dcacfeb2d 100644 --- a/Makefile +++ b/Makefile @@ -468,7 +468,7 @@ python_coverage: # 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 scan-build: @@ -494,10 +494,6 @@ clang-tidy: 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 . -# 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 cppcheck: px4_sitl_default @mkdir -p "$(SRC_DIR)"/build/cppcheck diff --git a/Tools/run-clang-tidy.py b/Tools/run-clang-tidy.py index 134e284447..4f29868bee 100755 --- a/Tools/run-clang-tidy.py +++ b/Tools/run-clang-tidy.py @@ -110,10 +110,11 @@ def run_tidy(args, tmpdir, build_path, queue): args.extra_arg, args.extra_arg_before) 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: - sys.stdout.write(' '.join(invocation) + '\n') - subprocess.call(invocation) + sys.stdout.write(f'failed on {name} --> {" ".join(invocation)}\n') + # Now run again to see the actual output + subprocess.call(invocation, stdin=None) global tidy_failures tidy_failures = tidy_failures + 1