From d7317b4f8a73713fcc4acb6fabc72a3aeaa527c6 Mon Sep 17 00:00:00 2001 From: Patrick Oppenlander Date: Mon, 16 May 2022 20:58:54 +1000 Subject: [PATCH] fix html report generation with pygments >= 2.12.0 (#4110) pygments 2.12.0 changed the signature of the HtmlFormatter.wrap() method. As we don't actually care about the arguments to wrap we can use packing/unpacking to maintain compatability with older versions of pygments. --- .github/workflows/scriptcheck.yml | 3 +-- htmlreport/cppcheck-htmlreport | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml index 7bfab6ce1..0b6b93cd3 100644 --- a/.github/workflows/scriptcheck.yml +++ b/.github/workflows/scriptcheck.yml @@ -69,8 +69,7 @@ jobs: python -m pip install pylint python -m pip install unittest2 python -m pip install pytest - # TODO: remove version limitation when cppcheck-htmlreport is adjusted - python -m pip install pygments==2.11.2 + python -m pip install pygments python -m pip install requests python -m pip install psutil diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index c1989a0cf..5c0a78adf 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -518,9 +518,9 @@ def to_css_selector(tag): class AnnotateCodeFormatter(HtmlFormatter): errors = [] - def wrap(self, source, outfile): + def wrap(self, *args, **kwargs): line_no = 1 - for i, t in HtmlFormatter.wrap(self, source, outfile): + for i, t in HtmlFormatter.wrap(self, *args, **kwargs): # If this is a source code line we want to add a span tag at the # end. if i == 1: