update ktlint plugin to 11.3.1, format code (#3442)

This commit is contained in:
Konrad Pozniak 2023-03-13 13:16:39 +01:00 committed by GitHub
commit d839f18267
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
141 changed files with 589 additions and 428 deletions

View file

@ -43,7 +43,9 @@ data class Account(
val name: String
get() = if (displayName.isNullOrEmpty()) {
localUsername
} else displayName
} else {
displayName
}
fun isRemote(): Boolean = this.username != this.localUsername
}
@ -53,7 +55,7 @@ data class AccountSource(
val sensitive: Boolean?,
val note: String?,
val fields: List<StringField>?,
val language: String?,
val language: String?
)
data class Field(

View file

@ -39,12 +39,16 @@ data class Attachment(
enum class Type {
@SerializedName("image")
IMAGE,
@SerializedName("gifv")
GIFV,
@SerializedName("video")
VIDEO,
@SerializedName("audio")
AUDIO,
@SerializedName("unknown")
UNKNOWN
}
@ -70,7 +74,7 @@ data class Attachment(
val focus: Focus?,
val duration: Float?,
val original: Size?,
val small: Size?,
val small: Size?
) : Parcelable
/**

View file

@ -28,7 +28,7 @@ data class DeletedStatus(
@SerializedName("media_attachments") val attachments: ArrayList<Attachment>?,
val poll: Poll?,
@SerializedName("created_at") val createdAt: Date,
val language: String?,
val language: String?
) {
fun isEmpty(): Boolean {
return text == null && attachments == null

View file

@ -12,7 +12,7 @@ data class Filter(
val context: List<String>,
@SerializedName("expires_at") val expiresAt: Date?,
@SerializedName("filter_action") private val filterAction: String,
val keywords: List<FilterKeyword>,
val keywords: List<FilterKeyword>
// val statuses: List<FilterStatus>,
) : Parcelable {
enum class Action(val action: String) {

View file

@ -8,5 +8,5 @@ import kotlinx.parcelize.Parcelize
data class FilterKeyword(
val id: String,
val keyword: String,
@SerializedName("whole_word") val wholeWord: Boolean,
@SerializedName("whole_word") val wholeWord: Boolean
) : Parcelable

View file

@ -5,5 +5,5 @@ import com.google.gson.annotations.SerializedName
data class FilterResult(
val filter: Filter,
@SerializedName("keyword_matches") val keywordMatches: List<String>?,
@SerializedName("status_matches") val statusMatches: String?,
@SerializedName("status_matches") val statusMatches: String?
)

View file

@ -57,7 +57,7 @@ data class FilterV1(
FilterKeyword(
id = id,
keyword = phrase,
wholeWord = wholeWord,
wholeWord = wholeWord
)
)
)

View file

@ -54,19 +54,19 @@ data class PollConfiguration(
@SerializedName("max_option_chars") val maxOptionChars: Int?,
@SerializedName("max_characters_per_option") val maxCharactersPerOption: Int?,
@SerializedName("min_expiration") val minExpiration: Int?,
@SerializedName("max_expiration") val maxExpiration: Int?,
@SerializedName("max_expiration") val maxExpiration: Int?
)
data class InstanceConfiguration(
val statuses: StatusConfiguration?,
@SerializedName("media_attachments") val mediaAttachments: MediaAttachmentConfiguration?,
val polls: PollConfiguration?,
val polls: PollConfiguration?
)
data class StatusConfiguration(
@SerializedName("max_characters") val maxCharacters: Int?,
@SerializedName("max_media_attachments") val maxMediaAttachments: Int?,
@SerializedName("characters_reserved_per_url") val charactersReservedPerUrl: Int?,
@SerializedName("characters_reserved_per_url") val charactersReservedPerUrl: Int?
)
data class MediaAttachmentConfiguration(
@ -75,7 +75,7 @@ data class MediaAttachmentConfiguration(
@SerializedName("image_matrix_limit") val imageMatrixLimit: Int?,
@SerializedName("video_size_limit") val videoSizeLimit: Int?,
@SerializedName("video_frame_rate_limit") val videoFrameRateLimit: Int?,
@SerializedName("video_matrix_limit") val videoMatrixLimit: Int?,
@SerializedName("video_matrix_limit") val videoMatrixLimit: Int?
)
data class PleromaConfiguration(

View file

@ -29,7 +29,7 @@ data class NewStatus(
@SerializedName("media_attributes") val mediaAttributes: List<MediaAttribute>?,
@SerializedName("scheduled_at") val scheduledAt: String?,
val poll: NewPoll?,
val language: String?,
val language: String?
)
@Parcelize
@ -46,5 +46,5 @@ data class MediaAttribute(
val id: String,
val description: String?,
val focus: String?,
val thumbnail: String?,
val thumbnail: String?
) : Parcelable

View file

@ -28,7 +28,7 @@ data class Notification(
val id: String,
val account: TimelineAccount,
val status: Status?,
val report: Report?,
val report: Report?
) {
/** From https://docs.joinmastodon.org/entities/Notification/#type */
@ -70,8 +70,9 @@ data class Notification(
@JvmStatic
fun byString(s: String): Type {
values().forEach {
if (s == it.presentation)
if (s == it.presentation) {
return it
}
}
return UNKNOWN
}
@ -115,7 +116,11 @@ data class Notification(
return if (status.mentions.any {
it.id == accountId
}
) this else copy(type = Type.STATUS)
) {
this
} else {
copy(type = Type.STATUS)
}
}
return this
}

View file

@ -20,5 +20,5 @@ import com.google.gson.annotations.SerializedName
data class NotificationSubscribeResult(
val id: Int,
val endpoint: String,
@SerializedName("server_key") val serverKey: String,
@SerializedName("server_key") val serverKey: String
)

View file

@ -8,5 +8,5 @@ data class Report(
val category: String,
val status_ids: List<String>?,
@SerializedName("created_at") val createdAt: Date,
@SerializedName("target_account") val targetAccount: TimelineAccount,
@SerializedName("target_account") val targetAccount: TimelineAccount
)

View file

@ -51,7 +51,7 @@ data class Status(
val poll: Poll?,
val card: Card?,
val language: String?,
val filtered: List<FilterResult>?,
val filtered: List<FilterResult>?
) {
val actionableId: String
@ -69,12 +69,16 @@ data class Status(
enum class Visibility(val num: Int) {
UNKNOWN(0),
@SerializedName("public")
PUBLIC(1),
@SerializedName("unlisted")
UNLISTED(2),
@SerializedName("private")
PRIVATE(3),
@SerializedName("direct")
DIRECT(4);
@ -134,7 +138,7 @@ data class Status(
attachments = attachments,
poll = poll,
createdAt = createdAt,
language = language,
language = language
)
}

View file

@ -20,5 +20,5 @@ import com.google.gson.annotations.SerializedName
data class StatusSource(
val id: String,
val text: String,
@SerializedName("spoiler_text") val spoilerText: String,
@SerializedName("spoiler_text") val spoilerText: String
)

View file

@ -29,11 +29,13 @@ data class TimelineAccount(
val url: String,
val avatar: String,
val bot: Boolean = false,
val emojis: List<Emoji>? = emptyList(), // nullable for backward compatibility
val emojis: List<Emoji>? = emptyList() // nullable for backward compatibility
) {
val name: String
get() = if (displayName.isNullOrEmpty()) {
localUsername
} else displayName
} else {
displayName
}
}

View file

@ -29,7 +29,7 @@ data class TrendingTag(
val name: String,
val url: String,
val history: List<TrendingTagHistory>,
val following: Boolean,
val following: Boolean
)
/**
@ -42,7 +42,7 @@ data class TrendingTag(
data class TrendingTagHistory(
val day: String,
val accounts: String,
val uses: String,
val uses: String
)
fun TrendingTag.start() = Date(history.last().day.toLong() * 1000L)