Skip to content

htmlreport: don't report "Source file not found" for Cppcheck Premium license messages - #8987

Open
wjakobsson wants to merge 2 commits into
cppcheck-opensource:mainfrom
wjakobsson:htmlreport
Open

wjakobsson wants to merge 2 commits into
cppcheck-opensource:mainfrom
wjakobsson:htmlreport

Conversation

@wjakobsson

Copy link
Copy Markdown
Collaborator

No description provided.

@dmcppcheck dmcppcheck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review

I found no problems. The new check in handleVersion2 turns the Cppcheck Premium pseudo file name into '', so these messages now go through the existing no-file path. That path skips the source lookup, the per-file HTML page and the stats entry. The message itself still shows in index.html. The new test fails on base and passes with the PR, so it covers the fix.

I could not confirm from this repository that Cppcheck Premium really writes file="Cppcheck Premium", because no code here produces that location. I took the PR's word for it.

Testing

I built nothing with C++: the change only touches the Python cppcheck-htmlreport script and its test.

pygments is not installed in the container and there is no network or pip, so the htmlreport tests could not run as they are. To get past that, I wrote a minimal stand-in for pygments in /work/scratch/stub and put it on PYTHONPATH. With the stand-in:

  • New test, PR: PYTHONPATH=/work/scratch/stub python3 -m pytest -q test/tools/htmlreport/test_htmlreport.py -k Premium gives 1 passed.
  • New test, base: the same test pointed at the base script fails as it should: AssertionError: 'not found' unexpectedly found in "ERROR: Source file '/work/scratch/Cppcheck Premium' not found.\n".
  • Other 7 tests: they fail in this environment under both base and PR, so this PR did not cause those failures. I did not dig further; the likely cause is that they need a cppcheck binary, which I didn't build.

I also ran the script by hand on an XML with a premium-licenseExpiresSoon error at file="Cppcheck Premium" line="0":

stderr index.html
base ERROR: Source file '.../Cppcheck Premium' not found. links to 0.html#line-0
PR no error lists the message in the no-file group, no line link

Automated review of 77c4e73 by Claude. The pull request was built and tested locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants