Skip to content

Commit

Permalink
Revert "chore: Re-enable Detekt except in CI"
Browse files Browse the repository at this point in the history
This reverts commit 533262d.
  • Loading branch information
rholshausen committed Dec 3, 2024
1 parent 533262d commit bc3815c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ plugins {
id 'org.jetbrains.kotlin.jvm'

id 'groovy'
// TODO: Detekt does not support JDK 23 yet
id "io.gitlab.arturbosch.detekt" apply false
// id "io.gitlab.arturbosch.detekt" TODO: Detekt does not support JDK 23 yet
id 'codenarc'
}

Expand Down Expand Up @@ -113,8 +112,6 @@ codenarcTest {
}

// TODO: Detekt does not support JDK 23 yet
if (System.getenv('CI') == null) {
detekt {
config = files(rootProject.file("config/detekt-config.yml"))
}
}
//detekt {
// config = files(rootProject.file("config/detekt-config.yml"))
//}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package au.com.dius.pact.core.model.matchingrules

import au.com.dius.pact.core.model.PactSpecVersion
import au.com.dius.pact.core.model.PathToken
import au.com.dius.pact.core.model.atLeast
import au.com.dius.pact.core.model.*
import au.com.dius.pact.core.model.generators.Generator
import au.com.dius.pact.core.support.json.JsonValue
import io.github.oshai.kotlinlogging.KotlinLogging
import io.github.oshai.kotlinlogging.KLogging
import java.util.Comparator
import java.util.function.Predicate

private val logger = KotlinLogging.logger {}

/**
* Matching rules category
*/
data class MatchingRuleCategory @JvmOverloads constructor(
val name: String,
var matchingRules: MutableMap<String, MatchingRuleGroup> = mutableMapOf()
) {

companion object : KLogging()

/**
* Add a rule by key to the given category
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ import au.com.dius.pact.core.support.Either
import au.com.dius.pact.core.support.Json
import au.com.dius.pact.core.support.json.JsonValue
import au.com.dius.pact.core.support.json.map
import io.github.oshai.kotlinlogging.KotlinLogging
import io.github.oshai.kotlinlogging.KLogging
import java.lang.RuntimeException

private val logger = KotlinLogging.logger {}

/**
* Logic to use to combine rules
*/
Expand Down Expand Up @@ -65,7 +63,7 @@ interface MatchingRule {
*/
val attributes: Map<String, JsonValue>

companion object {
companion object : KLogging() {
private const val MATCH = "match"
private const val MIN = "min"
private const val MAX = "max"
Expand All @@ -87,12 +85,12 @@ interface MatchingRule {
j.has(TIME) -> TimeMatcher(j[TIME].asString()!!)
j.has(DATE) -> DateMatcher(j[DATE].asString()!!)
else -> {
logger.warn { "Unrecognised matcher definition $j, defaulting to equality matching" }
MatchingRuleGroup.logger.warn { "Unrecognised matcher definition $j, defaulting to equality matching" }
EqualsMatcher
}
}
} else {
logger.warn { "Unrecognised matcher definition $json, defaulting to equality matching" }
MatchingRuleGroup.logger.warn { "Unrecognised matcher definition $json, defaulting to equality matching" }
EqualsMatcher
}
}
Expand All @@ -110,7 +108,7 @@ interface MatchingRule {
"integer" -> NumberTypeMatcher(NumberTypeMatcher.NumberType.INTEGER)
"decimal" -> NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL)
"real" -> {
logger.warn { "The 'real' type matcher is deprecated, use 'decimal' instead" }
MatchingRuleGroup.logger.warn { "The 'real' type matcher is deprecated, use 'decimal' instead" }
NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL)
}
MIN -> MinTypeMatcher(values[MIN].asNumber()!!.toInt())
Expand Down Expand Up @@ -196,7 +194,7 @@ interface MatchingRule {
EachValueMatcher(definition)
}
else -> {
logger.warn { "Unrecognised matcher ${values[MATCH]}, defaulting to equality matching" }
MatchingRuleGroup.logger.warn { "Unrecognised matcher ${values[MATCH]}, defaulting to equality matching" }
EqualsMatcher
}
}
Expand Down Expand Up @@ -678,7 +676,7 @@ data class MatchingRuleGroup @JvmOverloads constructor(
return rules.any { matchers.contains(it.javaClass) }
}

companion object {
companion object : KLogging() {
@JvmStatic
fun fromJson(json: JsonValue): MatchingRuleGroup {
var ruleLogic = RuleLogic.AND
Expand All @@ -693,7 +691,7 @@ data class MatchingRuleGroup @JvmOverloads constructor(
ruleLogic = RuleLogic.valueOf(value)
}
} catch (e: IllegalArgumentException) {
logger.warn { "${groupJson["combine"]} is not a valid matcher rule logic value: ${e.message}" }
logger.warn { "${groupJson["combine"]} is not a valid matcher rule logic value" }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class Message @JvmOverloads constructor(
}
}

@Suppress("SwallowedException")
private fun tryParseKafkaSchemaRegistryMagicBytes(): String {
return try {
parseKafkaSchemaRegistryMagicBytes()
Expand Down

0 comments on commit bc3815c

Please sign in to comment.