Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse file speed up #4000

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions analyzer/codechecker_analyzer/cmd/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import os
import sys
from typing import Dict, Optional, Set
import fnmatch

from codechecker_report_converter.util import dump_json_output
from codechecker_report_converter.report import report_file, \
Expand Down Expand Up @@ -392,6 +393,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)

if metadata and 'files' in args:
# Mapping plists when files are specified to speed up parsing
# The specifed_file_paths variable would be an empty list
# if metadata.json did not contain the specified file or
# metadata did not contain mapping between source files and plists.
specifed_file_paths = [
key for key, val in
metadata['tools'][0]['result_source_files'].items()
if any(fnmatch.fnmatch(val, f) for f in args.files)
] if 'tools' in metadata \
and len(metadata['tools']) > 0 \
and 'result_source_files' in metadata['tools'][0] \
else []
file_paths = specifed_file_paths or file_paths

for file_path in file_paths:
reports = report_file.get_reports(
file_path, context.checker_labels, file_cache)
Expand Down