In my company, we are currently using SonarLint Eclipse (version 3.1) in connected mode to SonarQube server (version 5.6), with SonarJava (version 4.7.1).
We have some plugins and some test plugins that we want to analyze from SonarLint Eclipse :
1.If the source code is in "src/java", SonarLint works well and displays some issues detected according the rules defined from the SonarQube profile of our SonarQube server.
2.But if the source code is in "src/test/", SonarLint does not display any issue in the view "SonarLint On The Fly". In this case, SonarLint logs show:
...src/test/..../MyClassTest.java
1 files indexed
Execute Sensor: JavaSquidSensor
Configured Java source version (sonar.java.source): 8
JavaClasspath initialization
JavaClasspath initialization (done) | time=17ms
JavaTestClasspath initialization
JavaTestClasspath initialization (done) | time=15ms
Java Main Files AST scan
0 source files to be analyzed
Java Main Files AST scan (done) | time=0ms
Java Test Files AST scan
1 source files to be analyzed
0/0 source files have been analyzed
SonatLint seems to work differently between Java Main Files and Java Test Files.
Does there is a way to configure SonarLint in order that it works on the same way for Java Main Files and Java Test Files in connected mode?
In SonarLint for Eclipse, you can configure which files are considered to be test sources.
Go to:
Preferences -> SonarLint
And change the "Test file regular expressions".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With