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

intellij
android

(Alix Warnke) #1

Hi,
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)

Regards
Alix


(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