Skip to content

Commit

Permalink
Update code to Kotlin API 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Jul 31, 2022
1 parent 33ecfff commit 61b6406
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
Expand Up @@ -72,7 +72,7 @@ abstract class Rule(
private fun computeSeverity(): SeverityLevel {
val configValue: String = valueOrNull(SEVERITY_KEY)
?: ruleSetConfig.valueOrDefault(SEVERITY_KEY, "warning")
return enumValueOf(configValue.toUpperCase(Locale.US))
return enumValueOf(configValue.uppercase(Locale.US))
}

/**
Expand Down
Expand Up @@ -42,7 +42,7 @@ class DetektPrinter(private val arguments: GeneratorArgs) {
check(ruleSet.length > 1) { "Rule set name must be not empty or less than two symbols." }
return """
|---
|title: ${ruleSet[0].toUpperCase()}${ruleSet.substring(1)} Rule Set
|title: ${ruleSet[0].uppercaseChar()}${ruleSet.substring(1)} Rule Set
|sidebar: home_sidebar
|keywords: [rules, $ruleSet]
|permalink: $ruleSet.html
Expand Down
Expand Up @@ -123,7 +123,7 @@ class HtmlOutputReport : OutputReport() {
span("description") { text(findings.first().issue.description) }
}

a("$DETEKT_WEBSITE_BASE_URL/docs/rules/${group.toLowerCase(Locale.US)}#${rule.toLowerCase(Locale.US)}") {
a("$DETEKT_WEBSITE_BASE_URL/docs/rules/${group.lowercase(Locale.US)}#${rule.lowercase(Locale.US)}") {
+"Documentation"
}

Expand Down
Expand Up @@ -97,7 +97,7 @@ private fun MarkdownContent.renderRule(rule: String, group: String, findings: Li
paragraph {
link(
"Documentation",
"$DETEKT_WEBSITE_BASE_URL/docs/rules/${group.toLowerCase(Locale.US)}#${rule.toLowerCase(Locale.US)}"
"$DETEKT_WEBSITE_BASE_URL/docs/rules/${group.lowercase(Locale.US)}#${rule.lowercase(Locale.US)}"
)
}

Expand Down
Expand Up @@ -36,8 +36,8 @@ private fun MultiRule.toDescriptors(ruleSetId: RuleSetId): List<ReportingDescrip
this.rules.map { it.toDescriptor(ruleSetId) }

private fun Rule.toDescriptor(ruleSetId: RuleSetId): ReportingDescriptor {
val formattedRuleSetId = ruleSetId.toLowerCase(Locale.US)
val formattedRuleId = ruleId.toLowerCase(Locale.US)
val formattedRuleSetId = ruleSetId.lowercase(Locale.US)
val formattedRuleId = ruleId.lowercase(Locale.US)

return ReportingDescriptor(
id = "detekt.$ruleSetId.$ruleId",
Expand Down
Expand Up @@ -276,7 +276,7 @@ private object Xml10EscapeSymbolsInitializer {
}

private operator fun ByteArray.set(c: Char, value: Byte) {
set(c.toInt(), value)
set(c.code, value)
}

/**
Expand Down
Expand Up @@ -17,7 +17,7 @@ class XmlOutputReport : OutputReport() {
override val name = "Checkstyle XML report"

private val Finding.severityLabel: String
get() = severity.name.toLowerCase(Locale.US)
get() = severity.name.lowercase(Locale.US)

override fun render(detektion: Detektion): String {
val smells = detektion.findings.flatMap { it.value }
Expand Down
Expand Up @@ -178,7 +178,7 @@ class MagicNumber(config: Config = Config.empty) : Rule(config) {

private fun normalizeForParsingAsDouble(text: String): String {
return text.trim()
.toLowerCase(Locale.US)
.lowercase(Locale.US)
.replace("_", "")
.removeSuffix("l")
.removeSuffix("d")
Expand Down
Expand Up @@ -105,7 +105,7 @@ class UnderscoresInNumericLiterals(config: Config = Config.empty) : Rule(config)

private fun normalizeForMatching(text: String): String {
return text.trim()
.toLowerCase(Locale.ROOT)
.lowercase(Locale.ROOT)
.removeSuffix("l")
.removeSuffix("d")
.removeSuffix("f")
Expand Down

0 comments on commit 61b6406

Please sign in to comment.