Improve issue message

This commit is contained in:
Brais Gabín
2022-06-04 12:55:38 +02:00
committed by Brais
parent f79b375c0e
commit 1a3057f264
2 changed files with 4 additions and 4 deletions

View File

@@ -88,7 +88,7 @@ class ForbiddenMethodCall(config: Config = Config.empty) : Rule(config) {
for (descriptor in descriptors) {
methods.find { it.match(descriptor) }?.let { functionMatcher ->
val message = "The method $functionMatcher has been forbidden in the Detekt config."
val message = "The method `$functionMatcher` has been forbidden in the Detekt config."
report(CodeSmell(issue, Entity.from(expression), message))
}
}

View File

@@ -28,8 +28,8 @@ class ForbiddenMethodCallSpec(val env: KotlinCoreEnvironment) {
SourceLocation(2, 5),
SourceLocation(3, 5)
)
assertThat(findings[0]).hasMessage("The method kotlin.io.print has been forbidden in the Detekt config.")
assertThat(findings[1]).hasMessage("The method kotlin.io.println has been forbidden in the Detekt config.")
assertThat(findings[0]).hasMessage("The method `kotlin.io.print` has been forbidden in the Detekt config.")
assertThat(findings[1]).hasMessage("The method `kotlin.io.println` has been forbidden in the Detekt config.")
}
@Test
@@ -204,7 +204,7 @@ class ForbiddenMethodCallSpec(val env: KotlinCoreEnvironment) {
).compileAndLintWithContext(env, code)
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.")
assertThat(findings[0]).hasMessage("The method `java.time.LocalDate.now()` has been forbidden in the Detekt config.")
}
@Test