squid:S00100 applied to test code through SonarLint in Android Studio


(Alix Warnke) #1

my IDE (Android Studio 3.1.3) complains about naming conventions for methods (squid:S00100) for unit tests. The violations, however, are not shown (correct!) in SonarQube.
What mechanisms do SonarLint employ to classify code as production code or test code?

My setup:

  • Multi-module Gradle project
  • Android Gradle Plugin 3.1.3
  • SonarQube Gradle plugin 2.6.2
  • I have correctly set the parameter sonar.sources and sonar.tests (looks fine in SonarQube)


(Duarte Meneses) #2

Hi Alix,

SonarLint will check the project’s structure to figure out if a file is a test or not depending whether it belongs to a content root of type “Source” or “Tests”.
If you check your Project Structure, to which content root does the file in question belongs to?

(Alix Warnke) #3

Hi Duarte,
the test class is correctly classified under “Tests”.

/ Alix

(Elena Vilchik) #4

Hi @Alix

Sorry for the delay.

Are you still having this problem?

(Alix Warnke) #5

Hi @Lena
yes, it is still a problem.
I just checked.
Differences in my setup compared to my original post:

  • Android Studio 3.3
  • Android Gradle Plugin 3.2.1

I’m pretty sure that this is still a problem also with the latest versions of everything but I cannot confirm with 100% certainty at this time.


(Elena Vilchik) #6

@Alix Could you tell the version of SonarLint you are using?
It will be of course better if you experiment with latest version.