Hello,
My configuration:
- Operating system: Ubutu Linux 22.04.1
- SonarLint plugin version: 7.1.1.54565
- Programming language: Java
- IDE: IntelliJ IDEA 2022.2.3 (Community Edition)
- Connected to SonarCloud
In my project, we have a all folder called tck (test compatibility kit) used for testing with many subfolders and files.
On the following code:
public interface IStatisticsTck extends ITckBase {
@Test
default void required_getEmptySize() {
final long emptySize = function()
.get...
.get...
.statistics()
.computeTableSize(Table.EMPTY);
assertThat(emptySize).isZero();
}
SonarLint marks the bug java:S5960 (Assertions should not be used in production code) for the line assertThat
The issue is that it is not supposed to happen.
Indeed, at the root of the tck folder, in the pom.xml
, there is the entry:
<properties>
<!-- Test project, all sources are tests -->
<sonar.sources/>
<sonar.tests>src</sonar.tests>
</properties>
On SonarCloud, it is correctly excluded from the analysis, but locally, when running the analysis on the file IStatisticsTck
, it reports the false positive.
Is it a bug of SonarLint or a configuration issue ?
Best regards,