diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-10-04 05:12:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-10-04 05:12:36 +0300 |
commit | 606271966e1344958d43f5660be1ae46d2637738 (patch) | |
tree | 9c96c832ed5da850205c213685bbe12c941ea86e /build_files/cmake | |
parent | e0e7a5522f20699e4ffeeef793545f954db790da (diff) |
check_cppcheck: use '--cppcheck-build-dir'
Use a temporary directory for faster performance.
Diffstat (limited to 'build_files/cmake')
-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() |