@Override public void visitAtRule(AtRuleTree tree) { if (tree.standardAtRule() instanceof UnknownAtRule && !tree.isVendorPrefixed()) { addPreciseIssue( tree.atKeyword(), "Remove this usage of the unknown \"" + tree.standardAtRule().getName() + "\" @-rule."); } super.visitAtRule(tree); }
private void checkAtRuleOpeningCurlyBrace(AtRuleTree tree) { Preconditions.checkNotNull(tree.block()); Tree tree1 = tree.preludes() != null ? tree.preludes() : tree.atKeyword(); Tree tree2 = tree.block().openCurlyBrace(); if (!isOnSameLine(tree1, tree2)) { addPreciseIssue(tree2, "Move the opening curly brace to the previous line."); } }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.standardAtRule() instanceof FontFace && tree.block() != null) { getAllUriTrees(tree.block().propertyDeclarations()) .forEach(this::checkUriTreeForInliningFont); } super.visitAtRule(tree); }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.standardAtRule() instanceof Charset && !isFirst(tree.atKeyword().atSymbol())) { addPreciseIssue( tree.atKeyword(), "Move the @charset rule to the very beginning of the style sheet."); } super.visitAtRule(tree); }
private void checkBlock(List<Tree> statements) { boolean found = false; for (Tree tree : statements) { if (!found && !(tree instanceof LessVariableDeclarationTree) && !(tree instanceof AtRuleTree && (((AtRuleTree) tree).standardAtRule() instanceof Import || ((AtRuleTree) tree).standardAtRule() instanceof Charset))) { found = true; } if (found && tree instanceof LessVariableDeclarationTree) { addPreciseIssue(tree, "Move this declaration to the beginning of the block."); } } }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.block() != null) { checkAtRuleOpeningCurlyBrace(tree); if (!tree.block().content().isEmpty()) { if (isOnSameLine(tree.block().openCurlyBrace(), tree.block().content().get(0))) { addPreciseIssue(tree.block().openCurlyBrace(), "Move the code following the opening curly brace to the next line."); } if (isOnSameLine(tree.block().content().get(0), tree.block().closeCurlyBrace())) { addPreciseIssue(tree.block().closeCurlyBrace(), "Move the closing curly brace to the next line."); } } } super.visitAtRule(tree); }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.standardAtRule() instanceof FontFace && tree.block() != null) { getAllUriTrees(tree.block().propertyDeclarations()) .forEach(this::checkUriTreeForInliningFont); } super.visitAtRule(tree); }
@Override public void visitStyleSheet(StyleSheetTree tree) { precedingRules.clear(); super.visitStyleSheet(tree); for (StatementTree statementTree : tree.statements()) { if (statementTree instanceof RulesetTree) { precedingRules.add(CheckUtils.rulesetIssueLocation((RulesetTree) statementTree)); } else if (((AtRuleTree) statementTree).standardAtRule() instanceof Import) { if (!precedingRules.isEmpty()) { createIssue(((AtRuleTree) statementTree).atKeyword()); } } else if (!(((AtRuleTree) statementTree).standardAtRule() instanceof Charset)) { precedingRules.add(statementTree); } } }
private void checkBlock(List<Tree> statements) { boolean found = false; for (Tree tree : statements) { if (!found && !(tree instanceof LessVariableDeclarationTree) && !(tree instanceof AtRuleTree && (((AtRuleTree) tree).standardAtRule() instanceof Import || ((AtRuleTree) tree).standardAtRule() instanceof Charset))) { found = true; } if (found && tree instanceof LessVariableDeclarationTree) { addPreciseIssue(tree, "Move this declaration to the beginning of the block."); } } }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.block() != null) { checkAtRuleOpeningCurlyBrace(tree); if (!tree.block().content().isEmpty()) { if (isOnSameLine(tree.block().openCurlyBrace(), tree.block().content().get(0))) { addPreciseIssue(tree.block().openCurlyBrace(), "Move the code following the opening curly brace to the next line."); } if (isOnSameLine(tree.block().content().get(0), tree.block().closeCurlyBrace())) { addPreciseIssue(tree.block().closeCurlyBrace(), "Move the closing curly brace to the next line."); } } } super.visitAtRule(tree); }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.standardAtRule() instanceof UnknownAtRule && !tree.isVendorPrefixed()) { addPreciseIssue( tree.atKeyword(), "Remove this usage of the unknown \"" + tree.standardAtRule().getName() + "\" @-rule."); } super.visitAtRule(tree); }
private void checkAtRuleOpeningCurlyBrace(AtRuleTree tree) { Preconditions.checkNotNull(tree.block()); Tree tree1 = tree.preludes() != null ? tree.preludes() : tree.atKeyword(); Tree tree2 = tree.block().openCurlyBrace(); if (!isOnSameLine(tree1, tree2)) { addPreciseIssue(tree2, "Move the opening curly brace to the previous line."); } }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.block() != null && tree.block().content().isEmpty() && !AT_RULES_NOT_REQUIRING_BLOCK.contains(tree.standardAtRule().getClass())) { addIssue(tree); } super.visitAtRule(tree); }
@Override public void visitAtRule(AtRuleTree tree) { if (!isFontFaceRuleToBeChecked(tree)) { return; } List<PropertyDeclarationTree> declarations = tree.block().propertyDeclarations(); if (DEEPEST_LEVEL.equals(browserSupportLevel)) { if (getSecondToLastSrcPropertyDeclaration(declarations) == null) { addPreciseIssue(tree.atKeyword(), "Add an \"src\" property setting the URL for the \".eot\" font file (to support IE9 Compatibility Modes)."); } else { checkSecondToLastSrcPropertyDeclaration(getSecondToLastSrcPropertyDeclaration(declarations)); } } checkLastSrcProperty(getLastSrcPropertyDeclaration(declarations)); super.visitAtRule(tree); }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.standardAtRule() instanceof Charset && !isFirst(tree.atKeyword().atSymbol())) { addPreciseIssue( tree.atKeyword(), "Move the @charset rule to the very beginning of the style sheet."); } super.visitAtRule(tree); }
private boolean isEncodingOfCharsetAtRule(StringTree tree) { return tree.parent() != null && tree.parent().parent() instanceof AtRuleTree && ((AtRuleTree) tree.parent().parent()).standardAtRule() instanceof Charset; }