Search in sources :

Example 1 with RuleSetReference

use of net.sourceforge.pmd.RuleSetReference in project pmd-eclipse-plugin by pmd.

the class RuleSetUtil method addRuleSetByReference.

public static RuleSet addRuleSetByReference(RuleSet ruleSet, RuleSet sourceRuleSet, boolean allRules) {
    RuleSetReference reference = new RuleSetReference(sourceRuleSet.getFileName(), allRules);
    Collection<Rule> rules = new ArrayList<Rule>(ruleSet.getRules());
    for (Rule rule : sourceRuleSet.getRules()) {
        RuleReference ruleRef = new RuleReference(rule, reference);
        rules.add(ruleRef);
    }
    RuleSetFactory factory = new RuleSetFactory();
    return factory.createNewRuleSet(ruleSet.getName(), ruleSet.getDescription(), ruleSet.getFileName(), ruleSet.getExcludePatterns(), ruleSet.getIncludePatterns(), rules);
}
Also used : RuleSetFactory(net.sourceforge.pmd.RuleSetFactory) RuleReference(net.sourceforge.pmd.lang.rule.RuleReference) ArrayList(java.util.ArrayList) Rule(net.sourceforge.pmd.Rule) RuleSetReference(net.sourceforge.pmd.RuleSetReference)

Aggregations

ArrayList (java.util.ArrayList)1 Rule (net.sourceforge.pmd.Rule)1 RuleSetFactory (net.sourceforge.pmd.RuleSetFactory)1 RuleSetReference (net.sourceforge.pmd.RuleSetReference)1 RuleReference (net.sourceforge.pmd.lang.rule.RuleReference)1