dbh54982
(dbh5498)
January 17, 2023, 10:24pm
1
Template for a good new topic, formatted with Markdown :
ALM used: GitHub
CI system used: Circle CI
Scanner command used when applicable: ./gradlew sonar
Languages of the repository: Java
Hello,
I have the following Gradle project structure:
buildSrc - Contains precompiled script plugin with the integrationTest
test suit defined.
moduleA - imports the precompiled script plugin
moduleB - imports the precompiled script plugin
build.gradle.kts - root build.gradle
that contains the Sonarqube task.
So far everything works fine but I want the integrationTest
sources to be analyzed on SonarCloud for code smells and so on. How can I achieve this?
I’ve already combined the JaCoCo coverage report with the one produced by the unit tests.
I’ve also tried adding the sources using the property sonar.tests
. It partially works. The sources appear on SonarCloud but the code isn’t analysed.
property("sonar.tests", subprojects.joinToString(separator = ", ") { "${it.projectDir.absolutePath}/src/integrationTest/java" })
Not sure if there is a better way of doing this but this was the only one that worked for me.
Thanks
ganncamp
(G Ann Campbell)
January 23, 2023, 5:57pm
2
Hi,
Welcome to the community!
Presumably your IT files are (properly) identified as tests, and thus only a few rules are available to run against them. Unfortunately, most “normal” rules just aren’t applied to tests (despite my repeated attempts).
If you really want them treated as normal source files, you’ll need to override the definition of sonar.sources
to include those files. That means, incidentally, that
test rules won’t be run against them
they will increase your License LoC for paid projects.
HTH,
Ann
dbh54982
(dbh5498)
January 23, 2023, 6:29pm
3
On Intellij the rules that fail are displayed using SonarLint on SonarCloud which is not the case for the Integration Test files.
Do you think that I may be missing something?
Thanks
ganncamp
(G Ann Campbell)
January 23, 2023, 6:30pm
4
Hi,
Sorry, I don’t understand.
Ann
dbh54982
(dbh5498)
January 23, 2023, 6:50pm
5
Using the SonarLint plugin on Intellij my Integration Tests contain errors.
On SonarQube no error is display at all.
ganncamp
(G Ann Campbell)
January 23, 2023, 6:54pm
6
Hi,
Do you mean errors or issues ?
I believe ‘normal’ rules may be run on tests in some SonarLint situations. That’s not really intended.
Ann