From 31a5e393cba0f4091d772989bbe16d23e91a188c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Thu, 16 Apr 2026 10:18:02 +0200 Subject: [PATCH 1/3] Fix missing severity and classification bars in the HTML report Fixes a bug introduced in #7994. --- htmlreport/cppcheck-htmlreport | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 5044443a0a9..71f388628c8 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -469,9 +469,9 @@ def filter_button(enabled_filters, id, function): def filter_bar(enabled): severity_bar = ''.join([filter_button(enabled, severity, 'toggleSeverity') for severity in ['error', 'warning', 'portability', 'performance', 'style', 'information']]) + '\n | ' classification_bar = ''.join([filter_button(enabled, _class, 'toggleClassification') for _class in ['Mandatory', 'Required', 'Advisory', 'Document', 'Disapplied', 'L1','L2','L3','']]) + '\n | ' - if "checked/>" not in severity_bar: + if "checked>" not in severity_bar: severity_bar = '' - if "checked/>" not in classification_bar: + if "checked>" not in classification_bar: classification_bar = '' return ''.join([ '
\n' From 038fbe5dcfd2fd4eb53641ca292f16cee72b177e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Sun, 3 May 2026 14:21:53 +0200 Subject: [PATCH 2/3] Add test --- test/tools/htmlreport/test_htmlreport.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/tools/htmlreport/test_htmlreport.py b/test/tools/htmlreport/test_htmlreport.py index 6f8713f4f55..f84fd279fb3 100755 --- a/test/tools/htmlreport/test_htmlreport.py +++ b/test/tools/htmlreport/test_htmlreport.py @@ -107,6 +107,13 @@ def testAddTimestamp(self): output_directory.cleanup() + def testSeverityFilterBar(self): + with runCheck( + xml_filename=os.path.join(TEST_TOOLS_DIR, 'example.xml'), + ) as (report, output_directory): + self.assertIn('onclick="toggleSeverity(this)"', report) + output_directory.cleanup() + @contextlib.contextmanager def runCheck(source_filename=None, xml_version='1', xml_filename=None, checkers_filename=None): From 5bda69feeb5ca8f50b2c6b46518e8e097e256f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Sun, 3 May 2026 14:22:15 +0200 Subject: [PATCH 3/3] Delete trailing spaces --- htmlreport/cppcheck-htmlreport | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 71f388628c8..fb263c73d12 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -278,7 +278,7 @@ HTML_HEAD = """ updateFileRows(); } - + function toggleClassification(cb) { cb.parentElement.classList.toggle("unchecked", !cb.checked); var elements = document.querySelectorAll(".class_" + cb.id); @@ -289,7 +289,7 @@ HTML_HEAD = """ updateFileRows(); } - + function toggleTool(cb) { cb.parentElement.classList.toggle("unchecked", !cb.checked);