-
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
Integrate Clang Static Analyzer #547
Comments
I started an implementation of this on my fork of the sonar-objective-c plugin if you want to kang it. It's designed to read from the multi-plist output format that xcodebuild produces when it executes Clang. The individual rules aren't defined yet, so at the moment it clumps all results under one rule and sets the issue message in the format of " - ". |
@mjdetullio yes for sure that is interesting for us.
Do you know if there is a possibility to create a warning list with clang? Some other tool has such command line options (e.g. CppCheck). |
According to the docs (http://clang-analyzer.llvm.org/checker_dev_manual.html) you can run However, the plist output does not contain the Clang keys or descriptions that match anything in the help command. I'm not sure if other report formats (or other versions of Clang, since Apple may have their own fork) will include the checker keys. As far as I know xcodebuild only produces multi-plist format, so that's all I've tested. Update: set output type with For example, that command will list this as a checker:
But in a report that contains that issue type, neither the key or description is found, as you can see from the below sample plist output (bottom is the relevant part). Instead, it gives a separate message. I believe any given rule can have multiple messages, depending on how the issue is detected. So, to tie the plist output to SonarQube rules, you'd have to maintain a map for each checker to their possible output messages. These output messages would need to be built manually from sample output and/or from the Clang source where the message strings are defined in the individual checkers.
|
Had to look this up in the source (https://github.com/llvm-mirror/clang/blob/master/include/clang/StaticAnalyzer/Core/Analyses.def), but the values for the
None of these reports (with Apple's LLVM/Clang) include the key or description from the help output :( |
no contributors, close this |
Hi, I'm working on this feature. There is a prototype on my fork which can parse the plist files generated by the latest clang versions. It is still under heavy development but I'm working on it. |
@gyorb thanks for letting us know this. Looking forward to include a running solution. |
In the pull request there is an initial version which can import the main relevant parts of the reports. There are some plans to improve this initial solution:
Any feedback is appreciated. |
I've extended the wiki with some simple examples how to analyze a project and with the configuration option to import the plist reports. |
The Clang Static Analyzer is a source code analysis tool that finds bugs in C, C++, and Objective-C programs (http://clang-analyzer.llvm.org).
Support this tool like Cppcheck.
The text was updated successfully, but these errors were encountered: