优化:移除对org.sonar.java.ast.visitors.SubscriptionVisitor的依赖

wuhaoyang
Guo XIn 11 months ago
parent 241e23310e
commit d3a5f15271
  1. 4
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/checkers/HashSaltPassWordChecker.java
  2. 4
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/checkers/RSAEncryptionChecker.java
  3. 3
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/checkers/RedirectUrlChecker.java
  4. 4
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/checkers/SecurityCookieChecker.java
  5. 8
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/checkers/UploadFileVerifyChecker.java

@ -8,11 +8,11 @@ package com.keyware.sonar.java.rules.checkers;
import org.sonar.check.Rule; import org.sonar.check.Rule;
import org.sonar.java.ast.parser.ArgumentListTreeImpl; import org.sonar.java.ast.parser.ArgumentListTreeImpl;
import org.sonar.java.ast.visitors.SubscriptionVisitor;
import org.sonar.java.model.declaration.VariableTreeImpl; import org.sonar.java.model.declaration.VariableTreeImpl;
import org.sonar.java.model.expression.IdentifierTreeImpl; import org.sonar.java.model.expression.IdentifierTreeImpl;
import org.sonar.java.model.expression.MemberSelectExpressionTreeImpl; import org.sonar.java.model.expression.MemberSelectExpressionTreeImpl;
import org.sonar.java.model.expression.MethodInvocationTreeImpl; import org.sonar.java.model.expression.MethodInvocationTreeImpl;
import org.sonar.plugins.java.api.IssuableSubscriptionVisitor;
import org.sonar.plugins.java.api.tree.*; import org.sonar.plugins.java.api.tree.*;
import java.util.Collections; import java.util.Collections;
@ -25,7 +25,7 @@ import java.util.List;
* @date 2024/1/11 * @date 2024/1/11
*/ */
@Rule(key = "HashSaltPassWordChecker") @Rule(key = "HashSaltPassWordChecker")
public class HashSaltPassWordChecker extends SubscriptionVisitor { public class HashSaltPassWordChecker extends IssuableSubscriptionVisitor {
@Override @Override
public List<Tree.Kind> nodesToVisit() { public List<Tree.Kind> nodesToVisit() {

@ -8,9 +8,9 @@ package com.keyware.sonar.java.rules.checkers;
import org.sonar.check.Rule; import org.sonar.check.Rule;
import org.sonar.java.ast.parser.ArgumentListTreeImpl; import org.sonar.java.ast.parser.ArgumentListTreeImpl;
import org.sonar.java.ast.visitors.SubscriptionVisitor;
import org.sonar.java.model.InternalSyntaxToken; import org.sonar.java.model.InternalSyntaxToken;
import org.sonar.java.model.expression.LiteralTreeImpl; import org.sonar.java.model.expression.LiteralTreeImpl;
import org.sonar.plugins.java.api.IssuableSubscriptionVisitor;
import org.sonar.plugins.java.api.tree.*; import org.sonar.plugins.java.api.tree.*;
import java.util.Collections; import java.util.Collections;
@ -23,7 +23,7 @@ import java.util.List;
* @date 2024/1/11 * @date 2024/1/11
*/ */
@Rule(key = "RSAEncryptionChecker") @Rule(key = "RSAEncryptionChecker")
public class RSAEncryptionChecker extends SubscriptionVisitor { public class RSAEncryptionChecker extends IssuableSubscriptionVisitor {
@Override @Override
public List<Tree.Kind> nodesToVisit() { public List<Tree.Kind> nodesToVisit() {

@ -7,7 +7,6 @@
package com.keyware.sonar.java.rules.checkers; package com.keyware.sonar.java.rules.checkers;
import org.sonar.check.Rule; import org.sonar.check.Rule;
import org.sonar.java.ast.visitors.SubscriptionVisitor;
import org.sonar.plugins.java.api.IssuableSubscriptionVisitor; import org.sonar.plugins.java.api.IssuableSubscriptionVisitor;
import org.sonar.plugins.java.api.tree.*; import org.sonar.plugins.java.api.tree.*;
@ -111,7 +110,7 @@ public class RedirectUrlChecker extends IssuableSubscriptionVisitor {
} }
static class RedirectViewCheckVisitor extends SubscriptionVisitor { static class RedirectViewCheckVisitor extends IssuableSubscriptionVisitor {
private final RedirectUrlChecker checker; private final RedirectUrlChecker checker;
// 方法的参数列表 // 方法的参数列表
private final List<? extends VariableTree> methodParameters; private final List<? extends VariableTree> methodParameters;

@ -7,7 +7,7 @@
package com.keyware.sonar.java.rules.checkers; package com.keyware.sonar.java.rules.checkers;
import org.sonar.check.Rule; import org.sonar.check.Rule;
import org.sonar.java.ast.visitors.SubscriptionVisitor; import org.sonar.plugins.java.api.IssuableSubscriptionVisitor;
import org.sonar.plugins.java.api.tree.*; import org.sonar.plugins.java.api.tree.*;
import java.util.Collections; import java.util.Collections;
@ -20,7 +20,7 @@ import java.util.List;
* @date 2024/1/10 * @date 2024/1/10
*/ */
@Rule(key = "SecurityCookieChecker") @Rule(key = "SecurityCookieChecker")
public class SecurityCookieChecker extends SubscriptionVisitor { public class SecurityCookieChecker extends IssuableSubscriptionVisitor {
@Override @Override
public List<Tree.Kind> nodesToVisit() { public List<Tree.Kind> nodesToVisit() {

@ -7,7 +7,7 @@
package com.keyware.sonar.java.rules.checkers; package com.keyware.sonar.java.rules.checkers;
import org.sonar.check.Rule; import org.sonar.check.Rule;
import org.sonar.java.ast.visitors.SubscriptionVisitor; import org.sonar.plugins.java.api.IssuableSubscriptionVisitor;
import org.sonar.plugins.java.api.tree.*; import org.sonar.plugins.java.api.tree.*;
import java.util.Collections; import java.util.Collections;
@ -21,7 +21,7 @@ import java.util.List;
*/ */
@Rule(key = "UploadFileVerify") @Rule(key = "UploadFileVerify")
public class UploadFileVerifyChecker extends SubscriptionVisitor { public class UploadFileVerifyChecker extends IssuableSubscriptionVisitor {
@Override @Override
public List<Tree.Kind> nodesToVisit() { public List<Tree.Kind> nodesToVisit() {
/** /**
@ -79,7 +79,7 @@ public class UploadFileVerifyChecker extends SubscriptionVisitor {
} }
// 內部文件名称类型获取类 // 內部文件名称类型获取类
private class InteriorInvoIf extends SubscriptionVisitor{ private class InteriorInvoIf extends IssuableSubscriptionVisitor{
// 文件全名字 // 文件全名字
public String fileName = ""; public String fileName = "";
// 文件后缀名 // 文件后缀名
@ -143,7 +143,7 @@ public class UploadFileVerifyChecker extends SubscriptionVisitor {
} }
public class NodeIf extends SubscriptionVisitor{ public class NodeIf extends IssuableSubscriptionVisitor{
private String name; private String name;
public boolean boo = true; public boolean boo = true;

Loading…
Cancel
Save