-
Notifications
You must be signed in to change notification settings - Fork 363
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
clangtidy metrics not same in warnings ng plugin and sonarqube #2167
Comments
Hi @dsakilesh, thanks for your feedback. If an issue is not displayed, you should always check first whether the associated rule is activated in the Quality Profile used. Duplicates of issues are filtered out by the cxx plugin. This is done by comparing the filename, rule id, line, column and issue text.
Issues always have only one ruleId. That an issue has multiple ruleIds is not supported so far (I have never seen it before). Is this new in Clang-Tidy? The SQ API unfortunately does not support this, an issue with multiple ids. The question is also what the plugin should do here. Is this one issue or two? Regards, |
Hi @guwirth
We expect to pick 2 clangtidy issues/warnings here. (If the rule id for a warning was only one). We will check why there are 2 rule ids for a single warning.
Since you have mentioned that filtering happens based on columns also, we expect then sonar to display 4 warnings for the below clangtidy log but it shows only 1 warning. Why?
Regards, |
Hi @dsakilesh,
Good question, I don't know why? The code doing this is here, maybe you can also have look:
By the way: Which version of the plugin are you using? Regards, |
Hi @guwirth We are using sonar-cxx 1.3 version. |
Hi @dsakilesh, I created an additional unit test with your use case and there it is working #2168? Regards |
Hi @dsakilesh, I saw that 1.3 does not support column information, only 2.0. sonar-cxx/cxx-sensors/src/main/java/org/sonar/cxx/sensors/clangtidy/CxxClangTidySensor.java Line 90 in 248fdc6
Regards, |
Hi @dsakilesh, messages with multiple rule IDs seems to be new in Clang-Tidy 12: We will add the support to 2.0.x. Regards, |
Hi @guwirth It seems that Clang-Tidy 11 also has multiple rule IDs feature. I downgraded to Clang-Tidy 10 and do not have the issue. Thanks for creating a feature/enhancement issue. Regards, |
Hi @guwirth We have upgraded the sonar-cxx plugin to latest version 2.0.2. We still have got the same issue. Content of the clang tidy log (4 warnings):
SonarQube shows only 3 warnings: Even though the column number is different for first 2 warnings it seems to consider it as a single warning. Is it because the first 2 warnings have the same error text and rule id? Regards |
Hi @dsakilesh, I wrote a unit test that verifies exactly your case and it works. There must be still another problem? => #2168 Regards, |
Hi @guwirth clangtidy analysis didnot happen. hence clangtidy metrics are not populated post update from 1.3.2 to 2.0.2 I updated the parameters according to the release notes. PFB sonar properties before update:
After update we have updated to 2.0.2 the clangTidy warnings are actually not displayed in Sonarqube. Also replaced sonar.cxx.clangtidy.reportPaths with sonar.cxx.clangtidy.reportPath but no luck
Please let me know if we are missing anything here. Regards |
Hi @dsakilesh, the 2.0 cxx plugin provides a new sensor validating the scanner parameters. Turning debugging on you should get messages which obsolete settings are in your configuration. What I see from the sample above:
Regards, |
Hi @dsakilesh, I added also an integration test (using scanner and SQ server) to 2168. It detects 4 issues in the same line. Regards, |
Hi @dsakilesh, please close this issue if everything is working. For multiple id support we have #2170. Regards, |
Hi Team,
We have clangtidy.log file with below 6 warnings:
Warnings NG plugin displays number of issues: 6, But the sonar is only picking 1 warning in sonarqube.
We understand that because the line number 53 contains multiple duplicate warnings so sonar-cxx will consider them as single warning. warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
But why are the below warnings ignored completely by sonarqube?
Actual sonarqube clangtidy issue displayed in sonarqube: 1
Expected sonarqube metrics : 2 or 3(ignoring the duplicates)
Is it because the warning is associated with multiple rules? [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
Please help us resolve the issue.
Thanks in advance!
Regards,
Akilesh D S
The text was updated successfully, but these errors were encountered: