Duplicate issues in multi-module project after upgrade to 6.4

335 views
Skip to first unread message

pmar...@gmail.com

unread,
Jun 21, 2017, 5:47:09 AM6/21/17
to SonarQube
After upgrading from SonarQube 6.3 to 6.4 we are noticing that some issues are duplicated.
It appears that aside from analyzing the specified modules, Sonar is now also analyzing everything underneath the main source directory which leads to two problems:

1. Duplicate issues: the difference seems to be that one issue is logged under the module and one is not (directly underneath the project)
2. Subfolders that weren't meant to be analyzed are being analyzed

This is our (anonymized) properties file which previously worked as it should:

sonar.projectBaseDir=/opt/jenkins/jobs/ProjectX/workspace


# unique project identifier (required)
sonar
.projectKey=ProjectX


# project metadata (used to be required, optional since SonarQube 6.1)
sonar
.projectName=ProjectX
sonar
.projectVersion=1.0


sonar
.modules=moduleA,projectX,moduleB,moduleC


sonar
.sources=src
sonar
.scm.provider=svn


moduleA
.sonar.projectName=ModuleA
moduleA
.sonar.projectBaseDir=src/java/ModuleA
projectX
.sonar.projectName=ProjectX
projectX
.sonar.projectBaseDir=src/java/ProjectX
moduleB
.sonar.projectName=ModuleB
moduleB
.sonar.projectBaseDir=src/java/ModuleB
moduleC
.sonar.projectName=ModuleC
moduleC
.sonar.projectBaseDir=src/java/ModuleC


G. Ann Campbell

unread,
Jun 21, 2017, 8:01:45 AM6/21/17
to SonarQube, pmar...@gmail.com
Hi,

Please be aware that the standard courtesies (Hi, Thanks, ...) are appreciated in this group.

Could you provide some details on language and rules, please?


Thx,
Ann

pmar...@gmail.com

unread,
Jun 21, 2017, 8:07:47 AM6/21/17
to SonarQube, pmar...@gmail.com
Hi Ann,

The language is java. 
We have no custom rules but we have disabled or lowered the threshold on some of these rules. For this we created a custom Quality Profile as is suggested by the Sonar documentation.

Do you think this has any effect?

Thank you,
Peter

Op woensdag 21 juni 2017 14:01:45 UTC+2 schreef G. Ann Campbell:

G. Ann Campbell

unread,
Jun 21, 2017, 9:25:44 AM6/21/17
to pmar...@gmail.com, SonarQube
Hi,

Using a custom profile with edited severities should have no effect on this. What I meant what: what rules are you seeing these duplicated issues from?


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/he0rfGTgnr0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/8fc1b597-bf28-4313-96bb-03f867c9b815%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

pmar...@gmail.com

unread,
Jun 21, 2017, 9:44:28 AM6/21/17
to SonarQube, pmar...@gmail.com
Hi Ann,

It doesn't seem to be related to a specific rule.
It seems that every issue is duplicated. 

In the Issues list of the project, it shows the issue once with the module name and file path and once with only the file path and as module nothing, e.g.:
ModuleA / src/com/companyname/java/packagename/File.java
and
src/.../src/com/companyname/java/packagename/File.java

This, combined with the fact that it is reporting issues on files in directories that are not listed as modules, leads me to believe that it is scanning both the modules and then from the sonar.sources directory once more.

It should only analyse the modules that I explicitly specified. I tried removing the sonar.sources=src property in the properties file but apparently that line is required.

This must be connected to the update from 6.3 to 6.4.
I also discovered this discussion: https://groups.google.com/d/msg/sonarqube/-Cz6r8dJlsQ/_TfETvkFBgAJ where Julien Henry mentions that it will be possible in 6.4 to have a multi-module project with src in root. It seems that this is the exact opposite of what I want. I have a lot of source in my root directory but I only want these specific modules to be analyzed.


Op woensdag 21 juni 2017 15:25:44 UTC+2 schreef G. Ann Campbell:
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.

Julien HENRY

unread,
Jun 21, 2017, 10:03:24 AM6/21/17
to SonarQube, pmar...@gmail.com
Hi,

You're right that since 6.4 source files in root modules are analyzed. But in theory it should not lead to duplicate file indexing (when a file is part of a module, it is automatically excluded from parents).

I'm a bit surprised by the path src/.../src/com/companyname/java/packagename/File.java that you see for the root module. Based on the configuration you provide I don't know how that may occurs. Are you using some symbolic links?

++

Julien

pmar...@gmail.com

unread,
Jun 21, 2017, 10:07:15 AM6/21/17
to SonarQube, pmar...@gmail.com
Hi Julien,

Thank you for getting involved in this discussion.
We don't use any symbolic links.

I do notice that I use src/java/ModuleA for my module's projectBaseDir. Perhaps since I already define sonar.sources to be "src" I do not need to use src in the module's projectBaseDir?

Op woensdag 21 juni 2017 16:03:24 UTC+2 schreef Julien HENRY:

janos....@sonarsource.com

unread,
Jun 21, 2017, 10:35:00 AM6/21/17
to SonarQube, pmar...@gmail.com
Hi,

To avoid analyzing the src directory at the project level, you can drop the sonar.sources setting and specify it per module, for example:

moduleA.sonar.sources=src
projectX.sonar.sources=src

I hope this helps.

Janos

pmar...@gmail.com

unread,
Jun 21, 2017, 10:47:36 AM6/21/17
to SonarQube, pmar...@gmail.com
Hi Janos,

That seems to be the solution!
Thank you (and all the others) very much for your help!

Peter

Op woensdag 21 juni 2017 16:35:00 UTC+2 schreef janos....@sonarsource.com:
Reply all
Reply to author
Forward
0 new messages