Skip to content

Commit 29760c8

Browse files
committed
Fix sonar issues in test code
1 parent 3399616 commit 29760c8

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

delphi-checks/src/test/java/au/com/integradev/delphi/checks/ForbiddenIdentifierCheckTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.sonar.plugins.communitydelphi.api.check.DelphiCheck;
2525

2626
class ForbiddenIdentifierCheckTest {
27-
private static String FORBIDDEN_IDENTIFIER = "BadName";
27+
private static final String FORBIDDEN_IDENTIFIER = "BadName";
2828

2929
private static DelphiCheck createCheck() {
3030
ForbiddenIdentifierCheck check = new ForbiddenIdentifierCheck();

delphi-frontend/src/test/java/au/com/integradev/delphi/antlr/ast/DelphiNodeUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public final class DelphiNodeUtils {
5555

5656
public static final DescribedPredicate<JavaClass> IMPLEMENT_ACCEPT =
5757
new DescribedPredicate<>("have a method that implements accept(DelphiParserVisitor, T)") {
58-
private final Class<?>[] ACCEPT_PARAMETERS = {DelphiParserVisitor.class, Object.class};
58+
private final Class<?>[] acceptParameters = {DelphiParserVisitor.class, Object.class};
5959

6060
@Override
6161
public boolean test(JavaClass javaClass) {
@@ -65,14 +65,14 @@ public boolean test(JavaClass javaClass) {
6565
private boolean isAcceptMethodImplementation(JavaMethod javaMethod) {
6666
Method method = javaMethod.reflect();
6767
return method.getName().equals("accept")
68-
&& Arrays.equals(method.getParameterTypes(), ACCEPT_PARAMETERS)
68+
&& Arrays.equals(method.getParameterTypes(), acceptParameters)
6969
&& !Modifier.isAbstract(method.getModifiers());
7070
}
7171
};
7272

7373
public static final ArchCondition<JavaClass> HAVE_TOKEN_CONSTRUCTOR =
7474
new ArchCondition<>("have a public constructor(Token)") {
75-
private final Class<?>[] TOKEN_PARAMETER = {Token.class};
75+
private final Class<?>[] tokenParameter = {Token.class};
7676

7777
@Override
7878
public void check(JavaClass javaClass, ConditionEvents events) {
@@ -81,7 +81,7 @@ public void check(JavaClass javaClass, ConditionEvents events) {
8181
.map(JavaConstructor::reflect)
8282
.anyMatch(
8383
constructor ->
84-
Arrays.equals(constructor.getParameterTypes(), TOKEN_PARAMETER));
84+
Arrays.equals(constructor.getParameterTypes(), tokenParameter));
8585

8686
String message =
8787
javaClass

delphi-frontend/src/test/java/au/com/integradev/delphi/symbol/resolve/InvocationResolverTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ void testIntegerTypes() {
166166
assertResolved(type(INTEGER), type(WORD), type(BYTE));
167167
assertResolved(type(SHORTINT), type(NATIVEINT), type(NATIVEUINT));
168168

169-
Type HWND = FACTORY.strongAlias("HWND", type(NATIVEUINT));
169+
Type hwnd = FACTORY.strongAlias("HWND", type(NATIVEUINT));
170170
assertResolved(
171-
List.of(HWND, type(NATIVEUINT), type(SHORTINT), type(SHORTINT)),
172-
List.of(HWND, type(NATIVEUINT), type(NATIVEINT), type(NATIVEINT)),
173-
List.of(HWND, type(NATIVEUINT), type(NATIVEUINT), type(NATIVEINT)));
171+
List.of(hwnd, type(NATIVEUINT), type(SHORTINT), type(SHORTINT)),
172+
List.of(hwnd, type(NATIVEUINT), type(NATIVEINT), type(NATIVEINT)),
173+
List.of(hwnd, type(NATIVEUINT), type(NATIVEUINT), type(NATIVEINT)));
174174

175175
assertResolved(type(BYTE), type(INTEGER), type(DOUBLE));
176176

delphi-frontend/src/test/java/au/com/integradev/delphi/symbol/resolve/OperatorOverloadResolutionTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ private static Type getType(String name) {
421421
return ((TypeFactoryImpl) TYPE_FACTORY).anonymousUInt31();
422422
case "Extended":
423423
return TYPE_FACTORY.getIntrinsic(IntrinsicType.EXTENDED);
424+
default:
425+
// do nothing
424426
}
425427

426428
if (name.endsWith("_Subrange")) {

its/src/test/java/au/com/integradev/delphi/IntegrationTestSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class IntegrationTestSuite {
4848
new File("../sonar-delphi-plugin/target"), "sonar-delphi-plugin-*.jar");
4949

5050
@RegisterExtension
51-
static OrchestratorExtension ORCHESTRATOR =
51+
static final OrchestratorExtension ORCHESTRATOR =
5252
OrchestratorExtension.builderEnv()
5353
.useDefaultAdminCredentialsForBuilds(true)
5454
.setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE"))

0 commit comments

Comments
 (0)