优化:增加判断方式

wuhaoyang
RenFengJiang 10 months ago
parent 9f5710ea29
commit a6bac91163
  1. 10
      sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/CmdDataVerifyChecker.java
  2. 9
      sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/SQLVerifyChecker.java

@ -76,11 +76,13 @@ public class CmdDataVerifyChecker extends SquidCheck<Grammar> {
for (AstNode expr:astNodeList) {
lists.add(expr.getToken().getValue());
}
if(astNodeList.size() == 0){
List<AstNode> descendants = astNode.getDescendants(CxxGrammarImpl.condition);
for (AstNode desc:descendants) {
lists.add(desc.getToken().getValue());
List<AstNode> astNodes = astNode.getDescendants(CxxGrammarImpl.relationalExpression);
for (AstNode as:astNodes) {
List<AstNode> children = as.getChildren();
for (AstNode chil:children) {
lists.add(chil.getTokenValue());
}
}
}
}

@ -77,9 +77,12 @@ public class SQLVerifyChecker extends SquidCheck<Grammar> {
lists.add(expr.getToken().getValue());
}
if(astNodeList.size() == 0){
List<AstNode> descendants = astNode.getDescendants(CxxGrammarImpl.condition);
for (AstNode desc:descendants) {
lists.add(desc.getToken().getValue());
List<AstNode> astNodes = astNode.getDescendants(CxxGrammarImpl.relationalExpression);
for (AstNode as:astNodes) {
List<AstNode> children = as.getChildren();
for (AstNode chil:children) {
lists.add(chil.getTokenValue());
}
}
}
}

Loading…
Cancel
Save