Reason for skipping rule on some file

Hi guys :slight_smile:
I am a bit new so maybe stupid question but I cant find answer anywhere (google, docs, etc)

Versions:
sonarqube - 6.7.2
sonar maven plugin - 3.4.1.1168
maven - 3.5.3

Trying to analyze submodule in project that contains tests and test related stuff (“qa wants their code analyzed”)
Test code are divided into 4 submodules. There are at least one rule that sonar seems to check on 2 of 4 submodules, but not applying on files in other 2 modules - i.e. files that fails this specific rule are shown with issue only if they are in two submodules while if they are in two other modules sonar shows no error/issue.

Rule looks for specific regular expression in it (it is looking for some specific text in comment).

No submodules are excluded on call of mvn sonar:sonar

Files that are in question here are java files.

All submodules are analyzed as far as can tell since some issues are in all submodules (although those two submodules in question contains much much less issues).

Tried to google, tried to run mvn sonar:sonar with X but cant find anything that would point me to some direction where/how to look for reason why that specific rule was not found on files where it should be found.

Any advices?

Update:
Ok seems that my problem was not in modules but in folder - src/main/java got that rule check while src/test/java was not checked with that rules.
And found on google that it is ok… although no explanation why…
Is there really no way to apply to src/test/ that same rule checks that to src/main/java (in one project that is) ?

Hi,

This thread should help: SonarLint and Sonarqube analysis on Automation test scripts

Ann

Thanx for reply :slight_smile: but… no it did not quite helped - as far as I see general advice is: “make second project and analyze src/test as sonar.source”.
There is one slight problem with that - project I try to analyze has multiple submodules that contains src/test but project also has modules with src/main (and modules with both).
So as result - analyzing those submodules individually with src/test as sonar.source will give multiple projects in sonar.
But attempts to give sonar.source value src/test specifically in submodules with src/test (when I analyze whole project) will cause error with duplicate indexing.

aaaand on top of that if src/test are marked as main source then only non-test rules will be run over them (as I understand rule can be run only in one scope - main sources or test) but set of rules with test tag contains some good rules that I would like run over src/test too…

Sooo… I am a bit stuck and sad sad panda :slight_smile:

P.S.
If I got right from what read then you are planning to introduce changes in sonar so that rule can be run on both scopes: src/main and src/test … if thats not secret when that change could possibly see light of day? :slight_smile:

Hi,

There’s no firm plan.

Ann