Skip to content
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

parse Clang Static Analyzer plist reports #1161

Merged
merged 1 commit into from
Jun 19, 2017

Conversation

gyorb
Copy link
Contributor

@gyorb gyorb commented Jun 13, 2017

Add support to parse Clang Static Analyzer plist results:

  • reports can be parsed from v3.7 and up (checker name is available since that version in the plist reports)
  • rules list is generated based on Clang v4.0.
  • simple unit tests are added

Resolves #547


This change is Reviewable

@guwirth guwirth added this to the 0.9.8 milestone Jun 13, 2017
@guwirth
Copy link
Collaborator

guwirth commented Jun 13, 2017

@gyorb thanks for your contribution. We will review it...

@guwirth
Copy link
Collaborator

guwirth commented Jun 13, 2017

@wichtounet think that's the feature you were looking for. Maybe you have also some time to try it out...

@wichtounet
Copy link
Contributor

Hi,

Thanks for this contribution 👍

I just installed this on my sonar instance and try to test it. But I seen one big problem. Unless I'm mistaken, you have to set the path of a single plist file, right ? How do you to handle the use of scan-build ? scan-build generates a set of plist files in a folder.

If you don't plan to support scan-build, could you tell me how to use the static-analyzer with several threads?

Thanks :)

@gyorb
Copy link
Contributor Author

gyorb commented Jun 14, 2017

Hi,

I've tested the plugin with scan-build and it can parse multiple plist files. The trick is to configure an ant-style glob pattern as a reportPath like this:
sonar.cxx.clangsa.reportPath=clang_reports/scan-build-2017-06-09-16-20-04-481327/*.plist

I've used this scan-build and Clang v3.8 for testing.

I wanted to create a wiki section on how to analyze a project and import the results, after the new feature is accepted.

I found a SampleProject2 should I update the documentation there too?

@wichtounet
Copy link
Contributor

wichtounet commented Jun 14, 2017

Ok, perfect. I didn't think of trying that. I used:

sonar.cxx.clangsa.reportPath=tmp/*/*.plist

And it worked well. I tested the official scan-build only.

It had to force alpha checkers to find issues in my programs. The analysis worked fine and the three warnings from the clang-static-analyzer were correctly reported in Sonar.

For me, it seems to work quite well. I don't have projects with lots of violations of static-analyzer, so cannot really test with large number of errors .

Copy link
Collaborator

@guwirth guwirth left a comment

Choose a reason for hiding this comment

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

@gyorb looks good to me. Think two additional things are missing:

  • add documentation in wiki
  • add an integration sample

@guwirth
Copy link
Collaborator

guwirth commented Jun 15, 2017

@guwirth
Copy link
Collaborator

guwirth commented Jun 19, 2017

@gyorb do you work on integration test or should we merge it as is?

@gyorb
Copy link
Contributor Author

gyorb commented Jun 19, 2017

@guwirth I had some other things to do and I did not finish the integration tests yet. I hope I can finish them soon.

@guwirth
Copy link
Collaborator

guwirth commented Jun 19, 2017

@gyorb I merge this so other has the chance to try it.

@guwirth guwirth merged commit 3ac7d1e into SonarOpenCommunity:master Jun 19, 2017
@gyorb
Copy link
Contributor Author

gyorb commented Jun 22, 2017

@gyorb looks good to me. Think two additional things are missing:

  • add documentation in wiki
  • add an integration sample

@guwirth thanks for the review. I've added the integration tests in pr #1172 and extended the wiki about the analysis here and about the configuration here.

@guwirth
Copy link
Collaborator

guwirth commented Jun 23, 2017

@gyorb thx for providing detailed documentation how to use the feature.

@guwirth guwirth mentioned this pull request Oct 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants