Skip to content

Commit

Permalink
Update detekt-rules-style/src/main/kotlin/io/gitlab/arturbosch/detekt…
Browse files Browse the repository at this point in the history
…/rules/style/ForbiddenMethodCall.kt

Co-authored-by: schalkms <30376729+schalkms@users.noreply.github.com>
  • Loading branch information
BraisGabin and schalkms committed Jul 23, 2022
1 parent eb9a7c0 commit ae4f246
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Expand Up @@ -62,7 +62,7 @@ class ForbiddenImport(config: Config = Config.empty) : Rule(config) {
}

private fun defaultReason(forbiddenImport: String): String {
return "The import `$forbiddenImport` has been forbidden in the Detekt config."
return "The import `$forbiddenImport` has been forbidden in the detekt config."
}

private fun containsForbiddenPattern(import: String): Boolean =
Expand Down
Expand Up @@ -121,7 +121,7 @@ class ForbiddenMethodCall(config: Config = Config.empty) : Rule(config) {
val message = if (forbidden.reason != null) {
"The method `${forbidden.value}` has been forbidden: ${forbidden.reason}"
} else {
"The method `${forbidden.value}` has been forbidden in the Detekt config."
"The method `${forbidden.value}` has been forbidden in the detekt config."
}
report(CodeSmell(issue, Entity.from(expression), message))
}
Expand Down
Expand Up @@ -48,8 +48,8 @@ class ForbiddenImportSpec {
assertThat(findings)
.extracting("message")
.containsExactlyInAnyOrder(
"The import `kotlin.jvm.JvmField` has been forbidden in the Detekt config.",
"The import `kotlin.SinceKotlin` has been forbidden in the Detekt config.",
"The import `kotlin.jvm.JvmField` has been forbidden in the detekt config.",
"The import `kotlin.SinceKotlin` has been forbidden in the detekt config.",
)
}

Expand Down Expand Up @@ -133,8 +133,8 @@ class ForbiddenImportSpec {
ForbiddenImport(TestConfig(mapOf(FORBIDDEN_PATTERNS to "net.*R|com.*expiremental"))).lint(code)
assertThat(findings).hasSize(2)
assertThat(findings[0].message)
.isEqualTo("The import `net.example.R.dimen` has been forbidden in the Detekt config.")
.isEqualTo("The import `net.example.R.dimen` has been forbidden in the detekt config.")
assertThat(findings[1].message)
.isEqualTo("The import `net.example.R.dimension` has been forbidden in the Detekt config.")
.isEqualTo("The import `net.example.R.dimension` has been forbidden in the detekt config.")
}
}
Expand Up @@ -192,7 +192,7 @@ class ForbiddenMethodCallSpec(val env: KotlinCoreEnvironment) {
assertThat(findings).hasSize(1)
assertThat(findings).hasSourceLocation(5, 26)
assertThat(findings[0])
.hasMessage("The method `java.time.LocalDate.now()` has been forbidden in the Detekt config.")
.hasMessage("The method `java.time.LocalDate.now()` has been forbidden in the detekt config.")
}

@Test
Expand Down

0 comments on commit ae4f246

Please sign in to comment.