From 1b751f8af39d44b8fa588b7d90a51834a6622e41 Mon Sep 17 00:00:00 2001 From: Tomasz Tylenda Date: Thu, 19 Dec 2024 18:16:14 +0100 Subject: [PATCH] minor --- .../org/sonar/java/checks/tests/IgnoredTestsCheck.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/java-checks/src/main/java/org/sonar/java/checks/tests/IgnoredTestsCheck.java b/java-checks/src/main/java/org/sonar/java/checks/tests/IgnoredTestsCheck.java index 5e63e10b99..25bb355391 100644 --- a/java-checks/src/main/java/org/sonar/java/checks/tests/IgnoredTestsCheck.java +++ b/java-checks/src/main/java/org/sonar/java/checks/tests/IgnoredTestsCheck.java @@ -60,13 +60,14 @@ public void visitNode(Tree tree) { getSilentlyIgnoredAnnotation(symbolMetadata, annotationName) .ifPresent( annotationTree -> { + String shortName = annotationTypeIdentifier(annotationName); String message = String.format( "Either add an explanation about why this test is skipped or remove the \"@%s\" annotation.", - annotationTypeIdentifier(annotationName) + shortName ); - List secondaryLocation = - Collections.singletonList(new JavaFileScannerContext.Location("Cause", annotationTree)); - context.reportIssue(this, methodTree.simpleName(), message, secondaryLocation, null); + JavaFileScannerContext.Location secondaryLocation = + new JavaFileScannerContext.Location(String.format("@%s annotation skips the test", shortName), annotationTree); + context.reportIssue(this, methodTree.simpleName(), message, Collections.singletonList(secondaryLocation), null); } ); }