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

[fix] Fix HTML generation for CodeChecker cmd diff command #3600

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions web/client/codechecker_client/cmd_line_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ def print_reports(
LOG.info("Generating HTML output files to file://%s "
"directory:", output_dir)

for file_path in file_report_map:
for file_path, file_reports in file_report_map.items():
file_name = os.path.basename(file_path)
h = int(
hashlib.md5(
Expand All @@ -1124,7 +1124,7 @@ def print_reports(

output_file_path = os.path.join(
output_dir, f"{file_name}_ {str(h)}.html")
html_builder.create(output_file_path, reports)
html_builder.create(output_file_path, file_reports)

if output_format in ['csv', 'rows', 'table']:
header = ['File', 'Checker', 'Severity', 'Msg', 'Source']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,15 @@ def test_local_compare_res_html_output_unresolved(self):

self.assertIn(file_name, checked_files)

# Check reports in the index.html file.
index_html = os.path.join(html_reports, 'index.html')
divide_zero_count = 0
with open(index_html, 'r', encoding="utf-8", errors="ignore") as f:
for line in f:
if re.search("core.DivideZero", line):
divide_zero_count += 1
self.assertEqual(divide_zero_count, 10)

def test_different_basename_types(self):
""" Test different basename types.

Expand Down