Enable detekt rules TopLevelPropertyNaming and cleanup the code.

This commit is contained in:
Benoit Marty
2023-07-20 17:52:48 +02:00
parent 2bd1c75937
commit 8f715cbc92
5 changed files with 16 additions and 17 deletions

View File

@@ -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)
}
}

View File

@@ -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())
}
}
}

View File

@@ -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<ElementLegal> {

View File

@@ -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

View File

@@ -71,8 +71,7 @@ naming:
VariableNaming:
active: true
TopLevelPropertyNaming:
# TODO Enable it
active: false
active: true
FunctionNaming:
active: true
ignoreAnnotated: ['Composable']