diff --git a/bigbone-rx/build.gradle b/bigbone-rx/build.gradle index 3e92bfdfe..ec1023fa7 100644 --- a/bigbone-rx/build.gradle +++ b/bigbone-rx/build.gradle @@ -1,5 +1,6 @@ plugins { id 'bigbone.library-conventions' + alias(libs.plugins.ktlint) } dependencies { diff --git a/bigbone-rx/src/main/kotlin/social/bigbone/rx/RxAccountMethods.kt b/bigbone-rx/src/main/kotlin/social/bigbone/rx/RxAccountMethods.kt index 2c13c34db..d41364869 100644 --- a/bigbone-rx/src/main/kotlin/social/bigbone/rx/RxAccountMethods.kt +++ b/bigbone-rx/src/main/kotlin/social/bigbone/rx/RxAccountMethods.kt @@ -29,8 +29,14 @@ class RxAccountMethods(client: MastodonClient) { ): Single { return Single.create { try { - val token = accountMethods.registerAccount(username, email, password, - agreement, locale, reason).execute() + val token = accountMethods.registerAccount( + username, + email, + password, + agreement, + locale, + reason + ).execute() it.onSuccess(token) } catch (throwable: Throwable) { it.onErrorIfNotDisposed(throwable) diff --git a/bigbone/build.gradle b/bigbone/build.gradle index 3fa31f718..3f57c6927 100644 --- a/bigbone/build.gradle +++ b/bigbone/build.gradle @@ -2,6 +2,7 @@ plugins { id 'bigbone.library-conventions' id 'bigbone.integrationtest-conventions' alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.ktlint) } dependencies { diff --git a/bigbone/src/integrationTest/kotlin/social/bigbone/v300/V300TestSuite.kt b/bigbone/src/integrationTest/kotlin/social/bigbone/v300/V300TestSuite.kt index 47ee53a33..9a283dfee 100644 --- a/bigbone/src/integrationTest/kotlin/social/bigbone/v300/V300TestSuite.kt +++ b/bigbone/src/integrationTest/kotlin/social/bigbone/v300/V300TestSuite.kt @@ -10,5 +10,4 @@ import org.junit.platform.suite.api.SuiteDisplayName V300InstanceMethodsIntegrationTest::class, V300StatusMethodsIntegrationTest::class ) -class V300TestSuite { -} +class V300TestSuite diff --git a/bigbone/src/integrationTest/kotlin/social/bigbone/v402/V402TestSuite.kt b/bigbone/src/integrationTest/kotlin/social/bigbone/v402/V402TestSuite.kt index c1bcdf11e..82e27bf54 100644 --- a/bigbone/src/integrationTest/kotlin/social/bigbone/v402/V402TestSuite.kt +++ b/bigbone/src/integrationTest/kotlin/social/bigbone/v402/V402TestSuite.kt @@ -10,5 +10,4 @@ import org.junit.platform.suite.api.SuiteDisplayName V402InstanceMethodsIntegrationTest::class, V402StatusMethodsIntegrationTest::class ) -class V402TestSuite { -} +class V402TestSuite diff --git a/bigbone/src/integrationTest/kotlin/social/bigbone/v410/V410StatusMethodsIntegrationTest.kt b/bigbone/src/integrationTest/kotlin/social/bigbone/v410/V410StatusMethodsIntegrationTest.kt index f545df8b7..4c7d638f0 100644 --- a/bigbone/src/integrationTest/kotlin/social/bigbone/v410/V410StatusMethodsIntegrationTest.kt +++ b/bigbone/src/integrationTest/kotlin/social/bigbone/v410/V410StatusMethodsIntegrationTest.kt @@ -170,7 +170,7 @@ class V410StatusMethodsIntegrationTest { options = listOf("Ja", "Nein"), expiresIn = "300", multiple = true, - hideTotals = true, + hideTotals = true ), visibility = Status.Visibility.Private, inReplyToId = statusId, @@ -260,10 +260,10 @@ class V410StatusMethodsIntegrationTest { val scheduledPoll = user1Client.statuses.schedulePoll( status = "Will this poll be posted at $inSixMinutes?", scheduledAt = inSixMinutes, - pollData = PollData ( + pollData = PollData( options = listOf("Yes", "No"), expiresIn = "300" - ), + ) ).execute() // then diff --git a/bigbone/src/integrationTest/kotlin/social/bigbone/v410/V410TestSuite.kt b/bigbone/src/integrationTest/kotlin/social/bigbone/v410/V410TestSuite.kt index b2edd0ea5..174f938ff 100644 --- a/bigbone/src/integrationTest/kotlin/social/bigbone/v410/V410TestSuite.kt +++ b/bigbone/src/integrationTest/kotlin/social/bigbone/v410/V410TestSuite.kt @@ -11,5 +11,4 @@ import org.junit.platform.suite.api.SuiteDisplayName V410StatusMethodsIntegrationTest::class, V410MediaMethodsIntegrationTest::class ) -class V410TestSuite { -} +class V410TestSuite diff --git a/bigbone/src/main/kotlin/social/bigbone/JsonSerializer.kt b/bigbone/src/main/kotlin/social/bigbone/JsonSerializer.kt index 85667703b..163edfc9a 100644 --- a/bigbone/src/main/kotlin/social/bigbone/JsonSerializer.kt +++ b/bigbone/src/main/kotlin/social/bigbone/JsonSerializer.kt @@ -6,4 +6,4 @@ internal val JSON_SERIALIZER: Json = Json { encodeDefaults = true ignoreUnknownKeys = true coerceInputValues = true -} \ No newline at end of file +} diff --git a/bigbone/src/main/kotlin/social/bigbone/MastodonClient.kt b/bigbone/src/main/kotlin/social/bigbone/MastodonClient.kt index 9eaa44a7d..0af09362d 100644 --- a/bigbone/src/main/kotlin/social/bigbone/MastodonClient.kt +++ b/bigbone/src/main/kotlin/social/bigbone/MastodonClient.kt @@ -688,7 +688,10 @@ private constructor( return client.newCall( Request.Builder().url( fullUrl( - scheme, instanceName, port, "api/$versionString/instance" + scheme, + instanceName, + port, + "api/$versionString/instance" ) ).get().build() ).execute() diff --git a/bigbone/src/main/kotlin/social/bigbone/api/Range.kt b/bigbone/src/main/kotlin/social/bigbone/api/Range.kt index 4c05755c7..16ea82665 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/Range.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/Range.kt @@ -9,7 +9,7 @@ class Range @JvmOverloads constructor( val maxId: String? = null, val minId: String? = null, val sinceId: String? = null, - val limit: Int? = null, + val limit: Int? = null ) { fun toParameters() = Parameters().apply { maxId?.let { append("max_id", it) } diff --git a/bigbone/src/main/kotlin/social/bigbone/api/entity/Conversation.kt b/bigbone/src/main/kotlin/social/bigbone/api/entity/Conversation.kt index 52649bed1..4f4b4bdd6 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/entity/Conversation.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/entity/Conversation.kt @@ -31,5 +31,5 @@ data class Conversation( * The last status in the conversation. */ @SerialName("last_status") - val lastStatus: Status? = null, + val lastStatus: Status? = null ) diff --git a/bigbone/src/main/kotlin/social/bigbone/api/entity/Filter.kt b/bigbone/src/main/kotlin/social/bigbone/api/entity/Filter.kt index b63841683..9c247f009 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/entity/Filter.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/entity/Filter.kt @@ -61,6 +61,7 @@ data class Filter( * Do not show this status if it is received. */ Hide("hide"), + /** * Show a warning that identifies the matching filter by title, and allow the user to expand the filtered status. * This is the default (and unknown values should be treated as equivalent to warn). diff --git a/bigbone/src/main/kotlin/social/bigbone/api/entity/Marker.kt b/bigbone/src/main/kotlin/social/bigbone/api/entity/Marker.kt index aadb26e0f..fb80daba1 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/entity/Marker.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/entity/Marker.kt @@ -25,5 +25,5 @@ data class Marker( * The timestamp of when the marker was set (ISO 8601 Datetime). */ @SerialName("updated_at") - val updatedAt: String = "", + val updatedAt: String = "" ) diff --git a/bigbone/src/main/kotlin/social/bigbone/api/entity/MastodonList.kt b/bigbone/src/main/kotlin/social/bigbone/api/entity/MastodonList.kt index da095e420..7b9bf14a1 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/entity/MastodonList.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/entity/MastodonList.kt @@ -26,7 +26,7 @@ data class MastodonList( * @see [RepliesPolicy] */ @SerialName("replies_policy") - val repliesPolicy: String = RepliesPolicy.List.value, + val repliesPolicy: String = RepliesPolicy.List.value ) { /** * Specifies the replies policy for a list. diff --git a/bigbone/src/main/kotlin/social/bigbone/api/entity/MediaAttachment.kt b/bigbone/src/main/kotlin/social/bigbone/api/entity/MediaAttachment.kt index a7e42246d..f39194661 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/entity/MediaAttachment.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/entity/MediaAttachment.kt @@ -73,7 +73,7 @@ data class MediaAttachment( * Contains the coordinates to be used for smart thumbnail cropping. */ @SerialName("focus") - val focus: Focus? = null, + val focus: Focus? = null ) /** diff --git a/bigbone/src/main/kotlin/social/bigbone/api/entity/PreviewCard.kt b/bigbone/src/main/kotlin/social/bigbone/api/entity/PreviewCard.kt index 3bebb13d9..2c93cf38e 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/entity/PreviewCard.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/entity/PreviewCard.kt @@ -102,7 +102,7 @@ data class PreviewCard( * Usage statistics for given days (typically the past week). */ @SerialName("history") - val history: List = emptyList(), + val history: List = emptyList() ) { /** * Specifies the type of the preview card. diff --git a/bigbone/src/main/kotlin/social/bigbone/api/entity/Report.kt b/bigbone/src/main/kotlin/social/bigbone/api/entity/Report.kt index 5f0d5c26a..2b59909dc 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/entity/Report.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/entity/Report.kt @@ -68,7 +68,7 @@ data class Report( * The account that was reported. */ @SerialName("target_account") - val targetAccount: Account, + val targetAccount: Account ) { /** * Specify the typology of category among spam, violation or other. diff --git a/bigbone/src/main/kotlin/social/bigbone/api/entity/StatusEdit.kt b/bigbone/src/main/kotlin/social/bigbone/api/entity/StatusEdit.kt index 82767314b..ad57f6ff1 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/entity/StatusEdit.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/entity/StatusEdit.kt @@ -65,7 +65,7 @@ data class StatusEdit( @Serializable data class PollRevision( @SerialName("options") - val options: List = emptyList(), + val options: List = emptyList() ) /** diff --git a/bigbone/src/main/kotlin/social/bigbone/api/method/AccountMethods.kt b/bigbone/src/main/kotlin/social/bigbone/api/method/AccountMethods.kt index a7c9676de..b6e17e73b 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/method/AccountMethods.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/method/AccountMethods.kt @@ -159,7 +159,7 @@ class AccountMethods(private val client: MastodonClient) { fun followAccount(accountId: String): MastodonRequest { return client.getMastodonRequest( endpoint = "api/v1/accounts/$accountId/follow", - method = MastodonClient.Method.POST, + method = MastodonClient.Method.POST ) } diff --git a/bigbone/src/main/kotlin/social/bigbone/api/method/FeaturedTagsMethods.kt b/bigbone/src/main/kotlin/social/bigbone/api/method/FeaturedTagsMethods.kt index c8b3aaed6..25878be45 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/method/FeaturedTagsMethods.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/method/FeaturedTagsMethods.kt @@ -70,5 +70,4 @@ class FeaturedTagsMethods(private val client: MastodonClient) { method = MastodonClient.Method.GET ) } - -} \ No newline at end of file +} diff --git a/bigbone/src/main/kotlin/social/bigbone/api/method/MarkerMethods.kt b/bigbone/src/main/kotlin/social/bigbone/api/method/MarkerMethods.kt index a73413b16..1ac9b6f5a 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/method/MarkerMethods.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/method/MarkerMethods.kt @@ -24,16 +24,17 @@ class MarkerMethods(private val client: MastodonClient) { endpoint = "api/v1/markers", method = MastodonClient.Method.GET, parameters = Parameters().apply { - timeline?.let { - when (timeline) { - Timeline.HOME -> append("timeline[]", "home") - Timeline.NOTIFICATIONS -> append("timeline[]", "notifications") + timeline?.let { + when (timeline) { + Timeline.HOME -> append("timeline[]", "home") + Timeline.NOTIFICATIONS -> append("timeline[]", "notifications") + } + } ?: run { + append("timeline[]", "home") + append("timeline[]", "notifications") } - } ?: run { - append("timeline[]", "home") - append("timeline[]", "notifications") } - }) + ) } /** @@ -43,14 +44,20 @@ class MarkerMethods(private val client: MastodonClient) { * @param lastReadId the id of the last read post. */ @Throws(BigBoneRequestException::class) - fun updateMarker(timeline: Timeline, lastReadId: Int): MastodonRequest { - return client.getMastodonRequest(endpoint = "api/v1/markers", method = MastodonClient.Method.POST, parameters = Parameters().apply { - when (timeline) { - Timeline.HOME -> append("home[last_read_id]", lastReadId) - Timeline.NOTIFICATIONS -> append("notifications[last_read_id]", lastReadId) + fun updateMarker( + timeline: Timeline, + lastReadId: Int + ): MastodonRequest { + return client.getMastodonRequest( + endpoint = "api/v1/markers", + method = MastodonClient.Method.POST, + parameters = Parameters().apply { + when (timeline) { + Timeline.HOME -> append("home[last_read_id]", lastReadId) + Timeline.NOTIFICATIONS -> append("notifications[last_read_id]", lastReadId) + } } - }) - + ) } } diff --git a/bigbone/src/main/kotlin/social/bigbone/api/method/ReportMethods.kt b/bigbone/src/main/kotlin/social/bigbone/api/method/ReportMethods.kt index 193f606ed..f48c4d7fc 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/method/ReportMethods.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/method/ReportMethods.kt @@ -52,13 +52,13 @@ class ReportMethods(private val client: MastodonClient) { append("account_id", accountId) append("forward", forward) append("category", setCategoryCorrectly(ruleIds, category).name) - if(!statusIds.isNullOrEmpty()) { + if (!statusIds.isNullOrEmpty()) { append("status_ids", statusIds) } - if(!comment.isNullOrEmpty() && comment.isNotBlank()) { + if (!comment.isNullOrEmpty() && comment.isNotBlank()) { append("comment", comment) } - if(!ruleIds.isNullOrEmpty()) { + if (!ruleIds.isNullOrEmpty()) { append("ruleIds", ruleIds) } } diff --git a/bigbone/src/main/kotlin/social/bigbone/api/method/SearchMethods.kt b/bigbone/src/main/kotlin/social/bigbone/api/method/SearchMethods.kt index 14390b7ad..1214a34b3 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/method/SearchMethods.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/method/SearchMethods.kt @@ -36,17 +36,17 @@ class SearchMethods(private val client: MastodonClient) { */ @JvmOverloads fun searchContent( - query: String, - type: SearchType? = null, - resolve: Boolean = false, - following: Boolean = false, - excludeUnreviewed: Boolean = false, - accountId: String? = null, - maxId: String? = null, - minId: String? = null, - limit: Int? = null, - offset: Int? = null - ): MastodonRequest { + query: String, + type: SearchType? = null, + resolve: Boolean = false, + following: Boolean = false, + excludeUnreviewed: Boolean = false, + accountId: String? = null, + maxId: String? = null, + minId: String? = null, + limit: Int? = null, + offset: Int? = null + ): MastodonRequest { return client.getMastodonRequest( endpoint = "api/v2/search", method = MastodonClient.Method.GET, @@ -66,33 +66,33 @@ class SearchMethods(private val client: MastodonClient) { limit: Int? = null, offset: Int? = null ): Parameters { - return Parameters().apply { - append("q", query) - append("offset", offset ?: 0) - if (resolve) { - append("resolve", true) - } - if (following) { - append("following", true) - } - if (excludeUnreviewed) { - append("exclude_unreviewed", true) - } - if (type != null) { - append("type", type.name) - } - if (!accountId.isNullOrEmpty() && accountId.isNotBlank()) { - append("account_id", accountId) - } - if (!maxId.isNullOrEmpty() && maxId.isNotBlank()) { - append("max_id", maxId) - } - if (!minId.isNullOrEmpty() && minId.isNotBlank()) { - append("min_id", minId) - } - if (limit != null) { - append("limit", limit.coerceIn(20, 40)) - } + return Parameters().apply { + append("q", query) + append("offset", offset ?: 0) + if (resolve) { + append("resolve", true) + } + if (following) { + append("following", true) + } + if (excludeUnreviewed) { + append("exclude_unreviewed", true) + } + if (type != null) { + append("type", type.name) + } + if (!accountId.isNullOrEmpty() && accountId.isNotBlank()) { + append("account_id", accountId) + } + if (!maxId.isNullOrEmpty() && maxId.isNotBlank()) { + append("max_id", maxId) + } + if (!minId.isNullOrEmpty() && minId.isNotBlank()) { + append("min_id", minId) + } + if (limit != null) { + append("limit", limit.coerceIn(20, 40)) } + } } } diff --git a/bigbone/src/main/kotlin/social/bigbone/api/method/StatusMethods.kt b/bigbone/src/main/kotlin/social/bigbone/api/method/StatusMethods.kt index 3ad31e572..b5a605331 100644 --- a/bigbone/src/main/kotlin/social/bigbone/api/method/StatusMethods.kt +++ b/bigbone/src/main/kotlin/social/bigbone/api/method/StatusMethods.kt @@ -304,7 +304,8 @@ class StatusMethods(private val client: MastodonClient) { fun reblogStatus(statusId: String, visibility: Status.Visibility = Status.Visibility.Public): MastodonRequest { if (visibility != Status.Visibility.Public && visibility != Status.Visibility.Unlisted && - visibility != Status.Visibility.Private) { + visibility != Status.Visibility.Private + ) { throw BigBoneRequestException("Visibility must be one of: public, unlisted, private when reblogging.") } return client.getMastodonRequest( diff --git a/bigbone/src/main/kotlin/social/bigbone/nodeinfo/NodeInfoClient.kt b/bigbone/src/main/kotlin/social/bigbone/nodeinfo/NodeInfoClient.kt index f18aff855..d0d781f02 100644 --- a/bigbone/src/main/kotlin/social/bigbone/nodeinfo/NodeInfoClient.kt +++ b/bigbone/src/main/kotlin/social/bigbone/nodeinfo/NodeInfoClient.kt @@ -67,7 +67,6 @@ object NodeInfoClient { throw BigBoneRequestException("empty link list in well-known NodeInfo location") } - // attempt returning URL to schema 2.0 information, but fall back to any - software information exists in all schemas return nodeInfo.links .firstOrNull { link -> link.rel == "http://nodeinfo.diaspora.software/ns/schema/2.0" } diff --git a/bigbone/src/test/kotlin/social/bigbone/api/method/FeaturedTagsMethodsTest.kt b/bigbone/src/test/kotlin/social/bigbone/api/method/FeaturedTagsMethodsTest.kt index d853771a4..2f0595bb5 100644 --- a/bigbone/src/test/kotlin/social/bigbone/api/method/FeaturedTagsMethodsTest.kt +++ b/bigbone/src/test/kotlin/social/bigbone/api/method/FeaturedTagsMethodsTest.kt @@ -144,5 +144,4 @@ class FeaturedTagsMethodsTest { history1[0].uses shouldBeEqualTo "0" following1.shouldBeNull() } - -} \ No newline at end of file +} diff --git a/bigbone/src/test/kotlin/social/bigbone/api/method/MarkerMethodsTest.kt b/bigbone/src/test/kotlin/social/bigbone/api/method/MarkerMethodsTest.kt index eb22adb02..8ea044b06 100644 --- a/bigbone/src/test/kotlin/social/bigbone/api/method/MarkerMethodsTest.kt +++ b/bigbone/src/test/kotlin/social/bigbone/api/method/MarkerMethodsTest.kt @@ -4,7 +4,6 @@ import org.amshove.kluent.`should not be` import org.amshove.kluent.shouldBe import org.amshove.kluent.shouldBeEqualTo import org.junit.jupiter.api.Test - import social.bigbone.testtool.MockClient class MarkerMethodsTest { diff --git a/bigbone/src/test/kotlin/social/bigbone/api/method/StatusMethodsTest.kt b/bigbone/src/test/kotlin/social/bigbone/api/method/StatusMethodsTest.kt index 2d805ff97..7cf54cbc3 100644 --- a/bigbone/src/test/kotlin/social/bigbone/api/method/StatusMethodsTest.kt +++ b/bigbone/src/test/kotlin/social/bigbone/api/method/StatusMethodsTest.kt @@ -206,7 +206,7 @@ class StatusMethodsTest { mediaIds = null, sensitive = false, spoilerText = null, - language = "en", + language = "en" ).execute() } } diff --git a/buildSrc/src/main/groovy/bigbone.kotlin-conventions.gradle b/buildSrc/src/main/groovy/bigbone.kotlin-conventions.gradle index 1658802a9..4cc171715 100644 --- a/buildSrc/src/main/groovy/bigbone.kotlin-conventions.gradle +++ b/buildSrc/src/main/groovy/bigbone.kotlin-conventions.gradle @@ -2,8 +2,5 @@ plugins { id 'bigbone.base-conventions' id 'kotlin' id 'io.gitlab.arturbosch.detekt' -} - -dependencies { - detektPlugins libs.detekt.formatting + id 'org.jlleitschuh.gradle.ktlint' } diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index b3dfe3d2b..177c983ae 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -89,41 +89,6 @@ exceptions: ThrowingExceptionsWithoutMessageOrCause: active: true -formatting: - ClassName: - active: true - DiscouragedCommentLocation: - active: true - EnumWrapping: - active: true - FunctionName: - active: true - FunctionSignature: - active: false # ***** ENABLE! ***** - maxLineLength: 160 - IfElseBracing: - active: true - MaximumLineLength: - active: true - maxLineLength: 160 - NoConsecutiveComments: - active: true - NoEmptyFirstLineInClassBody: - active: false # ***** ENABLE! ***** - NoSingleLineBlockComment: - active: true - ParameterListWrapping: - active: true - maxLineLength: 160 - PropertyName: - active: true - StringTemplateIndent: - active: true - TryCatchFinallySpacing: - active: true - TypeArgumentListSpacing: - active: true - naming: BooleanPropertyNaming: active: true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e58776c13..99dec1aa4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,6 +19,7 @@ jacoco = "0.8.9" dependency-analysis = "1.25.0" detekt = "1.23.1" versions = "0.49.0" +ktlint = "11.6.0" [libraries] junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" } @@ -32,7 +33,6 @@ mockk-dsl = { module = "io.mockk:mockk-dsl", version.ref = "mockk" } okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } rxjava = { module = "io.reactivex.rxjava3:rxjava", version.ref = "rxjava" } -detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" } [plugins] kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } @@ -40,3 +40,4 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi dependency-analysis = { id = "com.autonomousapps.dependency-analysis", version.ref = "dependency-analysis" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } versions = { id = "com.github.ben-manes.versions", version.ref = "versions" } +ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } diff --git a/sample-kotlin/build.gradle b/sample-kotlin/build.gradle index dcd160bab..1b6a27aa1 100644 --- a/sample-kotlin/build.gradle +++ b/sample-kotlin/build.gradle @@ -1,5 +1,6 @@ plugins { id 'bigbone.kotlin-conventions' + alias(libs.plugins.ktlint) } dependencies { diff --git a/sample-kotlin/src/main/kotlin/social/bigbone/sample/GetHomeTimelineWithFiltering.kt b/sample-kotlin/src/main/kotlin/social/bigbone/sample/GetHomeTimelineWithFiltering.kt index 5c98cf366..04d35c410 100644 --- a/sample-kotlin/src/main/kotlin/social/bigbone/sample/GetHomeTimelineWithFiltering.kt +++ b/sample-kotlin/src/main/kotlin/social/bigbone/sample/GetHomeTimelineWithFiltering.kt @@ -27,7 +27,6 @@ object GetHomeTimelineWithFiltering { // only use a filter if it applies to our current context (in this case, the home timeline) if (filter.context.contains(Filter.Context.Home.value)) { - // check the filter action set for this filter when (filter.filterAction) { Filter.Action.Warn.value -> shouldWarn = true