diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport
index 1d067b40953..492ce90e196 100755
--- a/htmlreport/cppcheck-htmlreport
+++ b/htmlreport/cppcheck-htmlreport
@@ -628,6 +628,9 @@ def main() -> None:
'from. You can combine results from several '
'xml reports i.e. "--file file1.xml --file file2.xml ..". '
'Default is reading from stdin.')
+ parser.add_option('--checkers-report-file', dest='checkers_report',
+ help='The cppcheck checkers report file as produced '
+ 'with the "--checkers-report" option of cppcheck.')
parser.add_option('--report-dir', dest='report_dir',
help='The directory where the HTML report content is '
'written.')
@@ -855,6 +858,8 @@ def main() -> None:
output_file.write('\n
| ' + str(stats_count) + ' | total |
')
output_file.write('\n ')
output_file.write('\n Statistics
')
+ if options.checkers_report:
+ output_file.write('\n Checkers
')
output_file.write(HTML_MENU_END.replace("content", "content_index", 1))
output_file.write('\n ')
@@ -983,6 +988,26 @@ def main() -> None:
stats_file.write(HTML_FOOTER % contentHandler.versionCppcheck)
+ if options.checkers_report:
+ print("Creating checkers.html (checkers report)\n")
+
+ with io.open(os.path.join(options.report_dir, 'checkers.html'), 'w') as checkers_file:
+
+ checkers_file.write(HTML_HEAD % (options.title, '', options.title, ': Checkers'))
+ checkers_file.write(HTML_HEAD_END)
+
+ checkers_file.write(HTML_MENU.replace('id="menu"', 'id="menu_index"', 1).replace("Defects:", "Back to summary", 1) % (''))
+ checkers_file.write(HTML_MENU_END.replace("content", "content_index", 1))
+
+ with io.open(options.checkers_report, 'r', encoding=options.source_encoding) as checkers_report:
+ content = checkers_report.read()
+
+ checkers_file.write("\n")
+ checkers_file.write(html_escape(content))
+ checkers_file.write("\n")
+
+ checkers_file.write(HTML_FOOTER % contentHandler.versionCppcheck)
+
print("\nOpen '" + options.report_dir + "/index.html' to see the results.")
diff --git a/test/tools/htmlreport/example-checkers.txt b/test/tools/htmlreport/example-checkers.txt
new file mode 100644
index 00000000000..5a3259713e2
--- /dev/null
+++ b/test/tools/htmlreport/example-checkers.txt
@@ -0,0 +1 @@
+Just a few random words..
diff --git a/test/tools/htmlreport/test_htmlreport.py b/test/tools/htmlreport/test_htmlreport.py
index bb2ab86fd05..cec5aafea06 100755
--- a/test/tools/htmlreport/test_htmlreport.py
+++ b/test/tools/htmlreport/test_htmlreport.py
@@ -80,9 +80,23 @@ def testMissingInclude(self):
output_directory.cleanup()
+ def testAddCheckersReport(self):
+ with runCheck(
+ xml_filename=os.path.join(TEST_TOOLS_DIR, 'example.xml'),
+ checkers_filename=os.path.join(TEST_TOOLS_DIR, 'example-checkers.txt')
+ ) as (report, output_directory):
+ self.assertIn('