Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved determination if application is Premium / added TODOs #7346

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

firewave
Copy link
Collaborator

@firewave firewave commented Mar 1, 2025

No description provided.

Comment on lines +1634 to +1644
const std::string manualUrl(premium ?
"https://files.cppchecksolutions.com/manual.pdf" :
"https://cppcheck.sourceforge.io/manual.pdf");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These were switched.

@firewave
Copy link
Collaborator Author

firewave commented Mar 1, 2025

This is in preparation of avoiding unmacthedSuppression with premium-* suppressions - see https://trac.cppcheck.net/ticket/13663.

It also gets rid of loading the cppcheck.cfg twice into the settings.

@firewave firewave marked this pull request as draft March 1, 2025 16:21
Comment on lines -29 to +31
"about": "NAME",
"safety": true
"about": "NAME"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test was based on the behavior that is loaded cppcheck.cfg first and being overriden by the CLI. But that is not how it was initially implemented. That behavior changed when the double loading was introduced in #5760.

@firewave firewave marked this pull request as ready for review March 1, 2025 16:58
assert exitcode == 0
assert '<safety/>' in stderr

exitcode, _, stderr = cppcheck(['--xml-version=3', '--premium=safety-off', test_file], cppcheck_exe=exe)
exitcode, _, stderr = cppcheck(['--xml-version=3', test_file], cppcheck_exe=exe)
assert exitcode == 0
assert '<safety/>' not in stderr
Copy link
Owner

Choose a reason for hiding this comment

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

Cppcheck Premium should enable safety by default. So I expect <safety/> in xml output unless it's explicitly turned off with --premium=safety-off.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cppcheck Premium should enable safety by default.

That means that it is explicitly enabled in cppcheck.cfg, right? Should it even be allowed to be disabled by default if it is premium (i.e. <safety> is missing or set to false)?

What about --no-safety? May it also override the premium safety (default)? Or should that be limited to --premium=safety-off?

I would be fine having special handling for the safety flag. I just would have it properly defined.

assert exitcode == 0
assert 'id="unusedVariable"' in stderr
assert 'id="checkersReport"' in stderr

exitcode, _, stderr = cppcheck(['--premium=autosar', '--premium=safety-off', '--xml', test_file], cppcheck_exe=exe)
exitcode, _, stderr = cppcheck(['--premium=autosar', '--xml', test_file], cppcheck_exe=exe)
assert exitcode == 0
assert 'id="unusedVariable"' in stderr
assert 'id="checkersReport"' not in stderr
Copy link
Owner

Choose a reason for hiding this comment

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

I expect to see checkersReport in the Cppcheck Premium output unless --premium=safety-off is provided.

@firewave firewave marked this pull request as draft March 19, 2025 08:15
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