mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Enable detekt rules AlsoCouldBeApply and fix existing issues.
This commit is contained in:
committed by
Benoit Marty
parent
e0255777c0
commit
19e81825ff
+1
-2
@@ -41,8 +41,7 @@ class CustomTabHandler @Inject constructor(
|
|||||||
if (packageName != null) {
|
if (packageName != null) {
|
||||||
customTabsServiceConnection = object : CustomTabsServiceConnection() {
|
customTabsServiceConnection = object : CustomTabsServiceConnection() {
|
||||||
override fun onCustomTabsServiceConnected(name: ComponentName, client: CustomTabsClient) {
|
override fun onCustomTabsServiceConnected(name: ComponentName, client: CustomTabsClient) {
|
||||||
customTabsClient = client
|
customTabsClient = client.apply { warmup(0L) }
|
||||||
.also { it.warmup(0L) }
|
|
||||||
prefetchUrl(url)
|
prefetchUrl(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -101,7 +101,7 @@ class DefaultLastMessageTimestampFormatterTest {
|
|||||||
* Create DefaultLastMessageFormatter and set current time to the provided date.
|
* Create DefaultLastMessageFormatter and set current time to the provided date.
|
||||||
*/
|
*/
|
||||||
private fun createFormatter(@Suppress("SameParameterValue") currentDate: String): LastMessageTimestampFormatter {
|
private fun createFormatter(@Suppress("SameParameterValue") currentDate: String): LastMessageTimestampFormatter {
|
||||||
val clock = FakeClock().also { it.givenInstant(Instant.parse(currentDate)) }
|
val clock = FakeClock().apply { givenInstant(Instant.parse(currentDate)) }
|
||||||
val localDateTimeProvider = LocalDateTimeProvider(clock, TimeZone.UTC)
|
val localDateTimeProvider = LocalDateTimeProvider(clock, TimeZone.UTC)
|
||||||
val dateFormatters = DateFormatters(Locale.US, clock, TimeZone.UTC)
|
val dateFormatters = DateFormatters(Locale.US, clock, TimeZone.UTC)
|
||||||
return DefaultLastMessageTimestampFormatter(localDateTimeProvider, dateFormatters)
|
return DefaultLastMessageTimestampFormatter(localDateTimeProvider, dateFormatters)
|
||||||
|
|||||||
+4
-7
@@ -20,19 +20,16 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
|||||||
|
|
||||||
open class AvatarDataProvider : PreviewParameterProvider<AvatarData> {
|
open class AvatarDataProvider : PreviewParameterProvider<AvatarData> {
|
||||||
override val values: Sequence<AvatarData>
|
override val values: Sequence<AvatarData>
|
||||||
get() {
|
get() = AvatarSize.values()
|
||||||
AvatarSize.values()
|
.asSequence()
|
||||||
.also { it.sortBy { item -> item.name } }
|
.map {
|
||||||
.asSequence()
|
|
||||||
return AvatarSize.values().asSequence().map {
|
|
||||||
sequenceOf(
|
sequenceOf(
|
||||||
anAvatarData(size = it),
|
anAvatarData(size = it),
|
||||||
anAvatarData(size = it).copy(name = null),
|
anAvatarData(size = it).copy(name = null),
|
||||||
anAvatarData(size = it).copy(url = "aUrl"),
|
anAvatarData(size = it).copy(url = "aUrl"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.flatten()
|
.flatten()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun anAvatarData(
|
fun anAvatarData(
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# Default rules: https://github.com/detekt/detekt/blob/main/detekt-core/src/main/resources/default-detekt-config.yml
|
# Default rules: https://github.com/detekt/detekt/blob/main/detekt-core/src/main/resources/default-detekt-config.yml
|
||||||
|
|
||||||
style:
|
style:
|
||||||
|
AlsoCouldBeApply:
|
||||||
|
active: true
|
||||||
CascadingCallWrapping:
|
CascadingCallWrapping:
|
||||||
active: true
|
active: true
|
||||||
includeElvis: true
|
includeElvis: true
|
||||||
|
|||||||
Reference in New Issue
Block a user