Browse Source

Merge pull request #3371 from element-hq/renovate/com.lemonappdev-konsist-0.x

Update dependency com.lemonappdev:konsist to v0.16.1
pull/3398/head
Benoit Marty 3 weeks ago committed by GitHub
parent
commit
e52c7eea12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      gradle/libs.versions.toml
  2. 10
      tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistArchitectureTest.kt
  3. 9
      tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt

2
gradle/libs.versions.toml

@ -139,7 +139,7 @@ test_arch_core = "androidx.arch.core:core-testing:2.2.0" @@ -139,7 +139,7 @@ test_arch_core = "androidx.arch.core:core-testing:2.2.0"
test_junit = "junit:junit:4.13.2"
test_runner = "androidx.test:runner:1.6.2"
test_mockk = "io.mockk:mockk:1.13.12"
test_konsist = "com.lemonappdev:konsist:0.15.1"
test_konsist = "com.lemonappdev:konsist:0.16.1"
test_turbine = "app.cash.turbine:turbine:1.1.0"
test_truth = "com.google.truth:truth:1.4.4"
test_parameter_injector = "com.google.testparameterinjector:test-parameter-injector:1.17"

10
tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistArchitectureTest.kt

@ -82,7 +82,15 @@ class KonsistArchitectureTest { @@ -82,7 +82,15 @@ class KonsistArchitectureTest {
return@all if (type.startsWith("@") || type.startsWith("(") || type.startsWith("suspend")) {
true
} else {
val fullyQualifiedName = param.type.declaration.packagee?.fullyQualifiedName + "." + type
var typePackage = param.type.declaration.packagee?.name
if (typePackage == type) {
// Workaround, now that packagee.fullyQualifiedName is not available anymore
// It seems that when the type in in the same package as the function,
// the package is equal to the type (which is wrong).
// So in this case, use the package of the function
typePackage = it.packagee?.name
}
val fullyQualifiedName = "$typePackage.$type"
fullyQualifiedName !in forbiddenInterfacesForComposableParameter
}
}

9
tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt

@ -74,7 +74,14 @@ class KonsistClassNameTest { @@ -74,7 +74,14 @@ class KonsistClassNameTest {
.replace("FakeRust", "")
.replace("Fake", "")
(it.name.startsWith("Fake") || it.name.startsWith("FakeRust")) &&
it.parents().any { parent -> parent.name.replace(".", "") == interfaceName }
it.parents().any { parent ->
// Workaround to get the parent name. For instance:
// parent.name used to return `UserListPresenter.Factory` but is now returning `Factory`.
// So we need to retrieve the name of the parent class differently.
val packageName = parent.packagee!!.name
val parentName = parent.fullyQualifiedName!!.substringAfter("$packageName.").replace(".", "")
parentName == interfaceName
}
}
}

Loading…
Cancel
Save