|
|
@ -42,7 +42,7 @@ public class NumericalCopyChecker extends SquidCheck<Grammar> {//当私有数组 |
|
|
|
for (AstNode ast : descendan) { |
|
|
|
for (AstNode ast : descendan) { |
|
|
|
List<AstNode> descendants = ast.getDescendants(CxxGrammarImpl.expression); |
|
|
|
List<AstNode> descendants = ast.getDescendants(CxxGrammarImpl.expression); |
|
|
|
for (AstNode des : descendants) { |
|
|
|
for (AstNode des : descendants) { |
|
|
|
if ("return".equals(des.getParent().getTokenValue())){ |
|
|
|
if ("return".equals(des.getParent().getTokenValue()) || des.getTokenValue().contains("0")){ |
|
|
|
if (lists.contains(des.getTokenValue())) { |
|
|
|
if (lists.contains(des.getTokenValue())) { |
|
|
|
getContext().createLineViolation(this, "应返回该私有数值的副本", des); |
|
|
|
getContext().createLineViolation(this, "应返回该私有数值的副本", des); |
|
|
|
} |
|
|
|
} |
|
|
|