Skip to content

Fix first instance rule being used as rule description for all violations of that rule and other SARIF improvements #7640

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

Open
wants to merge 83 commits into
base: main
Choose a base branch
from

Conversation

Nettozx
Copy link

@Nettozx Nettozx commented Jul 2, 2025

  • Fixed issue where the first instance of a rule violation short description would get used for all subsequent rule violations, found that if you make all the rule name and descriptions empty strings, github will default to the instance descriptions
  • Added setting for problem.severity
  • Changed defaultConfiguration.level to use problem.severity instead of security-severity
  • Added more levels for security-severity
  • Added reporting of cwe ID
  • Fixed issue with uncrustify version detection
  • Added unit tests for sarif output

Before:
cppcheck_original_problem

After:
image

@firewave
Copy link
Collaborator

firewave commented Jul 2, 2025

Thanks for you contribution.

I added a remark on how to keep this in sync for future changes. Possibly not something which should addressed before/in this PR.

Also something like --errorlist-sarif might make sense.

Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!!

I believe we'll need to rethink that getRuleDescription somehow but unfortunately I don't see a quick/simple method..

@Nettozx
Copy link
Author

Nettozx commented Jul 18, 2025

Actually I just made a discovery. If I make all the descriptions for the rules blank strings, github will default to the instance specific description for each and this solves the problem. So this should greatly simplify the addition.

That is so much better 👍

Sounds like it will both simplify our job and make the user experience better.

@danmar this is ready for review again

@danmar
Copy link
Owner

danmar commented Jul 20, 2025

Merge remote-tracking branch 'refs/remotes/origin/main'

for your information I prefer if people use git rebase .. instead of git merge .. because it makes the PRs cleaner. I guess it should not matter in the end though because I will squash this PR.

@danmar
Copy link
Owner

danmar commented Jul 20, 2025

CI: I think you can fix the "dmake" failures by just running make run-dmake in the cppcheck project folder.

@danmar
Copy link
Owner

danmar commented Jul 20, 2025

I have released 2.18.0 but if you fix this I think a 2.18.1 can be released with this fix.

@Nettozx
Copy link
Author

Nettozx commented Jul 20, 2025

CI: I think you can fix the "dmake" failures by just running make run-dmake in the cppcheck project folder.

@danmar I fixed the dmake issue.

@Nettozx
Copy link
Author

Nettozx commented Jul 24, 2025

@danmar this is ready for review

@danmar
Copy link
Owner

danmar commented Jul 31, 2025

@Nettozx there are 5 failing tests in the CI have you looked at those?

…nge tests so it doesnt need to run executable
@Nettozx
Copy link
Author

Nettozx commented Jul 31, 2025

@Nettozx there are 5 failing tests in the CI have you looked at those?

I made an update to move sarif reporter out to its own header because it was in an anonymous class so it couldn't be used for unit test originally. Now that I moved it, I updated the tests so it no longer relies on cppcheck executable and it can use internal libraries.

Copy link

sonarqubecloud bot commented Aug 1, 2025

@Nettozx
Copy link
Author

Nettozx commented Aug 4, 2025

@Nettozx there are 5 failing tests in the CI have you looked at those?

@danmar its all passing now

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.

3 participants