SonarQube rule does not take effect in Eclipse SonarLint

Please provide

  • Operating system: Windows 10 x64
  • SonarLint plugin version: SonarLint 7.4.0.46482 in Eclipse 2022-06 (4.24.0) 20220609-1112
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): Developer Edition - Version 8.9.9 (build 56886)

And a thorough description of the problem / question:
After successfully connected to SonarQube, I’ve wrote a simple code that basically will trigger some of the sonar violation but SonarLint does not seem to highlight the statement that violates the rule as it should be.

For example, the rule is a “Unused field should be removed” rule. I’ve created a class with unused fields but there’s no Sonar violation reported in Eclipse.

Attached is the SonarLint console log file.
SonarLint Log.log (72.1 KB)

Hey there.

Can you share this file, where the issue is not being raised? file:/D:/projects/testproject-terneuzen-synq/testproject-main/src/main/java/com/companyA/testproject/tz/impl/TestProjectServiceImpl.java

Here is the snippet of the file

package com.company.testproject.tz.impl;

@ApplicationScoped
public class TestProjectServiceImpl {
    @Inject
    ServiceA serviceA;

    public boolean testMethod() {
        return true;
    }
}

The field serviceA is not used anywhere in the code, so SonarLint should report “Unused field should be removed”.

Hi, update from my side. I’ve tested several combination below:

  1. Eclipse 2022-06 (4.24.0) Build ID 20220609-1112 - SonarLint 7.4 = Not able to report Sonar issue.
  2. Eclipse 2022-06 (4.24.0) Build ID 20220609-1112 - SonarLint 7.1 = Have error linting the class file. SonarLint seems stuck (See uploaded image below)
  3. Eclipse 2022-03 (4.23.0) Build ID 20220310-1457 - SonarLint 7.4 = Not able to report Sonar issue.
  4. Eclipse 2022-03 (4.23.0) Build ID 20220310-1457 - SonarLint 7.1 = Works fine

Hello @Samuel_W,

Could you enable verbose output and share the logs with us in text files, when testing SonarLint 7.4 ? There might be several problems going on.

Also it would be useful if you could send us a small reproducer project to make sure we can reproduce the same behaviour.

Thanks!

Hi @Damien_Urruty ,

I believe the log file attached together with the first comment of this thread is the one with “Verbose output” + “Analysis Log” enabled.

Sorry unfortunately, I’m unable to share the project as it’s confidential. But basically you can try to create a simple Java Maven project with some packages and the class example in comment#3 of this thread.

Best regards

The code snippet is not complete, as imports are missing, so I’m not sure which dependencies you are using. Hence my request to isolate what you observe in a very simple project so that we can easily reproduce it