SonarLint not working with Eclipse STS

SonarLint is not working on my primary/desktop computer but it’s working on my notebook.
Installed components are similar - the only difference is in Java: desktop computer has Oracle Java 17 and notebook has OpenJDK 14.
In given example I would expect warning about returning “result” immediately inside foo() method which is shown on my notebook, but not showing on my desktop computer. All rules for Java are enabled in Eclipse preferences dialog.

Simple Java class

package com.thevegcat.app.data;
public class AppConfig {
	public static final String DEFAULT_NAME = "TheVegCat";
	public static final String OWNER = "H.Lo";
	String foo() {
		final String foo = "foo" + 12 + "bar";
		return foo;
	}
}

Output from Eclipse SonarLint console

Starting SonarLint for Eclipse 7.2.1.42550
SonarLint processing file /TheVegCat.development/src/test/java/com/thevegcat/app/data/AppConfig.java...
Starting standalone SonarLint engine 7.2.1.42550...
Found 0 issue(s)
Started security hotspot handler on port 64120

OS
Windows 10 Pro; Version 21H2; OS build 19044.1566; Windows Feature Experience Pack 120.2212.4170.0

Java
java version “17” 2021-09-14 LTS; Java™ SE Runtime Environment (build 17+35-LTS-2724); Java HotSpot™ 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

IDE
Spring Tool Suite 4; Version: 4.13.1.RELEASE; Build Id: 202201311654; Lombok v1.18.22 “Envious Ferret”

SonarLint
SonarLint for Eclipse 7.2.1.42550 org.sonarlint.eclipse.feature.feature.group

Hi,

Can you enable verbose + analysis output in the SonarLint console, then reopen the file and provide the complete logs?
image

Thanks

@Julien_HENRY

Hi!
Log too long to paste it here so please see attached file.
Thanks!

analysis.log (71.0 KB)

@Julien_HENRY

Hi,

I have news! When I move this class to main package, the warning is displayed.
But when in test package, no warning is displayed.

BR,
Hrvoje

Many rules of our analyzers are not evaluated on test code. This is because we considered rules will be too noisy for tests.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.