Discussion:
SonarQube Eclipse doesn't show me issues after a local analysis
Eletor
2013-10-09 10:48:12 UTC
Permalink
Using SonarQube Eclipse plugin, I run remote analysis [Sonar > Mode > Remote]
(localhost:9000 and ip_on_my_lan:9000) and in both cases I see Sonar Issues
tab with some elements (everything is OK).

But if I run local analysis I don't have any issue on Sonar Issues tab and
Eclipse deletes all issues marks from source code. It seems sonar-runner
local analysis was OK: INFO - ANALYSIS SUCCESSFUL

What I'm doing wrong?

I tried with:
- Eclipse Kepler, Sonar 3.7, SonarQube Plugin 3.0 and 3.2 - Eclipse Juno,
Sonar 3.7, SonarQube Plugin 3.0 and 3.2

Thanks for your time.



--
View this message in context: http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
alexis.barbot-NFKKntAvZA5baj9gzE0k7wC/
2013-10-09 10:59:39 UTC
Permalink
Hi,

Could it be a display configuration? The plugin has the ability to filter
issues in order to display only those specific to local code (ie hide
those that already exists on server), maybe this is the default display
when you run a local analysis?

Alexis
Post by Eletor
Using SonarQube Eclipse plugin, I run remote analysis [Sonar > Mode > Remote]
(localhost:9000 and ip_on_my_lan:9000) and in both cases I see Sonar Issues
tab with some elements (everything is OK).
But if I run local analysis I don't have any issue on Sonar Issues tab and
Eclipse deletes all issues marks from source code. It seems sonar-runner
local analysis was OK: INFO - ANALYSIS SUCCESSFUL
What I'm doing wrong?
- Eclipse Kepler, Sonar 3.7, SonarQube Plugin 3.0 and 3.2 - Eclipse Juno,
Sonar 3.7, SonarQube Plugin 3.0 and 3.2
Thanks for your time.
--
http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Eletor
2013-10-09 11:34:10 UTC
Permalink
Hi

Thanks for your response

In the Sonar Issues tab I have checked Show > Show All and I've never
changed those settings.

When I run a local analysis I should have blue marks from remote sonar
analysis and red marks from local analysis, shouldn't I? But I don't have
any marks at all when I run local mode. Only blue marks with remote mode.

With only localhost:9000 as a server, it should work right?

Thanks for your time and sorry my English.



--
View this message in context: http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796p5017800.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
Julien HENRY
2013-10-09 13:28:01 UTC
Permalink
Hi,

There are two steps in Eclipse local analysis mode:
- run a preview analysis (aka dry run) that produce a json report
- parse json report and create Eclipse markers

Please tell me which step is failing by looking at the json file (path is
mentioned at the end of logs when running local analysis) and tell us if
there is any reported issues.

++

Julien
Post by Eletor
Hi
Thanks for your response
In the Sonar Issues tab I have checked Show > Show All and I've never
changed those settings.
When I run a local analysis I should have blue marks from remote sonar
analysis and red marks from local analysis, shouldn't I? But I don't have
any marks at all when I run local mode. Only blue marks with remote mode.
With only localhost:9000 as a server, it should work right?
Thanks for your time and sorry my English.
--
http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796p5017800.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Eletor
2013-10-09 13:54:34 UTC
Permalink
Hi Julien

Thank you for your response

I see 2 .json files.

*dryRun.json*

