From 0873bc8a1b3337ee098763ec75d7c17f4b2d06bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20Domozi?= Date: Thu, 23 Apr 2026 16:47:27 +0200 Subject: [PATCH] Collect analysis config files to report_dir/conf/ --- analyzer/codechecker_analyzer/cli/analyze.py | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/analyzer/codechecker_analyzer/cli/analyze.py b/analyzer/codechecker_analyzer/cli/analyze.py index 7daae8ffad..69467af6c6 100644 --- a/analyzer/codechecker_analyzer/cli/analyze.py +++ b/analyzer/codechecker_analyzer/cli/analyze.py @@ -1094,6 +1094,47 @@ def __update_review_status_config(args): os.symlink(args.review_status_config, rs_config_to_send) +def __update_analysis_config_files(args): + """ + Copy analysis related configuration files + (e.g. skipfile, review_status_config) to report_dir/conf/. + """ + conf_dir = os.path.join(args.output_path, "conf") + + # Remove any config files used during previous analysis + if os.path.isdir(conf_dir): + shutil.rmtree(conf_dir) + + # Create a new conf directory + os.makedirs(conf_dir) + + def add_file_to_conf_dir(file_path: str): + if not os.path.isfile(file_path): + return + + file_path = os.path.abspath(file_path) + filename = os.path.basename(file_path) + shutil.copyfile(file_path, os.path.join(conf_dir, filename)) + + # Add analysis config files e.g., skipfile, review_status_config, etc. + if getattr(args, "skipfile", None): + add_file_to_conf_dir(args.skipfile) + + if getattr(args, "review_status_config", None): + add_file_to_conf_dir(args.review_status_config) + + if getattr(args, "config_file", None): + add_file_to_conf_dir(args.config_file) + + # Add cc-verbatim-args-file + # + # Example: --saargs , --tidyargs , + # --analyzer-config clangsa:cc-verbatim-args-file=, etc. + for a_conf in args.analyzer_config: + if a_conf.option == "cc-verbatim-args-file": + add_file_to_conf_dir(a_conf.value) + + def __cleanup_metadata(metadata_prev, metadata): """ Cleanup metadata. @@ -1455,6 +1496,7 @@ def main(args): __update_skip_file(args) __update_review_status_config(args) + __update_analysis_config_files(args) LOG.debug("Cleanup metadata file started.") __cleanup_metadata(metadata_prev, metadata)