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.
This commit is contained in:
Patrick Oppenlander 2022-05-16 20:58:54 +10:00 committed by GitHub
parent 14421ae627
commit d7317b4f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -69,8 +69,7 @@ jobs:
python -m pip install pylint python -m pip install pylint
python -m pip install unittest2 python -m pip install unittest2
python -m pip install pytest python -m pip install pytest
# TODO: remove version limitation when cppcheck-htmlreport is adjusted python -m pip install pygments
python -m pip install pygments==2.11.2
python -m pip install requests python -m pip install requests
python -m pip install psutil python -m pip install psutil

View File

@ -518,9 +518,9 @@ def to_css_selector(tag):
class AnnotateCodeFormatter(HtmlFormatter): class AnnotateCodeFormatter(HtmlFormatter):
errors = [] errors = []
def wrap(self, source, outfile): def wrap(self, *args, **kwargs):
line_no = 1 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 # If this is a source code line we want to add a span tag at the
# end. # end.
if i == 1: if i == 1: