SonarLint on Android Studio cannot detect some rules

If your question is about SonarLint in the IntelliJ Platform, VS Code, Visual Studio, or Eclipse, please post it in that sub-category.

Otherwise, please provide:

  • Operating system: MacOS 12.1
  • IDE name and flavor/env: Android Studio Chipmunk

And a thorough description of the problem / question:
Hi, when we analyze the code with SonarLint, we only find 2/3 issues compared to SonarQube analysis. Understand about some “meta rules” that cannot be included in the SonarLint analysis. However, I found out that even “deprecated code” rule cannot be detected in the SonarLint. Is it a bug?

Thanks.

Hey there.

What version of SonarLint are you using, and what version of SonarQube? Are you using Connected Mode?

Hi,

For SonarLint, we are using the latest version, 6.7.
For SonarQube, we are using sonar scanner for Gradle, 3.3.

We are not using the Connected Mode. However, we check one of the rule (Kotlin), “Code annotated as deprecated should not be used”, is not reported by the SonarLint, though we have already included it via the plugin setting.

Thanks,
Daniel

Hello Daniel,

I was not able to reproduce on my side with the latest version (6.8.0). I correctly get an issue with kotlin:S1874 when using some deprecated code.

Could you try this latest version ? If it does not help could you share with us some logs of the analysis ? Could you also send a small reproducer project ? That would greatly help us.

Hi Damien,

I just realize that SonarLint cannot detect the deprecated code when the deprecated code comes from the Java class, while the main class uses Kotlin. Is it expected?
For old Android project, I think it is quite common to have both Java and Kotlin code in the same project.

Here I also attach the sample project.
SonarLint.zip (115.7 KB)

Thank you.