feat(build): add Slack's Compose Lints
This commit is contained in:
parent
f0ac9f97e2
commit
5659ad9863
5 changed files with 26 additions and 2 deletions
|
@ -128,6 +128,17 @@
|
|||
column="4"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="ComposeUnstableCollections"
|
||||
message="The Compose Compiler cannot infer the stability of a parameter if a List<GpgIdentifier> is used in it, even if the item type is stable.
You should use Kotlinx Immutable Collections instead: `identifiers: ImmutableList<GpgIdentifier>` or create an `@Immutable` wrapper for this class: `@Immutable data class IdentifiersList(val items: List<GpgIdentifier>)`
See https://slackhq.github.io/compose-lints/rules/#avoid-using-unstable-collections for more information."
|
||||
errorLine1=" identifiers: List<GpgIdentifier>,"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt"
|
||||
line="36"
|
||||
column="16"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UnknownNullness"
|
||||
message="Should explicitly declare type here since implicit type does not specify nullness (Lazy<Array<(GitCommand<out (Any or Any?)> or GitCommand<out (Any or Any?)>?)>>)"
|
||||
|
|
|
@ -7,9 +7,11 @@ import com.android.build.api.dsl.LibraryExtension
|
|||
import com.android.build.gradle.TestedExtension
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.findByType
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
object AndroidCommon {
|
||||
|
@ -56,5 +58,11 @@ object AndroidCommon {
|
|||
}
|
||||
project.extensions.findByType<ApplicationExtension>()?.run { lint.configureLint(project) }
|
||||
project.extensions.findByType<LibraryExtension>()?.run { lint.configureLint(project) }
|
||||
val catalog = project.extensions.getByType<VersionCatalogsExtension>()
|
||||
val libs = catalog.named("libs")
|
||||
project.dependencies.addProvider(
|
||||
"lintChecks",
|
||||
libs.findLibrary("thirdparty-compose-lints").get()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,6 @@ class KotlinJVMLibrary : Plugin<Project> {
|
|||
apply(LintPlugin::class)
|
||||
apply(KotlinCommonPlugin::class)
|
||||
}
|
||||
project.extensions.configure<Lint> { configureLint(project) }
|
||||
project.extensions.configure<Lint> { configureLint(project, isJVM = true) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.android.build.api.dsl.Lint
|
|||
import org.gradle.api.Project
|
||||
|
||||
object LintConfig {
|
||||
fun Lint.configureLint(project: Project) {
|
||||
fun Lint.configureLint(project: Project, isJVM: Boolean = false) {
|
||||
quiet = project.providers.environmentVariable("CI").isPresent
|
||||
abortOnError = true
|
||||
checkReleaseBuilds = true
|
||||
|
@ -28,6 +28,10 @@ object LintConfig {
|
|||
disable += "TypographyQuotes"
|
||||
// False-positives abound due to use of ViewBinding
|
||||
disable += "UnusedIds"
|
||||
if (!isJVM) {
|
||||
enable += "ComposeM2Api"
|
||||
error += "ComposeM2Api"
|
||||
}
|
||||
baseline = project.file("lint-baseline.xml")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ testing-turbine = "app.cash.turbine:turbine:0.12.3"
|
|||
thirdparty-bouncycastle-bcpkix = { module = "org.bouncycastle:bcpkix-jdk15to18", version.ref = "bouncycastle" }
|
||||
thirdparty-bouncycastle-bcprov = { module = "org.bouncycastle:bcprov-jdk15to18", version.ref = "bouncycastle" }
|
||||
thirdparty-commons_codec = "commons-codec:commons-codec:1.14"
|
||||
thirdparty-compose-lints = "com.slack.lint.compose:compose-lint-checks:1.2.0"
|
||||
thirdparty-eddsa = "net.i2p.crypto:eddsa:0.3.0"
|
||||
thirdparty-fastscroll = "me.zhanghai.android.fastscroll:library:1.2.0"
|
||||
thirdparty-flowbinding-android = { module = "io.github.reactivecircus.flowbinding:flowbinding-android", version.ref = "flowbinding" }
|
||||
|
|
Loading…
Reference in a new issue