{"version":"3.7","violations_per_resource":{"fon.tests.prototypes.AppiumAndroid":[{"line":9,"message":"Utility
classes should no ...


It seems there is a problem with sonar-report.json because it's empty.

*sonar-report.json*

{"version":"3.7","issues":[],"components":[],"rules":[]}




--
View this message in context: http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796p5017808.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
Julien HENRY
2013-10-10 07:30:07 UTC
Permalink
Hi,

OK so now we have a smaller area to investigate. Is it possible for your to
do the same test with SonarQube Server 3.7.1 as there were so many
improvements/bugfixes that I would like to avoid spending too much time on
an issue that may have already been resolved.

If you still have the same issue with SonarQube server 3.7.1 then please
run a preview analysis on your project from a command line and see if the
sonar-report.json is still empty:
mvn sonar:sonar -Dsonar.dryRun=true
or
sonar-runner -Dsonar.dryRun=true

Thanks

Julien
Post by Eletor
Hi Julien
Thank you for your response
I see 2 .json files.
*dryRun.json*
{"version":"3.7","violations_per_resource":{"fon.tests.prototypes.AppiumAndroid":[{"line":9,"message":"Utility
classes should no ...
It seems there is a problem with sonar-report.json because it's empty.
*sonar-report.json*
{"version":"3.7","issues":[],"components":[],"rules":[]}
--
http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796p5017808.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
KARR, DAVID
2013-10-09 15:44:25 UTC
Permalink
-----Original Message-----
Sent: Wednesday, October 09, 2013 3:48 AM
Subject: [sonar-user] SonarQube Eclipse doesn't show me issues after a local
analysis
Using SonarQube Eclipse plugin, I run remote analysis [Sonar > Mode > Remote]
(localhost:9000 and ip_on_my_lan:9000) and in both cases I see Sonar Issues
tab with some elements (everything is OK).
But if I run local analysis I don't have any issue on Sonar Issues tab and
Eclipse deletes all issues marks from source code. It seems sonar-runner
local analysis was OK: INFO - ANALYSIS SUCCESSFUL
What I'm doing wrong?
- Eclipse Kepler, Sonar 3.7, SonarQube Plugin 3.0 and 3.2 - Eclipse Juno,
Sonar 3.7, SonarQube Plugin 3.0 and 3.2
I noticed a related but different symptom.

With Sonar 3.4.1, I noticed that my local analysis wasn't using the quality profile set on the server. I had to specifically set a local property to make it use the quality profile I wanted. It's possible you're seeing a similar situation.
Eletor
2013-10-10 07:46:18 UTC
Permalink
Hi

I found the problem!!!!

I have my sources on src/test/java instead of src/main/java (test
framework)

If I run my analysis with "sonar-runner.bat" everything is ok, but when I
run a local analysis from eclipse it seems eclipse doesn't found any source,
but it doesn't say anything...

Eclipse put the binary code on /target/test-classes/ and I think Sonar
plugin can't found it.

So I have two options: Move my source to src/main/java (checked) or create
new local analysis properties (sonar.binaries)

Thank you all for your time!




--
View this message in context: http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796p5017847.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
Julien HENRY
2013-10-10 08:06:21 UTC
Permalink
Good catch.

In fact the full explanation is that Eclipse doesn't do any difference
between main code and test code. For the local analysis we have to "guess"
what are the source folders and what are the test folders. As a first try
we did a very basic implementation by checking for the word "test" in
source folder path.
See
https://github.com/SonarSource/sonar-eclipse/blob/master/org.sonar.ide.eclipse.jdt/src/org/sonar/ide/eclipse/jdt/internal/JavaProjectConfigurator.java#L45

And unfortunately this is not configurable right now. I have opened a
ticket: https://jira.codehaus.org/browse/SONARIDE-405

Feel free to vote for it.

And if your project is a test framework then from a Maven point of view
your code should go into src/main/java. Only tests of your test framework
should go into src/test/java ;)

++

Julien
Post by Eletor
Hi
I found the problem!!!!
I have my sources on src/test/java instead of src/main/java (test
framework)
If I run my analysis with "sonar-runner.bat" everything is ok, but when I
run a local analysis from eclipse it seems eclipse doesn't found any source,
but it doesn't say anything...
Eclipse put the binary code on /target/test-classes/ and I think Sonar
plugin can't found it.
So I have two options: Move my source to src/main/java (checked) or create
new local analysis properties (sonar.binaries)
Thank you all for your time!
--
http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796p5017847.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Eletor
2013-10-10 08:58:43 UTC
Permalink
Thanks Julien

That is a task I have wanted to do for a long time...

Indeed I'm just move all configuration files and everything is fine.

Thank you again



--
View this message in context: http://sonarqube.15.x6.nabble.com/SonarQube-Eclipse-doesn-t-show-me-issues-after-a-local-analysis-tp5017796p5017851.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
KARR, DAVID
2013-10-10 17:26:01 UTC
Permalink
-----Original Message-----
Sent: Thursday, October 10, 2013 12:46 AM
Subject: [sonar-user] RE: SonarQube Eclipse doesn't show me issues after a
local analysis
Hi
I found the problem!!!!
I have my sources on src/test/java instead of src/main/java (test
framework)
If I run my analysis with "sonar-runner.bat" everything is ok, but when I
run a local analysis from eclipse it seems eclipse doesn't found any source,
but it doesn't say anything...
Eclipse put the binary code on /target/test-classes/ and I think Sonar
plugin can't found it.
So I have two options: Move my source to src/main/java (checked) or create
new local analysis properties (sonar.binaries)
As Julien pointed out, your code should be in "src/main/java". Your main code IS a test framework, not code using a test framework, which would appropriately go in "src/test/java".

However, if you wanted Sonar to access BOTH "src/main/java" and "src/test/java", then the "sonar.sources" and "sonar.binaries" properties can be comma-separated lists, like "target/classes,target/test-classes".
Loading...