Skip to content

Commit

Permalink
refactor: bump projects plugin version, migrate to kotlin 1.9 and swi…
Browse files Browse the repository at this point in the history
…tch to detekt default coding styles
  • Loading branch information
christian-draeger committed Nov 29, 2023
1 parent 0835864 commit eae2354
Show file tree
Hide file tree
Showing 60 changed files with 524 additions and 1,020 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@file:Suppress("MatchingDeclarationName")

package it.skrape.matchers

import it.skrape.SkrapeItDsl
import it.skrape.fetcher.ContentType
import java.util.*

@SkrapeItDsl
public enum class ContentTypes(public val value: String) {
Expand All @@ -28,14 +31,14 @@ public enum class ContentTypes(public val value: String) {
}

public infix fun ContentType.toBe(expected: ContentTypes): ContentType /* = kotlin.String? */ =
this.apply { generalAssertion(raw() == expected.value, expected) }
this.apply { generalAssertion(raw() == expected.value, expected) }

public infix fun ContentType.toBeNot(expected: ContentTypes): ContentType /* = kotlin.String? */ =
this.apply { generalAssertion(raw() != expected.value, expected) }
this.apply { generalAssertion(raw() != expected.value, expected) }

public infix fun ContentType.toContain(expected: ContentTypes): ContentType /* = kotlin.String? */ =
this.apply { generalAssertion(raw().contains(expected.value), expected) }
this.apply { generalAssertion(raw().contains(expected.value), expected) }

private fun ContentType.raw() = (this as String)
.toLowerCase()
.replace("\\s".toRegex(), "")
.lowercase(Locale.getDefault())
.replace("\\s".toRegex(), "")
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@file:Suppress("FunctionName", "EnumEntryName")
@file:Suppress("FunctionName", "EnumEntryName", "MatchingDeclarationName")

package it.skrape.matchers

Expand Down Expand Up @@ -78,7 +78,8 @@ public enum class HttpStatus(public val code: Int, public val message: String) {
`508_Loop_Detected`(508, "Loop Detected"),
`509_Not_Extended`(509, "Not Extended"),
`510_Gone`(510, "Gone"),
`511_Network_Authentication_Required`(511, "Network Authentication Required");
`511_Network_Authentication_Required`(511, "Network Authentication Required"),
;

public fun toStatus(): Result.Status = Result.Status(code, message)
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ nexusPublishing {
}

tasks.wrapper {
gradleVersion = "7.5"
gradleVersion = "8.4"
distributionType = Wrapper.DistributionType.ALL
}
10 changes: 5 additions & 5 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
`kotlin-dsl`
kotlin("jvm") version "1.6.21"
kotlin("jvm") version "1.9.10"
}

// set the versions of Gradle plugins that the subprojects will use here
val kotlinVersion = "1.6.21"
val kotlinVersion = "1.9.10"

val detektPlugin = "1.19.0"
val detektPlugin = "1.23.4"
val gradleNexusPublishPlugin = "1.3.0"
val gradleTestLoggerPlugin = "3.1.0"
val gradleVersionsPlugin = "0.39.0"
val gradleTestLoggerPlugin = "4.0.0"
val gradleVersionsPlugin = "0.50.0"
val kotlinDokkaPlugin = "1.9.10"
val kotlinxKoverPlugin = "0.7.5"
val useLatestVersionsPlugin = "0.2.18"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Versions {
const val kotlin = "1.6.21"
const val kotlin = "1.9.10"
const val coroutines = "1.6.1"
const val ktor = "2.0.3"
const val serialization = "1.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package buildsrc.convention

import io.gitlab.arturbosch.detekt.extensions.DetektExtension.Companion.DEFAULT_SRC_DIR_KOTLIN

plugins {
base
id("io.gitlab.arturbosch.detekt")
}

detekt {
toolVersion = "1.19.0"
toolVersion = "1.23.4"
autoCorrect = true
buildUponDefaultConfig = true
source = files(DEFAULT_SRC_DIR_KOTLIN)
config = files("$rootDir/detekt.yml")
parallel = true
config.setFrom("$rootDir/detekt.yml")
buildUponDefaultConfig = true
}

tasks.check {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
kotlin {
explicitApi()
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of("8"))
languageVersion.set(JavaLanguageVersion.of("8"))
}
}

Expand All @@ -39,8 +39,8 @@ tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.apply {
jvmTarget = "1.8"
freeCompilerArgs += listOf("-Xjsr305=strict")
apiVersion = "1.4"
languageVersion = "1.4"
apiVersion = "1.6"
languageVersion = "1.6"
}
}

Expand Down
Loading

0 comments on commit eae2354

Please sign in to comment.