diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt index cb8b536be1..082f18e449 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt @@ -42,8 +42,8 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import javax.inject.Inject -private const val backPaginationEventLimit = 20 -private const val backPaginationPageSize = 50 +private const val BACK_PAGINATION_EVENT_LIMIT = 20 +private const val BACK_PAGINATION_PAGE_SIZE = 50 class TimelinePresenter @Inject constructor( private val timelineItemsFactory: TimelineItemsFactory, @@ -164,6 +164,6 @@ class TimelinePresenter @Inject constructor( } private fun CoroutineScope.paginateBackwards() = launch { - timeline.paginateBackwards(backPaginationEventLimit, backPaginationPageSize) + timeline.paginateBackwards(BACK_PAGINATION_EVENT_LIMIT, BACK_PAGINATION_PAGE_SIZE) } } diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/html/HtmlDocument.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/html/HtmlDocument.kt index cb0264cf5d..76df891a93 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/html/HtmlDocument.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/html/HtmlDocument.kt @@ -61,7 +61,7 @@ import org.jsoup.nodes.Element import org.jsoup.nodes.Node import org.jsoup.nodes.TextNode -private const val chipId = "chip" +private const val CHIP_ID = "chip" @Composable fun HtmlDocument( @@ -544,13 +544,13 @@ private fun AnnotatedString.Builder.appendLink(link: Element) { pop() } is PermalinkData.RoomEmailInviteLink -> { - appendInlineContent(chipId, link.ownText()) + appendInlineContent(CHIP_ID, link.ownText()) } is PermalinkData.RoomLink -> { - appendInlineContent(chipId, link.ownText()) + appendInlineContent(CHIP_ID, link.ownText()) } is PermalinkData.UserLink -> { - appendInlineContent(chipId, link.ownText()) + appendInlineContent(CHIP_ID, link.ownText()) } } } diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/about/ElementLegal.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/about/ElementLegal.kt index 81af611716..e09e0df8f8 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/about/ElementLegal.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/about/ElementLegal.kt @@ -19,17 +19,17 @@ package io.element.android.features.preferences.impl.about import androidx.annotation.StringRes import io.element.android.libraries.ui.strings.CommonStrings -private const val CopyrightUrl = "https://element.io/copyright" -private const val UsePolicyUrl = "https://element.io/acceptable-use-policy-terms" -private const val PrivacyUrl = "https://element.io/privacy" +private const val COPYRIGHT_URL = "https://element.io/copyright" +private const val USE_POLICY_URL = "https://element.io/acceptable-use-policy-terms" +private const val PRIVACY_URL = "https://element.io/privacy" sealed class ElementLegal( @StringRes val titleRes: Int, val url: String, ) { - object Copyright : ElementLegal(CommonStrings.common_copyright, CopyrightUrl) - object AcceptableUsePolicy : ElementLegal(CommonStrings.common_acceptable_use_policy, UsePolicyUrl) - object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PrivacyUrl) + object Copyright : ElementLegal(CommonStrings.common_copyright, COPYRIGHT_URL) + object AcceptableUsePolicy : ElementLegal(CommonStrings.common_acceptable_use_policy, USE_POLICY_URL) + object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PRIVACY_URL) } fun getAllLegals(): List { diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt index 21f946b3fd..5a82b20723 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt @@ -44,7 +44,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import javax.inject.Inject -private const val extendedRangeSize = 40 +private const val EXTENDED_RANGE_SIZE = 40 class RoomListPresenter @Inject constructor( private val client: MatrixClient, @@ -130,7 +130,7 @@ class RoomListPresenter @Inject constructor( private fun updateVisibleRange(range: IntRange) { if (range.isEmpty()) return - val midExtendedRangeSize = extendedRangeSize / 2 + val midExtendedRangeSize = EXTENDED_RANGE_SIZE / 2 val extendedRangeStart = (range.first - midExtendedRangeSize).coerceAtLeast(0) // Safe to give bigger size than room list val extendedRangeEnd = range.last + midExtendedRangeSize diff --git a/tools/detekt/detekt.yml b/tools/detekt/detekt.yml index ea02b86b9f..e6fd004484 100644 --- a/tools/detekt/detekt.yml +++ b/tools/detekt/detekt.yml @@ -71,8 +71,7 @@ naming: VariableNaming: active: true TopLevelPropertyNaming: - # TODO Enable it - active: false + active: true FunctionNaming: active: true ignoreAnnotated: ['Composable']