Skip to content

Commit

Permalink
Add super hash
Browse files Browse the repository at this point in the history
  • Loading branch information
vodorok committed Oct 30, 2024
1 parent 69f88e3 commit bad1802
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tools/report-converter/codechecker_report_converter/report/hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,28 @@ def get_report_hash(report: Report, hash_type: HashType) -> str:
return __str_to_hash('|||'.join(hash_content))


def get_report_super_hash(report: Report) -> str:
""" Returns super hash for the given report.
This can be used to filter deduplications of multiple reports.
This has will definetly willl uniquely identify a report.
"""
report_path_hash = ''
for event in report.bug_path_events:
line = str(event.line)
col = str(event.column)
report_path_hash += f"{line}|{col}|{event.message}|{event.file.path}"

report_path_hash += report.checker_name
if report.report_hash:
report_path_hash += report.report_hash

if not report_path_hash:
LOG.error('Failed to generate report path hash: %s', report)

#TODO Report annotation to this hash

return __str_to_hash(report_path_hash)

def get_report_path_hash(report: Report) -> str:
""" Returns path hash for the given report.
Expand Down

0 comments on commit bad1802

Please sign in to comment.