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."); } } }
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 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); } } }
@Override public void visitAtRule(AtRuleTree tree) { if (!tree.standardAtRule().getName().matches(atRulesToExclude) && (tree.isVendorPrefixed() || tree.standardAtRule().isExperimental())) { addPreciseIssue( tree.atKeyword(), "Remove this usage of the experimental \"" + tree.standardAtRule().getName() + "\" @-rule."); } 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); } } }
@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); }
@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); }
@Override public void visitAtRule(AtRuleTree tree) { if (tree.isVendorPrefixed() || tree.standardAtRule().isExperimental()) { addPreciseIssue( tree.atKeyword(), "Remove this usage of the experimental \"" + tree.standardAtRule().getName() + "\" @-rule."); } super.visitAtRule(tree); }
@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 (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 (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 FontFace && tree.block() != null) { getAllUriTrees(tree.block().propertyDeclarations()) .forEach(this::checkUriTreeForInliningFont); } super.visitAtRule(tree); }
private boolean isEncodingOfCharsetAtRule(StringTree tree) { return tree.parent() != null && tree.parent().parent() instanceof AtRuleTree && ((AtRuleTree) tree.parent().parent()).standardAtRule() instanceof Charset; }
private boolean isEncodingOfCharsetAtRule(StringTree tree) { return tree.parent() != null && tree.parent().parent() instanceof AtRuleTree && ((AtRuleTree) tree.parent().parent()).standardAtRule() instanceof Charset; }
@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); }
@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 propertyToBeChecked(PropertyDeclarationTree tree) { if (!(tree.property().standardProperty() instanceof FontFamily)) { return false; } if (tree.parent() != null && tree.parent().parent() != null && tree.parent().parent() instanceof AtRuleTree && ((AtRuleTree) tree.parent().parent()).standardAtRule() instanceof FontFace) { return false; } return true; }
private boolean propertyToBeChecked(PropertyDeclarationTree tree) { if (!(tree.property().standardProperty() instanceof FontFamily)) { return false; } if (tree.parent() != null && tree.parent().parent() != null && tree.parent().parent() instanceof AtRuleTree && ((AtRuleTree) tree.parent().parent()).standardAtRule() instanceof FontFace) { return false; } return true; }