Skip to content

Commit a3814fe

Browse files
jgardn3rcirras
authored andcommitted
Fix sonar issues in RedundantInheritedCheck
This change: - Removes unnecessary parentheses - Replaces a lambda with a method reference - Changed the type of an `int` expression to `long`
1 parent 9742248 commit a3814fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

delphi-checks/src/main/java/au/com/integradev/delphi/checks/RedundantInheritedCheck.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private static boolean isSemicolon(DelphiNode node) {
100100
private static DelphiNode getLastStatementToken(
101101
StatementListNode statementListNode, DelphiNode node) {
102102
return statementListNode.getChildren().stream()
103-
.skip(node.getChildIndex() + 1)
103+
.skip(node.getChildIndex() + 1L)
104104
.takeWhile(RedundantInheritedCheck::isSemicolon)
105105
.reduce((first, second) -> second)
106106
.orElse(node);
@@ -124,8 +124,8 @@ private static List<DelphiNode> findViolations(RoutineImplementationNode routine
124124
}
125125

126126
return statements.stream()
127-
.filter((statement) -> statement instanceof ExpressionStatementNode)
128-
.map((statement) -> ((ExpressionStatementNode) statement).getExpression())
127+
.filter(ExpressionStatementNode.class::isInstance)
128+
.map(statement -> ((ExpressionStatementNode) statement).getExpression())
129129
.filter(ExpressionNodeUtils::isBareInherited)
130130
.collect(Collectors.toList());
131131
}

0 commit comments

Comments
 (0)