Skip to content

Commit

Permalink
Add a superhashmap file per plist which contains the unique hash for …
Browse files Browse the repository at this point in the history
…each report in the plist
  • Loading branch information
dkrupp committed Oct 30, 2024
1 parent e55b44f commit c42927c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def __init__(
checker_name: str,
severity: Optional[str] = None,
report_hash: Optional[str] = None,
report_super_hash: Optional[str] = None,
analyzer_name: Optional[str] = None,
category: Optional[str] = None,
type: Optional[str] = None, # pylint: disable=redefined-builtin
Expand Down Expand Up @@ -337,6 +338,7 @@ def __init__(
self.message = message
self.checker_name = checker_name
self.severity = severity
self.report_hash = report_super_hash
self.report_hash = report_hash
self.analyzer_name = analyzer_name
self.category = category # TODO: Remove this. DEPRECATED.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from codechecker_report_converter.report import File, Report
from codechecker_report_converter.report.checker_labels import CheckerLabels
from codechecker_report_converter.report.hash import HashType
import codechecker_report_converter.report.hash as report_hash
from codechecker_report_converter.report.parser import plist, sarif
from codechecker_report_converter.report.parser.base import AnalyzerInfo

Expand Down Expand Up @@ -82,7 +83,26 @@ def create(
if parser:
data = parser.convert(reports, analyzer_info)
parser.write(data, output_file_path)

create_super_hash_map(reports, output_file_path + ".map")

def create_super_hash_map(
reports: List[Report],
map_file_name: str
):
""" Creates plist.map file from the parse result to the given output.
The map file contains the super hashes of the reports
"""

### Creating a super hash map.
### These superhashes are unique identifiers for
### a report containing the full bug path
with open(map_file_name, "w") as shf:
superhashes = set()
for report in reports:
report.report_super_hash = report_hash.get_report_super_hash(report)
superhashes.add(report.report_super_hash)
for h in superhashes:
shf.write( h + "\n")

def replace_report_hash(
analyzer_result_file_path: str,
Expand Down

0 comments on commit c42927c

Please sign in to comment.