- Operating system: Windows 11 Pro / 23H2 / 22631.3593
- SonarLint plugin version: SonarLint 10.6.2.78685
(with. Android Studio 2023.3.1 Patch 1 / Build #AI-233.14808.21.2331.11709847) - Programming language you’re coding in: Kotlin
- Kotlin Compiler Version : 1.9.0
- Language Version & API Version : Latest stable (2.0) (same both)
And a thorough description of the problem / question:
In Kotlin code, Sonarlint plugin warning kotlin:S1128 for the below import:
import androidx.compose.foundation.lazy.items
This import is used in your code as follows:
Surface(modifier = modifier) {
LazyColumn(
contentPadding = PaddingValues(horizontal = 8.dp
modifier = modifier
.height(350.dp)
) {
items(subMenuCollectionData) { item ->
Text(modifier = Modifier
.clickable { onItemSelected(item.text) }
...
sonarlint_log.txt (64.1 KB)
If I remove the import statement import androidx.compose.foundation.lazy.items
, the code will not compile because items
is an extension function provided by the androidx.compose.foundation.lazy
package, and it is necessary for the LazyColumn
to work correctly with collections.
I think this issue might be similar to the one described in the following link: False-positive java:S1128 unnecessary import.