I do not know how it is deployed, if relevant for this issue, I can inquire this information from my IT dept
I looked through the public issue tracker and could not find a similar issue, so here I go, if this is not the right place to place this please do point me in a direction as I could not find another obvious place to report it to.
As the title says its about a false-positive in rule kotlin:S1128 “Unnecessary imports should be removed” when using this import from Jetbrains Compose:
import androidx.compose.runtime.getValue
or
import androidx.compose.runtime.setValue
The imports are necessary according to the compiler for using e.g.
androidx.compose.foundation.interaction.collectIsPressedAsState (see PressInteraction.kt:84 in Compose; requires getValue import)
or
androidx.compose.runtime.remember (see Composables.kt:24 in Compose; requires setValue import).
Thank you. If I can add any other information to help anyone in fixing this issue, please let me know.
Thanks for the report. This is indeed an issue with our Kotlin analyzer in your version of SonarQube.
The good news is that this issue is fixed in newer versions of the analyzer, deployed starting in SonarQube 10.1. Your SonarQube version will need to be upgraded for you to receive this fix. If you can’t do this right now and the rule is too noisy, you can also disable it until your SonarQube is upgraded.
Thanks for the answer Johann, happy to hear. Must have missed that issue in the tracker somehow, I will try to be more thorough in my search next time.