We just migrated from SonarQube 8.9 LTS to 9.9 LTS. We use the default ruleset and the latest Gradle plugin (3.5.0.2730). After the migration we see a lot of false positives for imports for delegation functions which were already covered in these issues (import androidx.compose.runtime.getValue):
Since we are using SonarQube 9.9 LTS selfhosted, is there a chance that some of the rules are outdated? How can I verify that we are using the latest ones?
Thanks for your message. I need a bit more information to be able to investigate the issue:
Is it happening on SQ or in SL? As you’re talking about SonarQube and the thread you’re referencing is about SonarLint. If it’s SonarLint, is it connected mode or not?
Could you, please, share the analysis configuration?
Could you, please, share the analysis log?
Are you mixing Java & Kotlin code?
Have you changed the values of the properties sonar.java.libraries and sonar.java.binaries?
The issue is happening on SQ (Version 9.9 (build 65466)) and SonarLint 8.1.0.6550 IDEA plugin
We have no special analysis configuration in place and the configuration is generally working flawlessly in our multi module Android project.
Where can I get this log from? I am also not sure if I can share this.
All modules are Kotlin only.
We do not set these properties
The issue is also happening in the IDE when using latest stable Android Studio (2022.1.1 Patch 2) with SonarLint 8.1.0.65508. This issue is super easy to reproduce. You can simply create an “Empty Compose Activity” project in the default “New project” wizard of Android studio. In there add a Compose delegation function, e.g.:
var test by remember { mutableStateOf(false) }
The result will be false-positive warnings about unused imports:
Thanks for the reproducer. I was able to reproduce the issue. I need some time to investigate why this is happening and under which circumstances. Will get back to you with an explanation, a ticket, and maybe a workaround, if possible.