Skip to content

Commit

Permalink
Rydd opp i compiler warnings og ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
hestad committed Dec 20, 2024
1 parent 356392c commit fd54603
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 214 deletions.
39 changes: 19 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

val javaVersjon = JavaVersion.VERSION_21
Expand Down Expand Up @@ -75,6 +76,10 @@ dependencies {
implementation("org.postgresql:postgresql:42.7.4")
implementation("com.github.seratch:kotliquery:1.9.0")

testImplementation(platform("org.junit:junit-bom:5.11.4"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("com.github.navikt.tiltakspenger-libs:test-common:$felleslibVersion")
testImplementation("com.github.navikt.tiltakspenger-libs:ktor-test-common:$felleslibVersion")
testImplementation("com.github.navikt.tiltakspenger-libs:auth-test-core:$felleslibVersion")
Expand All @@ -97,21 +102,20 @@ java {

spotless {
kotlin {
ktlint("0.48.2")
ktlint()
.editorConfigOverride(
mapOf(
"ktlint_standard_max-line-length" to "off",
),
)
}
}

tasks {
kotlin {
compileKotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
}
compileTestKotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
freeCompilerArgs.add("-Xconsistent-data-class-copy-visibility")
}
}

Expand All @@ -131,20 +135,15 @@ tasks {
useJUnitPlatform()
// https://phauer.com/2018/best-practices-unit-testing-kotlin/
systemProperty("junit.jupiter.testinstance.lifecycle.default", "per_class")
testLogging {
// We only want to log failed and skipped tests when running Gradle.
events("skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
}
}

register<Copy>("gitHooks") {
from(file(".scripts/pre-commit"))
into(file(".git/hooks"))
}
/*
analyzeClassesDependencies {
warnUsedUndeclared = true
warnUnusedDeclared = true
}
analyzeTestClassesDependencies {
warnUsedUndeclared = true
warnUnusedDeclared = true
}
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import com.natpryce.konfig.overriding
import com.natpryce.konfig.stringType

enum class Profile {
LOCAL, DEV, PROD
LOCAL,
DEV,
PROD,
}

object Configuration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ArenaClientImpl(
),
) : ArenaClient {
companion object {
const val navCallIdHeader = "tiltakspenger-datadeling"
const val NAV_CALL_ID_HEADER = "tiltakspenger-datadeling"
}

private data class ArenaPeriodeResponseDTO(
Expand Down Expand Up @@ -121,7 +121,7 @@ class ArenaClientImpl(
try {
val httpResponse =
httpClient.post("${config.baseUrl}/azure/tiltakspenger/vedtaksperioder") {
header(navCallIdHeader, navCallIdHeader)
header(NAV_CALL_ID_HEADER, NAV_CALL_ID_HEADER)
bearerAuth(getToken().token)
accept(ContentType.Application.Json)
contentType(ContentType.Application.Json)
Expand Down Expand Up @@ -149,7 +149,7 @@ class ArenaClientImpl(
try {
val httpResponse =
httpClient.post("${config.baseUrl}/azure/tiltakspenger/rettighetsperioder") {
header(navCallIdHeader, navCallIdHeader)
header(NAV_CALL_ID_HEADER, NAV_CALL_ID_HEADER)
bearerAuth(getToken().token)
accept(ContentType.Application.Json)
contentType(ContentType.Application.Json)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import no.nav.tiltakspenger.libs.ktor.common.respond403Forbidden
import no.nav.tiltakspenger.libs.periodisering.Periode
import java.time.LocalDate

internal const val vedtakPath = "/vedtak"
internal const val VEDTAK_PATH = "/vedtak"

fun Route.vedtakRoutes(
vedtakService: VedtakService,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import io.mockk.mockk
import no.nav.tiltakspenger.datadeling.domene.TiltakspengerVedtak
import no.nav.tiltakspenger.datadeling.jacksonSerialization
import no.nav.tiltakspenger.datadeling.routes.TestApplicationContext
import no.nav.tiltakspenger.datadeling.routes.vedtakPath
import no.nav.tiltakspenger.datadeling.routes.VEDTAK_PATH
import no.nav.tiltakspenger.datadeling.routes.vedtakRoutes
import no.nav.tiltakspenger.datadeling.service.VedtakService
import no.nav.tiltakspenger.libs.common.Fnr
Expand Down Expand Up @@ -69,7 +69,7 @@ class VedtakRoutesHentTest {
HttpMethod.Post,
url {
protocol = URLProtocol.HTTPS
path("$vedtakPath/detaljer")
path("$VEDTAK_PATH/detaljer")
},

jwt = tac.jwtGenerator.createJwtForSystembruker(roles = listOf("les-vedtak")),
Expand Down Expand Up @@ -161,7 +161,7 @@ class VedtakRoutesHentTest {
HttpMethod.Post,
url {
protocol = URLProtocol.HTTPS
path("$vedtakPath/detaljer")
path("$VEDTAK_PATH/detaljer")
},

jwt = tac.jwtGenerator.createJwtForSystembruker(roles = listOf("les-vedtak")),
Expand Down Expand Up @@ -248,7 +248,7 @@ class VedtakRoutesHentTest {
HttpMethod.Post,
url {
protocol = URLProtocol.HTTPS
path("$vedtakPath/detaljer")
path("$VEDTAK_PATH/detaljer")
},

jwt = tac.jwtGenerator.createJwtForSystembruker(roles = listOf("les-vedtak")),
Expand Down Expand Up @@ -311,7 +311,7 @@ class VedtakRoutesHentTest {
HttpMethod.Post,
url {
protocol = URLProtocol.HTTPS
path("$vedtakPath/detaljer")
path("$VEDTAK_PATH/detaljer")
},
jwt = tac.jwtGenerator.createJwtForSystembruker(roles = listOf("les-vedtak")),
) {
Expand Down Expand Up @@ -366,7 +366,7 @@ class VedtakRoutesHentTest {
HttpMethod.Post,
url {
protocol = URLProtocol.HTTPS
path("$vedtakPath/detaljer")
path("$VEDTAK_PATH/detaljer")
},
jwt = tac.jwtGenerator.createJwtForSystembruker(roles = listOf("les-vedtak")),
) {
Expand Down Expand Up @@ -421,7 +421,7 @@ class VedtakRoutesHentTest {
HttpMethod.Post,
url {
protocol = URLProtocol.HTTPS
path("$vedtakPath/detaljer")
path("$VEDTAK_PATH/detaljer")
},
jwt = tac.jwtGenerator.createJwtForSystembruker(roles = listOf("les-vedtak")),
) {
Expand Down Expand Up @@ -476,7 +476,7 @@ class VedtakRoutesHentTest {
HttpMethod.Post,
url {
protocol = URLProtocol.HTTPS
path("$vedtakPath/detaljer")
path("$VEDTAK_PATH/detaljer")
},
jwt = tac.jwtGenerator.createJwtForSystembruker(roles = listOf("les-vedtak")),
) {
Expand Down
Loading

0 comments on commit fd54603

Please sign in to comment.