新增“程序设计时禁止动态构建代码进行功能实现”准则

wuhaoyang
renfengshan 10 months ago
parent be630738d5
commit ea351ac386
  1. 7
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/checkers/DynamicCodeChecker.java

@ -12,18 +12,13 @@ import java.util.Collections;
import java.util.List; import java.util.List;
@Rule(key = "SessionExpirationDateChecker") @Rule(key = "DynamicCodeChecker")
//检测代码中包含动态代码执行操作时,工具进行提示 //检测代码中包含动态代码执行操作时,工具进行提示
public class DynamicCodeChecker extends SubscriptionVisitor { public class DynamicCodeChecker extends SubscriptionVisitor {
@Override @Override
public List<Tree.Kind> nodesToVisit() { public List<Tree.Kind> nodesToVisit() {
/**
* Tree.Kind.METHOD方法节点
* Tree.Kind.BLOCK方法的代码块节点
* Tree.Kind.METHOD_INVOCATION 方法的调用节点
*/
return Collections.singletonList( return Collections.singletonList(
Tree.Kind.METHOD_INVOCATION Tree.Kind.METHOD_INVOCATION
); );

Loading…
Cancel
Save