Fix violations of UnnecessaryVarargsArrayCreation

This commit is contained in:
Clément Fournier
2024-04-21 13:31:27 +02:00
parent 34e0b217a2
commit 75e284075b
14 changed files with 34 additions and 42 deletions

View File

@@ -210,8 +210,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule {
classEntry.getComplexityAverage(), classEntry.highestDecisionPoints);
if (showClassesComplexity) {
if (classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel) {
asCtx(data).addViolation(node, new String[] { "class", node.getImage(),
classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')', });
asCtx(data).addViolation(node, "class", node.getImage(),
classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')');
}
}
return data;
@@ -227,8 +227,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule {
classEntry.highestDecisionPoints);
if (showClassesComplexity) {
if (classEntry.getComplexityAverage() >= reportLevel || classEntry.highestDecisionPoints >= reportLevel) {
asCtx(data).addViolation(node, new String[] { "class", node.getImage(),
classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')', });
asCtx(data).addViolation(node, "class", node.getImage(),
classEntry.getComplexityAverage() + " (Highest = " + classEntry.highestDecisionPoints + ')');
}
}
return data;
@@ -276,8 +276,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule {
ASTMethodDeclarator methodDeclarator = node.firstChild(ASTMethodDeclarator.class);
if (methodEntry.decisionPoints >= reportLevel) {
asCtx(data).addViolation(node,
new String[] { "method", methodDeclarator == null ? "" : methodDeclarator.getImage(),
String.valueOf(methodEntry.decisionPoints), });
"method", methodDeclarator == null ? "" : methodDeclarator.getImage(),
String.valueOf(methodEntry.decisionPoints));
}
}
return data;
@@ -306,8 +306,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule {
ASTMethodDeclarator methodDeclarator = node.firstChild(ASTMethodDeclarator.class);
if (methodEntry.decisionPoints >= reportLevel) {
asCtx(data).addViolation(node,
new String[] { "method", methodDeclarator == null ? "" : methodDeclarator.getImage(),
String.valueOf(methodEntry.decisionPoints), });
"method", methodDeclarator == null ? "" : methodDeclarator.getImage(),
String.valueOf(methodEntry.decisionPoints));
}
}
return data;
@@ -334,8 +334,8 @@ public class CyclomaticComplexityRule extends AbstractPLSQLRule {
ASTMethodDeclarator methodDeclarator = node.firstChild(ASTMethodDeclarator.class);
if (methodEntry.decisionPoints >= reportLevel) {
asCtx(data).addViolation(node,
new String[] { "method", methodDeclarator == null ? "" : methodDeclarator.getImage(),
String.valueOf(methodEntry.decisionPoints), });
"method", methodDeclarator == null ? "" : methodDeclarator.getImage(),
String.valueOf(methodEntry.decisionPoints));
}
}
return data;