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

Bugs are in findbugs-result xml but not displayed in sonar dashboard for test classes. #66

Closed
tmasuda1215 opened this issue Nov 21, 2016 · 4 comments
Labels

Comments

@tmasuda1215
Copy link

I have a simple maven project using the sonar-maven-plugin (3.2), sonarqube (5.6.3) and the sonar-findbugs plugin (3.4.4). The mvn command I am using is
sonar:sonar -Dsonar.java.binaries=target/classes,target/test-classes.
This is because I want to analyze all test classes for bugs. In the findbugs-result.xml I see the entry for the test class which has the bug. For a sanity check, I put the same exact bug in a main class. On the sonar project dashboard, under the Code tab, the test class is showing 0 bugs but the main class shows 1. Is this expected behavior to not show bugs for any classes in the test directory? Thank you

@h3xstream
Copy link
Member

Look at the console output of command.
There is most likely warning indicating the problem that occurs.

@h3xstream h3xstream added the bug label Nov 21, 2016
@tmasuda1215
Copy link
Author

You are exactly right, didn't even notice the warning in the log. After adding the test directory to the SOURCE_DIRECTORIES array in the ByteCodeResourceLocator class, it works! Thank you very much

@anzez
Copy link

anzez commented Jan 17, 2017

So does this mean that if I want to have sources in a directory different from /{"src/main/java", "src/main/webapp", "src/main/resources", "src", "/src/java"}, I actually have to build my own custom sonar-findbugs plugin? Is there no other way I could specify a different directory?

@h3xstream
Copy link
Member

h3xstream commented Jan 18, 2017

@anzez
Sonar 5.6 has some regression. They do not provided source directories like in 5.5 and lower.

Sonar-FindBugs will not start to parse Gradle or Maven configuration.. The best option available would be to make a slow search on the list of source files of the project. This modification is tracked in #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants