Skip to content

Commit

Permalink
chore: sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
triplem committed Dec 24, 2024
1 parent 484fc3b commit 5b6d364
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
9 changes: 6 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ plugins {
group = "org.javafreedom"
project.version = project.findProperty("version") as String? ?: "0.0.1-SNAPSHOT"

val kotlinxDatetimeVersion = "0.6.1"
val konsistVersion = "0.17.3"

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:${kotlinxDatetimeVersion}")

testImplementation(kotlin("test"))

testImplementation("com.lemonappdev:konsist:0.17.3")
testImplementation("com.lemonappdev:konsist:${konsistVersion}")
}

tasks.test {
Expand All @@ -41,7 +44,7 @@ val version: String by lazy {
mavenPublishing {
println("Using Version: ${version}")

coordinates(group.toString(), rootProject.name, version)
coordinates(groupId = group.toString(), artifactId = rootProject.name, version = version)

publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)

Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/org/javafreedom/khol/KHol.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.datetime.LocalDate
class KHol(private val holidays: HolidayDeclarations, private val validIn: String) {

fun validHolidays(year: Int) : List<LocalDate> {
if (year < 1990) throw KHolException()
if (year < VALID_START_YEAR) throw KHolException()

val result = mutableListOf<LocalDate>()

Expand All @@ -32,4 +32,8 @@ class KHol(private val holidays: HolidayDeclarations, private val validIn: Strin

return result
}

companion object {
const val VALID_START_YEAR = 1990
}
}
2 changes: 1 addition & 1 deletion src/main/kotlin/org/javafreedom/khol/KHolException.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.javafreedom.khol

class KHolException: RuntimeException() {
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@file:Suppress("detekt:style:MagicNumber")
package org.javafreedom.khol.algorithm

import kotlinx.datetime.*
import kotlinx.datetime.DateTimeUnit
import kotlinx.datetime.LocalDate
import kotlinx.datetime.minus
import org.javafreedom.khol.BaseCalculationAlgorithm

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@file:Suppress("detekt:style:MagicNumber")
package org.javafreedom.khol.algorithm

import kotlinx.datetime.DateTimeUnit
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/org/javafreedom/khol/KonsistTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ internal class KonsistTest {
}

companion object {
val BASE_PACKAGE = "org.javafreedom.khol"
const val BASE_PACKAGE = "org.javafreedom.khol"
}
}
}

0 comments on commit 5b6d364

Please sign in to comment.