Skip to content

Commit

Permalink
Multiple error
Browse files Browse the repository at this point in the history
### What's done:
   Added atomic counter
  • Loading branch information
kentr0w committed Feb 9, 2021
1 parent 208c1ed commit c7abfc9
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import java.io.File

import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import java.util.concurrent.atomic.AtomicInteger

const val DIKTAT_COMMON = "DIKTAT_COMMON"

Expand Down Expand Up @@ -122,7 +123,9 @@ data class CommonConfiguration(private val configuration: Map<String, String>?)
*/
val kotlinVersion: KotlinVersion by lazy {
configuration?.get("kotlinVersion")?.kotlinVersion() ?: run {
log.error("Kotlin version not specified in the configuration file. Will be using ${KotlinVersion.CURRENT} version")
if(visitorCounter.incrementAndGet() == 1) {
log.error("Kotlin version not specified in the configuration file. Will be using ${KotlinVersion.CURRENT} version")
}
KotlinVersion.CURRENT
}
}
Expand All @@ -131,6 +134,13 @@ data class CommonConfiguration(private val configuration: Map<String, String>?)
* False if configuration has been read from config file, true if defaults are used
*/
val isDefault = configuration == null

companion object {
/**
* Counter that helps not to raise multiple warnings about kotlin version
*/
var visitorCounter = AtomicInteger(0)
}
}

// ================== utils for List<RulesConfig> from yml config
Expand Down

0 comments on commit c7abfc9

Please sign in to comment.