Package net.sourceforge.pmd
Class RulesetsFactoryUtils
- java.lang.Object
-
- net.sourceforge.pmd.RulesetsFactoryUtils
-
public final class RulesetsFactoryUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static RuleSetFactorycreateFactory(ClassLoader classLoader, RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)Returns a ruleset factory which uses the providedClassLoaderto resolve resource references.static RuleSetFactorycreateFactory(PMDConfiguration configuration)Returns a ruleset factory which uses the classloader for PMD classes to resolve resource references.static RuleSetFactorycreateFactory(PMDConfiguration configuration, ClassLoader classLoader)Returns a ruleset factory which uses the providedClassLoaderto resolve resource references.static RuleSetFactorycreateFactory(RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)Returns a ruleset factory which uses the classloader for PMD classes to resolve resource references.static RuleSetFactorycreateFactory(RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility, boolean includeDeprecatedRuleReferences)Returns a ruleset factory which uses the classloader for PMD classes to resolve resource references.static RuleSetFactorydefaultFactory()Returns a ruleset factory with default parameters.static RuleSetFactorygetRulesetFactory(PMDConfiguration configuration, ResourceLoader resourceLoader)Deprecated.static RuleSetsgetRuleSets(String rulesets, RuleSetFactory factory)Deprecated.Internal APIstatic RuleSetsgetRuleSetsWithBenchmark(String rulesets, RuleSetFactory factory)Deprecated.Is internal API
-
-
-
Method Detail
-
getRuleSets
@InternalApi @Deprecated public static RuleSets getRuleSets(String rulesets, RuleSetFactory factory)
Deprecated.Internal APICreates a new rulesets with the given string. The resulting rulesets will contain all referenced rulesets.- Parameters:
rulesets- the string with the rulesets to loadfactory- the ruleset factory- Returns:
- the rulesets
- Throws:
IllegalArgumentException- if rulesets is empty (means, no rules have been found) or if a ruleset couldn't be found.
-
getRuleSetsWithBenchmark
@InternalApi @Deprecated public static RuleSets getRuleSetsWithBenchmark(String rulesets, RuleSetFactory factory)
Deprecated.Is internal APISeegetRuleSets(String, RuleSetFactory). In addition, the loading of the rules is benchmarked.- Parameters:
rulesets- the string with the rulesets to loadfactory- the ruleset factory- Returns:
- the rulesets
- Throws:
IllegalArgumentException- if rulesets is empty (means, no rules have been found) or if a ruleset couldn't be found.
-
getRulesetFactory
@InternalApi @Deprecated public static RuleSetFactory getRulesetFactory(PMDConfiguration configuration, ResourceLoader resourceLoader)
Deprecated.
-
createFactory
public static RuleSetFactory createFactory(PMDConfiguration configuration)
Returns a ruleset factory which uses the classloader for PMD classes to resolve resource references.- Parameters:
configuration- PMD configuration, contains info about the factory parameters- Returns:
- A ruleset factory
- See Also:
createFactory(PMDConfiguration, ClassLoader)
-
defaultFactory
public static RuleSetFactory defaultFactory()
Returns a ruleset factory with default parameters. It doesn't prune rules based on priority, and doesn't warn for deprecations.- Returns:
- A ruleset factory
- See Also:
createFactory(PMDConfiguration, ClassLoader)
-
createFactory
public static RuleSetFactory createFactory(PMDConfiguration configuration, ClassLoader classLoader)
Returns a ruleset factory which uses the providedClassLoaderto resolve resource references. It warns for deprecated rule usages.- Parameters:
configuration- PMD configuration, contains info about the factory parametersclassLoader- Class loader to load resources- Returns:
- A ruleset factory
- See Also:
createFactory(PMDConfiguration)
-
createFactory
public static RuleSetFactory createFactory(ClassLoader classLoader, RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)
Returns a ruleset factory which uses the providedClassLoaderto resolve resource references.- Parameters:
minimumPriority- Minimum priority for rules to be includedwarnDeprecated- If true, print warnings when deprecated rules are includedenableCompatibility- If true, rule references to moved rules are mapped to their new location if they are knownclassLoader- Class loader to load resources- Returns:
- A ruleset factory
- See Also:
createFactory(PMDConfiguration)
-
createFactory
public static RuleSetFactory createFactory(RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility)
Returns a ruleset factory which uses the classloader for PMD classes to resolve resource references.- Parameters:
minimumPriority- Minimum priority for rules to be includedwarnDeprecated- If true, print warnings when deprecated rules are includedenableCompatibility- If true, rule references to moved rules are mapped to their new location if they are known- Returns:
- A ruleset factory
- See Also:
createFactory(PMDConfiguration)
-
createFactory
public static RuleSetFactory createFactory(RulePriority minimumPriority, boolean warnDeprecated, boolean enableCompatibility, boolean includeDeprecatedRuleReferences)
Returns a ruleset factory which uses the classloader for PMD classes to resolve resource references.- Parameters:
minimumPriority- Minimum priority for rules to be includedwarnDeprecated- If true, print warnings when deprecated rules are includedenableCompatibility- If true, rule references to moved rules are mapped to their new location if they are knownincludeDeprecatedRuleReferences- If true, deprecated rule references are retained. Usually, these references are ignored, since they indicate renamed/moved rules, and the referenced rule is often included in the same ruleset. Enabling this might result in duplicated rules.- Returns:
- A ruleset factory
- See Also:
createFactory(PMDConfiguration)
-
-