Sonarcloud report and sonarlint connected mode with sonarcloud reports are different

Using sonarlint (Bind to sonarcloud) in Eclipse, I executed sonarcloud rules in my Java project, and I ran the results through the command prompt to produce the report. However, the two reports are not identical; additional sonar problems are shown in SonarCloud.

Command prompt : mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=XXX -Dsonar.login=XXXX -Dsonar.projectKey=XXX -Dsonar.projectName=XXX

Sonarscanner version :

<dependency>
    <groupId>org.sonarsource.scanner.maven</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>3.9.1.2184</version>
</dependency>

Eclipse version : 2021-12 (4.22.0)
SonarLint : 7.4

Can anyone please help me here?

Hello @Riya,

This can happen for a few reasons, could you check our FAQ and see if you fall into one of the cases ?

If it’s not the case, could you send us:

  • one of the rule for which you observe an issue on SonarCloud and not in SonarLint
  • a simple reproducer project that demonstrates the problem

Thanks!

Hello @Damien_Urruty ,
Thanks for your reply. I am seeing the rule repository is sonarqube.

  • List item
  1. Below rule is showing in sonarcloud but not showing in sonarlint in connected mode.
    static" base class members should not be accessed via derived types

  2. Below rule is showing in sonarlint in connected mode but not showing sonarcloud.
    Lambdas should be replaced with method references
    SonarCloud :

    Sonarlint report from eclipse

    Java version :

Could you please help me here?

Hi,

Can you provide a reproducer? I.e. code we can use to reproduce the problem?

 
Thx,
Ann

@ganncamp , Here is the code.

first build this code

https://github.com/riya160791/parent/tree/master

then build :
https://github.com/riya160791/child/tree/master

then run the mvn scanner command in CMD.

@Damien_Urruty & @ganncamp - can I get an update please?

Hi,

Thanks for the files. The language experts need to take a look at this. Hopefully they’ll be along soon.

 
Ann

@ganncamp Can I get an update?

@ganncamp any update on this? I am waiting for your reply.

Hi S Riya,

I was about to try to reproduce your problem using the two GitHub repositories that you mentioned. But I saw a bin folder in each of them with some .class files. I don’t want to build a project that contains a file that I can not check before. I don’t understand why you add in GitHub the .class versions of your java files. I don’t understand why your maven configurations is duplicated in those bin folders. I don’t understand why this pom.xml file contains a typo, a F at the beginning of the XML file that make it invalid.

@alban.auzeill - It was my mistake. I hope you will not face any issue now, I have corrected. Can you please reproduce the problem and let me know

Can i get update?

Hello @Riya,

Sorry for the late reply. I tried to reproduce your issue, however, I think your reproducer is not complete.

  1. Do you need 2 separate projects?
  2. Which line on which file is reported as an issue in sonarlint? I can’t reproduce this behavior.
  3. On which line and file the issue is reported in Sonarcloud but missing in sonarlint?

Also note, that screenshots of issue messages are useless for us. We need code snippets, where issues are reported/not reported.

Regards,
Margarita