Observed that Sonar cloud is scanning only files under src/main folder its not scanning src/test

SonarCloud is excluding the code under src/test during the automatic analysis

  • Added 2 Java classes under src/main/java/com/
  • Added 3 Test Java classes under src/test/java/com/
1 Like

Hey there.

Using Automatic Analysis for Java, it’s not possible to override sonar.sources, sonar.inclusions or sonar.test.inclusions to analyze Test code as Source code.

While Automatic Analysis is a great way to get quick results, we suggest switching to CI-based analysis eventually, which will give you more flexibility (such as indexing test code as source code) (usually as simple as widening sonar.sources=src/main/java to sonar.sources=src/)