mirror of
https://github.com/jlengrand/detekt.git
synced 2026-03-10 08:11:23 +00:00
Improve issue message
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user