diff options
Diffstat (limited to 'build_files/cmake/cmake_static_check_cppcheck.py')
-rw-r--r-- | build_files/cmake/cmake_static_check_cppcheck.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py index 1eef2efe2b5..79b0e236ce5 100644 --- a/build_files/cmake/cmake_static_check_cppcheck.py +++ b/build_files/cmake/cmake_static_check_cppcheck.py @@ -24,6 +24,7 @@ import project_source_info import subprocess import sys import os +import tempfile from typing import ( Any, @@ -47,13 +48,15 @@ CHECKER_ARGS = [ "--max-configs=1", # speeds up execution # "--check-config", # when includes are missing "--enable=all", # if you want sixty hundred pedantic suggestions + + # NOTE: `--cppcheck-build-dir=<dir>` is added later as a temporary directory. ] if USE_QUIET: CHECKER_ARGS.append("--quiet") -def main() -> None: +def cppcheck() -> None: source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX) source_defines = project_source_info.build_defines_as_args() @@ -90,5 +93,11 @@ def main() -> None: print("Finished!") +def main() -> None: + with tempfile.TemporaryDirectory() as temp_dir: + CHECKER_ARGS.append("--cppcheck-build-dir=" + temp_dir) + cppcheck() + + if __name__ == "__main__": main() |