From 75a1cdc405e4ee6bb3196eaa404c57ccf28e19b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20Cserv=C3=A1k?= Date: Tue, 5 Sep 2023 10:19:19 +0200 Subject: [PATCH] Parse file speed up The feature can be useful to speed up the parse process when you want to parse one or more specified files. The VSCode Plugin also runs the 'parse --file' command, so the correction can solve the slow file verification problem. It uses metadata.json for plist mapping if the result_source_files section is not empty and contains the pairing of source files and plist files. Before the new feature, the process read all existing plist files to find the specified source file's reports. --- analyzer/codechecker_analyzer/cmd/parse.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/analyzer/codechecker_analyzer/cmd/parse.py b/analyzer/codechecker_analyzer/cmd/parse.py index a4071b6c7c..fe7b3ac951 100644 --- a/analyzer/codechecker_analyzer/cmd/parse.py +++ b/analyzer/codechecker_analyzer/cmd/parse.py @@ -392,7 +392,22 @@ def get_output_file_path(default_file_name: str) -> Optional[str]: for dir_path, file_paths in report_file.analyzer_result_files(args.input): metadata = get_metadata(dir_path) - for file_path in file_paths: + + specified_file_paths = None + if metadata and 'files' in args: + # Mapping plists when files are specified to speed up parsing + specified_file_paths = [ + key for key, val in + metadata['tools'][0]['result_source_files'].items() + if val in args.files + ] if 'tools' in metadata \ + and len(metadata['tools']) > 0 \ + and 'result_source_files' in metadata['tools'][0] \ + else None + + for file_path in specified_file_paths \ + if specified_file_paths \ + else file_paths: reports = report_file.get_reports( file_path, context.checker_labels, file_cache)