/** * @deprecated in 1.17, use {@link #getNextSibling()} instead */ @Deprecated public AstNode nextSibling() { return getNextSibling(); }
/** * @deprecated in 1.17, use {@link #getNextSibling()} instead */ @Deprecated public AstNode nextSibling() { return getNextSibling(); }
/** * @deprecated in 1.17, use {@link #getNextSibling()} instead */ @Deprecated public AstNode nextSibling() { return getNextSibling(); }
private static List<AstNode> getModifiers(AstNode node) { ImmutableList.Builder<AstNode> builder = ImmutableList.builder(); builder.add(node); for (AstNode nextSibling = node.getNextSibling(); nextSibling != null && nextSibling.is(PHPGrammar.MEMBER_MODIFIER); nextSibling = nextSibling.getNextSibling()) { builder.add(nextSibling); } return builder.build(); }
public AstSelect nextSibling() { List<AstNode> result = Lists.newArrayList(); for (AstNode node : list) { node = node.getNextSibling(); if (node != null) { result.add(node); } } return AstSelectFactory.create(result); }
@Override public AstSelect nextSibling() { List<AstNode> result = new ArrayList<>(); for (AstNode node : list) { node = node.getNextSibling(); if (node != null) { result.add(node); } } return AstSelectFactory.create(result); }
@Override public AstSelect nextSibling() { List<AstNode> result = new ArrayList<>(); for (AstNode node : list) { node = node.getNextSibling(); if (node != null) { result.add(node); } } return AstSelectFactory.create(result); }
private List<AstNode> getConditionsToCompare(AstNode ifStmt) { List<AstNode> conditions = ifStmt.getChildren(PythonGrammar.TEST); AstNode elseNode = ifStmt.getFirstChild(PythonKeyword.ELSE); if (conditions.size() == 1 && elseNode != null) { AstNode suite = elseNode.getNextSibling().getNextSibling(); lookForElseIfs(conditions, suite); } return conditions; }
private void addImportedName(AstNode node, AstNode importedName) { AstNode name = importedName; AstNode as = node.getFirstChild(PythonKeyword.AS); if (as != null) { name = as.getNextSibling(); } importedNames.add(name.getTokenValue()); }
private void addImportedName(AstNode node, AstNode importedName) { AstNode name = importedName; AstNode as = node.getFirstChild(PythonKeyword.AS); if (as != null) { name = as.getNextSibling(); } importedNames.add(name.getTokenValue()); }
@Override public void visitNode(AstNode astNode) { if (WRAPPERS.contains(astNode.getNextSibling().getTokenValue())) { getContext().createLineViolation(this, "Do not use wrapper objects for primitive types.", astNode); } }
private boolean hasNoBreakComment(AstNode astNode) { for (Trivia trivia : astNode.getNextSibling().getToken().getTrivia()) { if (trivia.isComment() && trivia.toString().trim().contains("no break")) { return true; } } return false; }
@Override public void visitNode(AstNode node) { AstNode nextStatement = node.getNextSibling(); if (isUnReachableCode(nextStatement)) { getContext().createLineViolation(this, "This statement can't be reached and so start a dead code block.", nextStatement); } }
private void LookForClassLength(AstNode classDeclarationNode) { if(classDeclarationNode.getNextSibling().getTokenLine() > max){ getContext().createLineViolation(this, MESSAGE, classDeclarationNode, max); } } }
private void visitFor(AstNode node) { enterScope(node, null, null); AstNode identifier = node.getFirstChild(PlSqlKeyword.FOR).getNextSibling(); PlSqlType.Type type; if (node.hasDirectChildren(PlSqlPunctuator.RANGE)) { type = PlSqlType.Type.NUMERIC; } else { type = PlSqlType.Type.ROWTYPE; } createSymbol(identifier, Symbol.Kind.VARIABLE, new PlSqlType(type, identifier)); }
private boolean checkNode(AstNode node) { if (!shouldCheckNode(node)) { return true; } AstNode nextSibling = node.getNextSibling(); if (nextSibling != null && nextSibling.is(PlSqlGrammar.STATEMENT)) { addLineIssue(getLocalizedMessage(CHECK_KEY), nextSibling.getTokenLine()); return true; } return false; }
@Override public void visitNode(AstNode node) { AstNode statementNode = node.getParent(); AstNode nextStatement = statementNode.getNextSibling(); if (isUnReachableCode(nextStatement)) { getContext().createLineViolation(this, "Remove the code after this \"{0}\".", nextStatement, node.getFirstChild().getTokenOriginalValue()); } }
private void visitNotTest(AstNode node) { boolean hasUselessParenthesis = node.select() .children(PythonGrammar.ATOM) .children(PythonGrammar.TESTLIST_COMP) .children(PythonGrammar.TEST) .children(PythonGrammar.ATOM, PythonGrammar.COMPARISON) .isNotEmpty(); if (hasUselessParenthesis) { checkAtom(node.getFirstChild().getNextSibling(), false); } }
private void visitNotTest(AstNode node) { boolean hasUselessParenthesis = node.select() .children(PythonGrammar.ATOM) .children(PythonGrammar.TESTLIST_COMP) .children(PythonGrammar.TEST) .children(PythonGrammar.ATOM, PythonGrammar.COMPARISON) .isNotEmpty(); if (hasUselessParenthesis) { checkParenthesis(node.getFirstChild().getNextSibling(), "not", node); } }
private void visitNotTest(AstNode node) { boolean hasUselessParenthesis = node.select() .children(PythonGrammar.ATOM) .children(PythonGrammar.TESTLIST_COMP) .children(PythonGrammar.TEST) .children(PythonGrammar.ATOM, PythonGrammar.COMPARISON) .isNotEmpty(); if (hasUselessParenthesis) { checkParenthesis(node.getFirstChild().getNextSibling(), "not", node); } }