-
Notifications
You must be signed in to change notification settings - Fork 362
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
not all GCC warnings are detected with the default sonar.cxx.gcc.regex #1703
Comments
Hello @stalb, thanks for your feedback.
Maybe you can provide an update? Regards, |
GCC version : 8.3.0 The problem is that the warning message is missing the id part, so the regex doesn't match and there is no id, so no rule to match... |
Hi,
regex can be changed. But because the message id is missing, to which rule should warning be mapped? Regards, |
There's a rule which key is "enabled by default" and description "Default compiler warnings". Is there any reason why all gcc warnings are tagged critical ? |
@stalb No. Think the initial author of the rule definition did it to have less work. Assigning them to different types and severities is a lot of work. If you have a better proposal would be glad if you could share it here. |
@stalb thanks for your PR #1708. I’m not sure if this is the right solution?
So my initial question is: Why should we behave different in this sensor? Regards, |
In gcc, there are warnings which are not associated with any switch (they cannot be activated or deactivated using a specific switch as -Wuninitialized or -Wno-uninitialized). The plugin is using the warning switch parameter (used to enable or disable the warning) as the rule id for all the warnings messages enabled by a switch. Ideally all this warnings should have different individual type, severity, effort assigned to each of them, however since they all have the same rule id, they all share the same type, severity, effort assigned. What I propose is not to ignore these warnings and to map them with a rule that, for now, in not used. This rule as the same type, severity, effort assigned as every other gcc rules. If someone has a better solution, it's ok for me. By the way, clang behaves the same. It also has warnings which are not associated with any switch. |
@stalb ok let’s try it. |
Please turn debug info on and reproduce your issue.
The debug info in the log file could help to solve or locate the issue.
Description
Some gcc warnings are not reported in SonarQube by the Community SonarQube C plugin
Steps to reproduce the problem
main.c
Exemple repo (CI is defined for gitlab) is here: https://github.com/stalb/demo_missing_rule_sonar_cxx_plugin
Expected behavior
Community SonarQube C plugin and SonarQube should report 2 issues on main.c.
Actual behavior
Only the 2nd warning (unused variable) is reported.
In fact because of the , the Community SonarQube C plugin detects only the 2nd one.
Known workarounds
none (the id part is missing in the 1st warning)
LOG file
Any warnings/errors in the LOG file? None
Related information
The text was updated successfully, but these errors were encountered: