-
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
clang-tidy: missing rule [clang-diagnostic-warning] #1702
Comments
Hello @stalb, thanks for your feedback.
Maybe you can provide an update? Regards, |
clang version 3.8.1-24 (tags/RELEASE_381/final) I tried the script, but my warning isn't in the generated list. |
Hi @guwirth I also tried to use However using |
Hi @stalb, Think the idea of the Python script is to run I’m not using clang. So maybe first test would be if missing messages are listed in the output? Second point: precondition is that source code is error free. In your sample the missing ; creates an syntax error. Syntax analysis is normally not the job of an static code analyzer. Regards, |
It definitively isn't in this list.
Clang reports the warnings, clang-tidy reports them also with the id The script in charge of defining clang-tidy rules based on clang warnings, is We could solve the problem by adding manualy a rule with id
I'm ok with that, however the code compiles, with warnings but compiles. Regards, |
Hi @stalb for me it would be ok to extend the script to support also these warnings. You were saying there are also warnings without id? Here we should follow the GCC approach from #1708. |
As GCC, CLANG has warnings enabled with activation switches and warnings without activation switch.
Where the 1st warning has no activation switch and the 2nd is associated to Clang-tidy maps CLANG warnings with names starting with
So we have Because the first warning don't have a warning option (as a hundred others) , it is ignored by the rule generation script and no rule with id So actually there is only one rule missing, since all clang warnings without warning option are mapped to |
Hi @stalb, adding the rule manually has a high risk for regression. Next time someone is using the script to create Regards, |
@guwirth I've tried my hand at working on this issue. I've updated the clangtidy_createrules.py to add the clang-diagnostic-warning rule directly to the clangtidy_rules.xml file. However, when I run the script to actually regenerate the clangtidy rules I'm getting a huge amount of changes to the clangtidy.xml file. Is this expected? Also, which method of generating the rulesets is preferred, using the clang-tidy RST files, or using the clang diagnostics? |
The rules of clang-tidy were last updated 9 months ago. For the clang-diagnostic-warning rule, since it's related to clang warnings I would add it in the clang diagnostics rules:
My understanding is you need to run both generating method in order to update the ruleset. |
closed with #1730 |
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 Clang-Tidy warnings -- [clang-diagnostic-warning] -- 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.
Known workarounds
none (there is no template rule for Clang-Tidy)
LOG file
Any warnings/errors in the LOG file? None
Related information
The text was updated successfully, but these errors were encountered: