All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nlopez.compose.rules.detekt.RememberContentMissingCheck.kt Maven / Gradle / Ivy

There is a newer version: 0.4.19
Show newest version
// Copyright 2023 Nacho Lopez
// SPDX-License-Identifier: Apache-2.0
package io.nlopez.compose.rules.detekt

import io.gitlab.arturbosch.detekt.api.Config
import io.gitlab.arturbosch.detekt.api.Debt
import io.gitlab.arturbosch.detekt.api.Issue
import io.gitlab.arturbosch.detekt.api.Severity
import io.nlopez.compose.core.ComposeKtVisitor
import io.nlopez.compose.rules.DetektRule
import io.nlopez.compose.rules.RememberContentMissing

class RememberContentMissingCheck(config: Config) :
    DetektRule(config),
    ComposeKtVisitor by RememberContentMissing() {

    override val issue: Issue = Issue(
        id = "RememberContentMissing",
        severity = Severity.Defect,
        description = """
            Using movableContentOf/movableContentWithReceiverOf in a @Composable function without it being remembered can cause visual problems, as the content would be recycled when detached from the composition.
        """.trimIndent(),
        debt = Debt.FIVE_MINS,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy