• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AstNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sonar.sslr.api.AstNode的典型用法代码示例。如果您正苦于以下问题:Java AstNode类的具体用法?Java AstNode怎么用?Java AstNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AstNode类属于com.sonar.sslr.api包,在下文中一共展示了AstNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
/**
 * It is responsible for verifying whether the rule is met in the rule base.
 * In the event that the rule is not correct, create message error.
 *
 * @param astNode It is the node that stores all the rules.
 */
@Override
public void visitNode(AstNode astNode) {
    try {
        AstNode classDeclaration = getClassDeclaration(astNode);
        if (!TestClassCheck.hasTestAnnotation(classDeclaration)) {
            AstNode member = astNode.getParent();
            List<AstNode> modifiers = member.getFirstChild(ApexGrammarRuleKey.MODIFIERS).getChildren();
            for (AstNode modifier : modifiers) {
                if (modifier.is(ApexKeyword.TESTMETHOD)) {
                    AstNode methodName = astNode.getFirstChild(ApexGrammarRuleKey.METHOD_IDENTIFIER)
                            .getFirstChild(ApexGrammarRuleKey.ALLOWED_KEYWORDS_AS_IDENTIFIER,
                                    ApexGrammarRuleKey.ALLOWED_KEYWORDS_AS_IDENTIFIER_FOR_METHODS,
                                    ApexGrammarRuleKey.SPECIAL_KEYWORDS_AS_IDENTIFIER);
                    getContext().createLineViolation(this,
                            ChecksBundle.getStringFromBundle("TestMethodsCheckMessage"),
                            astNode, methodName.getTokenOriginalValue(),
                            classDeclaration.getFirstChild(ApexGrammarRuleKey.COMMON_IDENTIFIER).getTokenOriginalValue());
                }
            }
        }
    } catch (Exception e) {
        ChecksLogger.logCheckError(this.toString(), "visitNode", e.toString());
    }
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:31,代码来源:TestMethodInTestClassCheck.java


示例2: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
/**
 * Verifies if the given node met the rule, in case it does not it creates
 * the error
 *
 * @param astNode the node to be analyzed.
 */
@Override
public void visitNode(AstNode astNode) {
    try {
        List<AstNode> statements = astNode.getDescendants(STATEMENT);
        for (AstNode statement : statements) {
            boolean hasAssertion = hasAssertion(statement.getDescendants(NAME), SYSTEM_ASSERT);
            if (hasAssertion && !hasBooleanVariable(astNode)) {
                getContext().createLineViolation(this,
                        ChecksBundle.getStringFromBundle("AssertBooleanVariableMessage"),
                        astNode, astNode.getFirstChild(METHOD_IDENTIFIER).getTokenOriginalValue());
            }
        }
    } catch (Exception e) {
        ChecksLogger.logCheckError(this.toString(), "visitNode", e.toString());
    }
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:23,代码来源:BooleanParamentersOnAssertCheck.java


示例3: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
/**
 * It is responsible for verifying whether the rule is met in the rule base.
 * In the event that the rule is not correct, create message error.
 *
 * @param astNode It is the node that stores all the rules.
 */
@Override
public void visitNode(AstNode astNode) {
    try {
        int startCalls = 0;
        int stopCalls = 0;
        List<AstNode> expressions = astNode.getDescendants(ApexGrammarRuleKey.PRIMARY_EXPRESSION);
        for (AstNode expression : expressions) {
            if (isTestMethodCall(expression, START)) {
                startCalls++;
            }
            if (isTestMethodCall(expression, STOP)) {
                stopCalls++;
            }
            if (startCalls > MAX_ALLOWED_INSTANCES || stopCalls > MAX_ALLOWED_INSTANCES) {
                getContext().createLineViolation(this,
                        MESSAGE, astNode,
                        astNode.getFirstDescendant(ApexGrammarRuleKey.METHOD_IDENTIFIER).getTokenOriginalValue());
                return;
            }
        }
    } catch (Exception e) {
        ChecksLogger.logCheckError(this.toString(), "visitNode", e.toString());
    }
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:31,代码来源:StartAndStopCheck.java


示例4: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
/**
 * It is responsible for verifying whether the rule is met in the rule base.
 * In the event that the rule is not correct, create message error.
 *
 * @param astNode It is the node that stores all the rules.
 */
@Override
public void visitNode(AstNode astNode) {
    try {
        AstNode identifier = astNode.getFirstDescendant(ApexGrammarRuleKey.ALLOWED_KEYWORDS_AS_IDENTIFIER,
                ApexGrammarRuleKey.SPECIAL_KEYWORDS_AS_IDENTIFIER);
        if (hasTestAnnotation(astNode)) {
            if (astNode.is(ApexGrammarRuleKey.ENUM_DECLARATION)
                    || astNode.getFirstDescendant(ApexGrammarRuleKey.TYPE_CLASS).hasDirectChildren(ApexKeyword.INTERFACE)) {
                getContext().createLineViolation(this,
                        ANNOTATION_MESSAGE,
                        astNode, identifier.getTokenOriginalValue());
            }
        } else if (identifier.getTokenValue().contains(TEST)) {
            getContext().createLineViolation(this,
                    NAME_MESSAGE,
                    astNode, identifier.getTokenOriginalValue());
        }
    } catch (Exception e) {
        ChecksLogger.logCheckError(this.toString(), "visitNode", e.toString());
    }
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:28,代码来源:TestClassCheck.java


示例5: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Override
public void visitNode(AstNode astNode) {
    boolean hasTestMethodKeyword = hasTestMethodKeyword(astNode.getParent());
    List<AstNode> nameNodes = astNode.getDescendants(NAME);
    boolean hasAssertion = hasAssertion(nameNodes, SYSTEM_ASSERT_PATTERN);
    if (hasTestMethodKeyword && !hasAssertion) {
        getContext().createLineViolation(this,
                String.format(ChecksBundle.getStringFromBundle("AssertionError"),
                        astNode.getFirstDescendant(METHOD_IDENTIFIER).getTokenOriginalValue()), astNode);
    }
    if (!hasTestMethodKeyword && hasAssertion) {
        getContext().createLineViolation(this,
                String.format(ChecksBundle.getStringFromBundle("TestMethodKeywordError"),
                        astNode.getFirstDescendant(METHOD_IDENTIFIER).getTokenOriginalValue()), astNode);
    }
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:17,代码来源:TestAssertionsAndTestMethodKeywordCheck.java


示例6: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
/**
 * It is responsible for verifying whether the rule is met in the rule base.
 * In the event that the rule is not correct, create message error.
 *
 * @param astNode It is the node that stores all the rules.
 */
@Override
public void visitNode(AstNode astNode) {
    try {
        AstNode nodeToCheck = astNode;
        if(SoqlParser.isStringQuery(astNode)){
            AstNode parsedQuery = SoqlParser.parseQuery(astNode);
            if(parsedQuery != null) {
                nodeToCheck = parsedQuery;
            }
        }

        if (nodeToCheck.is(ApexGrammarRuleKey.QUERY_EXPRESSION) && !nodeToCheck.hasDescendant(ApexGrammarRuleKey.LIMIT_SENTENCE)) {
            getContext().createLineViolation(this, MESSAGE, astNode);
        }
    } catch (Exception e) {
        ChecksLogger.logCheckError(this.toString(), "visitNode", e.toString());
    }
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:25,代码来源:SoqlLimitCheck.java


示例7: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
/**
 * It is responsible for verifying whether the rule is met in the rule base.
 * In the event that the rule is not correct, create message error.
 *
 * @param astNode It is the node that stores all the rules.
 */
@Override
public void visitNode(AstNode astNode) {
    try {
        AstNode modifierNode = null;
        if (astNode.hasParent(ApexGrammarRuleKey.TYPE_DECLARATION)) {
            modifierNode = astNode.getParent().getFirstChild(ApexGrammarRuleKey.MODIFIERS);
            if (!isAnnotation(modifierNode, IS_TEST)) {
                List<AstNode> methods = astNode.getDescendants(ApexGrammarRuleKey.METHOD_DECLARATION);
                methods.stream().forEach((method) -> {
                    AstNode parent = method.getParent();
                    AstNode firstChild = parent.getFirstDescendant(ApexGrammarRuleKey.MODIFIERS);
                    if (isTest(firstChild)) {
                        getContext().createLineViolation(this, methodMessage(method), method);
                    }
                });
            }
        }
    } catch (Exception e) {
        ChecksLogger.logCheckError(this.toString(), "visitNode", e.toString());
    }
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:28,代码来源:TestMethodCheck.java


示例8: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
/**
 * It is responsible for verifying whether the rule is met in the rule base.
 * In the event that the rule is not correct, create message error.
 *
 * @param astNode It is the node that stores all the rules.
 */
@Override
public void visitNode(AstNode astNode) {
    try {
        AstNode parent = astNode.getParent();
        AstNode modifiersNode = parent.getFirstDescendant(ApexGrammarRuleKey.MODIFIERS);
        AstNode blockNode = astNode.getFirstDescendant(ApexGrammarRuleKey.BLOCK);
        if (isDeprecated(modifiersNode) && !isEmptyBlock(blockNode)) {
            AstNode method = astNode.getFirstDescendant(ApexGrammarRuleKey.METHOD_IDENTIFIER);
            getContext().createLineViolation(this, String.format(MESSAGE,
                    method.getTokenOriginalValue()), method);
        }
    } catch (Exception e) {
        ChecksLogger.logCheckError(this.toString(), "visitNode", e.toString());
    }
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:22,代码来源:DeprecatedMethodCheck.java


示例9: methodIsAsync

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
/**
 * Determines if a method is Async by looking for the "@future" amongst it's
 * annotations.
 *
 * @param astNode the node of the loop statement.
 * @param methodName the name of the method.
 * @return True if the method has the "@future" annotation.
 */
private boolean methodIsAsync(AstNode astNode, String methodName) {
    AstNode firstAncestor = astNode.getFirstAncestor(ApexGrammarRuleKey.TYPE_DECLARATION);
    List<AstNode> methods = firstAncestor.getDescendants(ApexGrammarRuleKey.METHOD_DECLARATION);
    if (!methods.isEmpty()) {
        for (AstNode method : methods) {
            String name = method.getFirstChild(ApexGrammarRuleKey.METHOD_IDENTIFIER).getTokenValue();
            if (name.equals(methodName)) {
                AstNode member = method.getFirstAncestor(ApexGrammarRuleKey.CLASS_OR_INTERFACE_MEMBER);
                AstNode modifiers = member.getFirstChild(ApexGrammarRuleKey.MODIFIERS);
                if (modifiers.hasDescendant(ApexGrammarRuleKey.ANNOTATION)) {
                    List<AstNode> annotations = modifiers.getChildren(ApexGrammarRuleKey.ANNOTATION);
                    for (AstNode annotation : annotations) {
                        String annotationValue = annotation.getFirstChild(ApexGrammarRuleKey.NAME).getTokenValue();
                        if (annotationValue.equalsIgnoreCase(FUTURE)) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:32,代码来源:AsyncMethodsCheck.java


示例10: testHasAssertionValidCase

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Test
public void testHasAssertionValidCase() {
    List<AstNode> nameNodes = new LinkedList<>();
    List<AstNode> children = new LinkedList<>();

    AstNode systemNodeMock = mock(AstNode.class);
    when(systemNodeMock.getTokenOriginalValue()).thenReturn("System");
    nameNodes.add(systemNodeMock);

    AstNode dotNodeMock = mock(AstNode.class);
    when(dotNodeMock.getTokenOriginalValue()).thenReturn(".");

    AstNode assertEqualsNodeMock = mock(AstNode.class);
    when(assertEqualsNodeMock.getTokenOriginalValue()).thenReturn("assertEquals");

    children.add(systemNodeMock);
    children.add(dotNodeMock);
    children.add(assertEqualsNodeMock);
    when(systemNodeMock.getChildren()).thenReturn(children);
    assertTrue(MethodChecksUtils.hasAssertion(nameNodes, SYSTEM_ASSERT_PATTERN));
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:22,代码来源:MethodChecksUtilsTest.java


示例11: testHasTestMethodKeywordNotMatchesTestMethodPattern

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Test
public void testHasTestMethodKeywordNotMatchesTestMethodPattern() {
    AstNode astNode = mock(AstNode.class);
    AstNode modifier = mock(AstNode.class);
    AstNode notTestMethodNode = mock(AstNode.class);

    List<AstNode> modifiers = new LinkedList<>();
    List<AstNode> modifierChildren = new LinkedList<>();

    when(notTestMethodNode.getTokenOriginalValue()).thenReturn("somethingElse");
    modifierChildren.add(notTestMethodNode);
    when(modifier.getChildren()).thenReturn(modifierChildren);
    modifiers.add(modifier);

    when(astNode.getChildren(MODIFIERS)).thenReturn(modifiers);
    assertFalse(MethodChecksUtils.hasTestMethodKeyword(astNode));
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:18,代码来源:MethodChecksUtilsTest.java


示例12: testHasTestMethodKeywordMatchesTestMethodPattern

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Test
public void testHasTestMethodKeywordMatchesTestMethodPattern() {
    AstNode astNode = mock(AstNode.class);
    AstNode modifier = mock(AstNode.class);
    AstNode notTestMethodNode = mock(AstNode.class);

    List<AstNode> modifiers = new LinkedList<>();
    List<AstNode> modifierChildren = new LinkedList<>();

    when(notTestMethodNode.getTokenOriginalValue()).thenReturn("testMethod");
    modifierChildren.add(notTestMethodNode);
    when(modifier.getChildren()).thenReturn(modifierChildren);
    modifiers.add(modifier);

    when(astNode.getChildren(MODIFIERS)).thenReturn(modifiers);
    assertTrue(MethodChecksUtils.hasTestMethodKeyword(astNode));
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:18,代码来源:MethodChecksUtilsTest.java


示例13: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Override
public void visitNode(AstNode astNode) {
	AstNode mainNode = getContent(astNode).getFirstChild(FlowGrammar.SEQUENCE);
	String mainType = getSequenceType(mainNode);
	if (mainType != null && mainType.equalsIgnoreCase("SUCCESS")) {
		AstNode tryNode = getContent(mainNode).getFirstChild(FlowGrammar.SEQUENCE);
		String tryType = getSequenceType(tryNode);
		if (tryType != null && tryType.equalsIgnoreCase("FAILURE")) {
			AstNode catchNode = getContent(mainNode).getLastChild(FlowGrammar.SEQUENCE);
			String catchType = getSequenceType(catchNode);
			if (catchType != null && catchType.equalsIgnoreCase("DONE")) {
				return;
			}
		}
	}
	getContext().createLineViolation(this, "Create try-catch sequence", astNode);
}
 
开发者ID:I8C,项目名称:sonar-flow-plugin,代码行数:18,代码来源:TryCatchCheck.java


示例14: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Override
public void visitNode(AstNode astNode) {
	AstNode exitNode = astNode.getFirstChild(FlowGrammar.ATTRIBUTES);
	if (exitNode != null){
		logger.debug("++ Exit interface element found. ++");
		String exitFrom = getExitFrom(exitNode);
		if (exitFrom == null || exitFrom.trim().equals("")) {
			logger.debug("++ \"Exit from\" property found to be empty! ++");
			getContext().createLineViolation(this, "The \"Exit from\" "
			+ "property must be defined for the interface element 'EXIT'", exitNode);
		}
		if (hasSignalSetToFailure(exitNode)) {
			String exitFailureMessage = getExitFailureMessage(exitNode);
			if (exitFailureMessage == null || exitFailureMessage.trim().equals("")) {
				logger.debug("++ Failure message has not been set even though"
						+ " the signal status has been set to failure! ++");
				getContext().createLineViolation(this, "Create a Failure message"
						+ " for the interface element 'EXIT'." , exitNode);
			}
		}
	}
}
 
开发者ID:I8C,项目名称:sonar-flow-plugin,代码行数:23,代码来源:ExitCheck.java


示例15: hasSignalSetToFailure

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
private Boolean hasSignalSetToFailure(AstNode exitNode) {
	if (exitNode != null) {
		AstNode signalAtt = exitNode.getFirstChild(FlowAttTypes.SIGNAL);
		if (signalAtt != null){
			logger.debug("++ Signal found ++");
			String signalValue = signalAtt.getToken().getOriginalValue();
			if (signalValue != null){
				if (signalValue.equalsIgnoreCase("FAILURE")){
					logger.debug("++ Signal is set to FAILURE! ++");
					return true;
				}
			}
		}
	}
	return false;
}
 
开发者ID:I8C,项目名称:sonar-flow-plugin,代码行数:17,代码来源:ExitCheck.java


示例16: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Override
public void visitNode(AstNode astNode) {
	List<AstNode> flowChildren = astNode.getChildren();
	for (AstNode child:flowChildren) {
		if (child.getName().equalsIgnoreCase("CONTENT")){
			List<AstNode> contentChildren = child.getChildren();
			int numberOfSteps = contentChildren.size();
			if (numberOfSteps == 1) {
				logger.debug("The service contains {} flow step.",numberOfSteps);
			} else if (numberOfSteps == 0) {
				getContext().createLineViolation(this, "Service doesn't contain any flow steps. Remove service or add flow steps.", astNode);
				logger.debug("The service contains {} flow steps. Remove this service or add flow steps.", numberOfSteps);
			} else if (numberOfSteps > 1) {
				logger.debug("The service contains {} flow steps.",numberOfSteps);
			} 
		}
	}
}
 
开发者ID:I8C,项目名称:sonar-flow-plugin,代码行数:19,代码来源:EmptyFlowCheck.java


示例17: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Override
public void visitNode(AstNode astNode) {
	AstNode attributesNode = astNode.getFirstChild(FlowGrammar.ATTRIBUTES);
	
	AstNode switchAttribute = attributesNode.getFirstChild(FlowAttTypes.SWITCH);
	Boolean switchDefined = (switchAttribute == null || "".equals(switchAttribute.getTokenOriginalValue())) ? false : true;
	
	AstNode labelExpressions = attributesNode.getFirstChild(FlowAttTypes.LABELEXPRESSIONS);
	Boolean evaluateLabelsDefined = (labelExpressions == null || "false".equals(labelExpressions.getTokenOriginalValue()) || "".equals(labelExpressions.getTokenOriginalValue())) ? false : true ;
	
	if ( switchDefined && evaluateLabelsDefined ) {
		getContext().createLineViolation(this, "Both switch and evaluate labels are defined in properties of BRANCH", astNode);
	}
	
	if ( !switchDefined && !evaluateLabelsDefined) {
		getContext().createLineViolation(this, "Evaluate labels must be true when no switch parameter is defined in BRANCH", astNode);
	}	
}
 
开发者ID:I8C,项目名称:sonar-flow-plugin,代码行数:19,代码来源:BranchPropertiesCheck.java


示例18: checkConditionalStatements

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
private void checkConditionalStatements(AstNode node) {
  if (node.getFirstChild(PuppetGrammar.STATEMENT) == null) {
    if (node.is(PuppetGrammar.IF_STMT)) {
      addIssue(node, this, "Remove this empty \"if\" statement.");
    } else if (node.is(PuppetGrammar.UNLESS_STMT)) {
      addIssue(node, this, "Remove this empty \"unless\" statement.");
    } else if (!hasTrivia(node)) {
      if (node.is(PuppetGrammar.CASE_MATCHER)) {
        addIssue(node, this, "Remove this empty \"case\" matcher or add a comment to explain why it is empty.");
      } else if (node.is(PuppetGrammar.ELSIF_STMT)) {
        addIssue(node, this, "Remove this empty \"elsif\" statement or add a comment to explain why it is empty.");
      } else if (node.is(PuppetGrammar.ELSE_STMT)) {
        addIssue(node, this, "Remove this empty \"else\" statement or add a comment to explain why it is empty.");
      }
    }
  }
}
 
开发者ID:iwarapter,项目名称:sonar-puppet,代码行数:18,代码来源:EmptyBlocksCheck.java


示例19: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Override
public void visitNode(AstNode node) {
  if (node.getTokenValue().substring(1).startsWith(PREFIX)) {
    List<String> validPaths = new ArrayList<>(Arrays.asList(PREFIX + "modules/", PREFIX + "$"));
    if (StringUtils.isNotBlank(mountPoints)) {
      for (String pathCustom : mountPoints.split(",")) {
        if (StringUtils.isNotBlank(pathCustom)) {
          validPaths.add(PREFIX + pathCustom + "/");
        }
      }
    }
    if (!StringUtils.startsWithAny(node.getTokenValue().substring(1), validPaths.toArray(new String[validPaths.size()]))) {
      String message = "Add \"modules/\" to the path";
      if (validPaths.size() > 2) {
        message += " (Or " + mountPoints + ")";
      }
      message += ".";
      addIssue(node, this, message);
    }
  }
}
 
开发者ID:iwarapter,项目名称:sonar-puppet,代码行数:22,代码来源:PuppetURLModulesCheck.java


示例20: visitNode

import com.sonar.sslr.api.AstNode; //导入依赖的package包/类
@Override
public void visitNode(AstNode paramNode) {
  if ("mode".equals(paramNode.getTokenValue())
    && "file".equalsIgnoreCase(paramNode.getFirstAncestor(PuppetGrammar.RESOURCE, PuppetGrammar.RESOURCE_OVERRIDE, PuppetGrammar.COLLECTION).getTokenValue())) {
    AstNode expressionNode = paramNode.getFirstChild(PuppetGrammar.EXPRESSION);
    if (expressionNode.getToken().getType().equals(OCTAL_INTEGER) || expressionNode.getToken().getType().equals(INTEGER)) {
      addIssue(expressionNode, this, MESSAGE_OCTAL);
    } else if (expressionNode.getToken().getType().equals(DOUBLE_QUOTED_STRING_LITERAL) && PATTERN.matcher(expressionNode.getTokenValue()).matches()) {
      addIssue(expressionNode, this, MESSAGE_DOUBLE_QUOTES);
    } else if (expressionNode.getToken().getType().equals(SINGLE_QUOTED_STRING_LITERAL) && !PATTERN.matcher(expressionNode.getTokenValue()).matches()
      || expressionNode.getToken().getType().equals(DOUBLE_QUOTED_STRING_LITERAL) && !PATTERN.matcher(expressionNode.getTokenValue()).matches()
      && !CheckStringUtils.containsVariable(expressionNode.getTokenValue())) {
      addIssue(expressionNode, this, MESSAGE_INVALID);
    }
  }
}
 
开发者ID:iwarapter,项目名称:sonar-puppet,代码行数:17,代码来源:FileModeCheck.java



注:本文中的com.sonar.sslr.api.AstNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LongSumAggregator类代码示例发布时间:2022-05-22
下一篇:
Java IRCModeParser类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap