Fix moar ktlint issues

This commit is contained in:
Benoit Marty 2024-01-11 09:41:14 +01:00 committed by Benoit Marty
parent a831f05f6e
commit 5d086ad82d
528 changed files with 146 additions and 629 deletions

View file

@ -24,7 +24,6 @@ import timber.log.Timber
* Ref: https://matrix.org/docs/spec/appendices#identifier-grammar
*/
object MatrixPatterns {
// Note: TLD is not mandatory (localhost, IP address...)
private const val DOMAIN_REGEX = ":[A-Z0-9.-]+(:[0-9]{2,5})?"

View file

@ -21,7 +21,6 @@ import java.io.Serializable
@JvmInline
value class RoomId(val value: String) : Serializable {
init {
if (BuildConfig.DEBUG && !MatrixPatterns.isRoomId(value)) {
error("`$value` is not a valid room id.\n Example room id: `!room_id:domain`.")

View file

@ -26,7 +26,6 @@ import java.io.Serializable
*/
@JvmInline
value class UserId(val value: String) : Serializable {
init {
if (BuildConfig.DEBUG && !MatrixPatterns.isUserId(value)) {
error("`$value` is not a valid user id.\nExample user id: `@name:domain`.")

View file

@ -23,7 +23,6 @@ import io.element.android.appconfig.MatrixConfiguration
* Mapping of an input URI to a matrix.to compliant URI.
*/
object MatrixToConverter {
/**
* Try to convert a URL from an element web instance or from a client permalink to a matrix.to url.
* To be successfully converted, URL path should contain one of the [SUPPORTED_PATHS].

View file

@ -22,7 +22,6 @@ import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.UserId
object PermalinkBuilder {
private const val ROOM_PATH = "room/"
private const val USER_PATH = "user/"

View file

@ -27,7 +27,6 @@ import kotlinx.collections.immutable.ImmutableList
*/
@Immutable
sealed interface PermalinkData {
data class RoomLink(
val roomIdOrAlias: String,
val isRoomAlias: Boolean,

View file

@ -30,7 +30,6 @@ import java.net.URLDecoder
* or client permalinks (e.g. <clientPermalinkBaseUrl>user/@chagai95:matrix.org)
*/
object PermalinkParser {
/**
* Turns a uri string to a [PermalinkData].
*/

View file

@ -17,5 +17,7 @@
package io.element.android.libraries.matrix.api.room
enum class CurrentUserMembership {
INVITED, JOINED, LEFT
INVITED,
JOINED,
LEFT
}

View file

@ -21,6 +21,5 @@ import io.element.android.libraries.matrix.api.core.RoomId
class ForwardEventException(
val roomIds: List<RoomId>
) : Exception() {
override val message: String? = "Failed to deliver event to $roomIds rooms"
}

View file

@ -30,7 +30,11 @@ data class RoomMember(
)
enum class RoomMembershipState {
BAN, INVITE, JOIN, KNOCK, LEAVE
BAN,
INVITE,
JOIN,
KNOCK,
LEAVE
}
fun RoomMember.getBestName(): String {

View file

@ -22,5 +22,7 @@ data class RoomNotificationSettings(
)
enum class RoomNotificationMode {
ALL_MESSAGES, MENTIONS_AND_KEYWORDS_ONLY, MUTE
ALL_MESSAGES,
MENTIONS_AND_KEYWORDS_ONLY,
MUTE
}

View file

@ -28,7 +28,6 @@ import kotlinx.coroutines.flow.onEach
* It lets load rooms on demand and filter them.
*/
interface DynamicRoomList : RoomList {
sealed interface Filter {
/**
* No filter applied.

View file

@ -28,7 +28,6 @@ import kotlin.time.Duration
* Can be retrieved from [RoomListService] methods.
*/
interface RoomList {
sealed interface LoadingState {
data object NotLoaded : LoadingState
data class Loaded(val numberOfRooms: Int) : LoadingState

View file

@ -25,7 +25,6 @@ import kotlinx.coroutines.flow.StateFlow
* It requires the SyncService to be started to receive updates.
*/
interface RoomListService {
@Immutable
sealed interface State {
data object Idle : State

View file

@ -21,7 +21,6 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.StateFlow
interface MatrixTimeline : AutoCloseable {
data class PaginationState(
val isBackPaginating: Boolean,
val hasMoreToLoadBackwards: Boolean,

View file

@ -56,7 +56,6 @@ data class PollContent(
data class UnableToDecryptContent(
val data: Data
) : EventContent {
@Immutable
sealed interface Data {
data class OlmV1Curve25519AesSha2(

View file

@ -17,5 +17,6 @@
package io.element.android.libraries.matrix.api.timeline.item.event
enum class MessageFormat {
HTML, UNKNOWN
HTML,
UNKNOWN
}

View file

@ -17,5 +17,7 @@
package io.element.android.libraries.matrix.api.timeline.item.event
enum class TimelineItemEventOrigin {
LOCAL, SYNC, PAGINATION
LOCAL,
SYNC,
PAGINATION
}

View file

@ -17,7 +17,6 @@
package io.element.android.libraries.matrix.api.timeline.item.virtual
sealed interface VirtualTimelineItem {
data class DayDivider(
val timestamp: Long
) : VirtualTimelineItem

View file

@ -21,7 +21,6 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.StateFlow
interface SessionVerificationService {
/**
* State of the current verification flow ([VerificationFlowState.Initial] if not started).
*/

View file

@ -20,7 +20,6 @@ import com.google.common.truth.Truth.assertThat
import org.junit.Test
class AuthErrorCodeTest {
@Test
fun `errorCode finds UNKNOWN code`() {
val error = AuthenticationException.Generic("M_UNKNOWN")

View file

@ -24,7 +24,6 @@ import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class MatrixToConverterTest {
@Test
fun `converting a matrix-to url does nothing`() {
val url = Uri.parse("https://matrix.to/#/#element-android:matrix.org")

View file

@ -24,7 +24,6 @@ import io.element.android.tests.testutils.isInDebug
import org.junit.Test
class PermalinkBuilderTest {
fun `building a permalink for an invalid user id throws when verifying the id`() {
assertThrowsInDebug {
val userId = UserId("some invalid user id")

View file

@ -21,7 +21,6 @@ import kotlinx.collections.immutable.persistentListOf
import org.junit.Test
class PermalinkDataTest {
@Test
fun `getRoomId() returns value when isRoomAlias is false`() {
val permalinkData = PermalinkData.RoomLink(

View file

@ -24,7 +24,6 @@ import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class PermalinkParserTest {
@Test
fun `parsing an invalid url returns a fallback link`() {
val url = "https://element.io"