Enable detekt rules AlsoCouldBeApply and fix existing issues.
This commit is contained in:
parent
1d3aa2cd05
commit
d433c3cbaa
4 changed files with 8 additions and 10 deletions
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue