Package com.spertus.jacquard.pmdgrader
Class PmdGrader
java.lang.Object
com.spertus.jacquard.common.Grader
com.spertus.jacquard.pmdgrader.PmdGrader
A grader that makes use of the linked
PMD Source Code Analyzer Project.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PmdGrader
createFromRules
(double penaltyPerViolation, double maxPenalty, String ruleSetPath, String ruleName0, String... moreRuleNames) Creates a PMD-based grader for the specified rules.static PmdGrader
createFromRuleSetPaths
(double penaltyPerViolation, double maxPenalty, String... ruleSetPaths) Creates a PMD-based grader for the specified rule sets.getCallableMultiTarget
(Target... targets) Gets aCallable
through which this grader can be called on multiple targets.getCallableSingleTarget
(Target target) Gets aCallable
through which this grader can be called on a single target.Methods inherited from class com.spertus.jacquard.common.Grader
grade, grade, gradeAll, makeExceptionResult, makeExceptionResultList, makeFailureResult, makeFailureResultList, makePartialCreditResult, makeSuccessResult, makeSuccessResultList
-
Method Details
-
createFromRuleSetPaths
public static PmdGrader createFromRuleSetPaths(double penaltyPerViolation, double maxPenalty, String... ruleSetPaths) Creates a PMD-based grader for the specified rule sets. The ruleSetPaths argument should be one or more paths to rule sets in the PMD resource directory (such as "category/java/quickstart.xml") or in one of the client project's resource directories.- Parameters:
penaltyPerViolation
- the penalty per violation, which should be a positive numbermaxPenalty
- the maximum penaltyruleSetPaths
- the path to one or more rule sets- Returns:
- new PMD grader
- Throws:
ClientException
- if any rule set path is invalid- See Also:
-
createFromRules
public static PmdGrader createFromRules(double penaltyPerViolation, double maxPenalty, String ruleSetPath, String ruleName0, String... moreRuleNames) Creates a PMD-based grader for the specified rules. The ruleSetPath argument should be the path to a rule set in the PMD resource directory (such as "category/java/quickstart.xml") or in one of the client project's resource directories. The rule names should be provided without a preceding path, such as "MissingOverride".- Parameters:
penaltyPerViolation
- the penalty per violation, which should be a positive numbermaxPenalty
- the maximum penaltyruleSetPath
- the path to a rule setruleName0
- the first rule in the set to usemoreRuleNames
- additions rules in the set to use- Returns:
- new PMD grader
- Throws:
ClientException
- if any rule set path is invalid or a rule cannot be found
-
getCallableSingleTarget
Description copied from class:Grader
Gets aCallable
through which this grader can be called on a single target.- Specified by:
getCallableSingleTarget
in classGrader
- Parameters:
target
- the target- Returns:
- a
Callable
through which this grader can be called
-
getCallableMultiTarget
Description copied from class:Grader
Gets aCallable
through which this grader can be called on multiple targets. The default implementation just appends the results of successive calls toGrader.getCallableSingleTarget(Target)
, but subclasses may provide their own implementations to handle multiple targets specially.- Overrides:
getCallableMultiTarget
in classGrader
- Parameters:
targets
- the targets- Returns:
- a
Callable
through which this grader can be called
-