Class PmdGrader

java.lang.Object
com.spertus.jacquard.common.Grader
com.spertus.jacquard.pmdgrader.PmdGrader

public final class PmdGrader extends Grader
A grader that makes use of the linked PMD Source Code Analyzer Project.
  • 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 number
      maxPenalty - the maximum penalty
      ruleSetPaths - 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 number
      maxPenalty - the maximum penalty
      ruleSetPath - the path to a rule set
      ruleName0 - the first rule in the set to use
      moreRuleNames - 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

      public Callable<List<Result>> getCallableSingleTarget(Target target)
      Description copied from class: Grader
      Gets a Callable through which this grader can be called on a single target.
      Specified by:
      getCallableSingleTarget in class Grader
      Parameters:
      target - the target
      Returns:
      a Callable through which this grader can be called
    • getCallableMultiTarget

      public Callable<List<Result>> getCallableMultiTarget(Target... targets)
      Description copied from class: Grader
      Gets a Callable through which this grader can be called on multiple targets. The default implementation just appends the results of successive calls to Grader.getCallableSingleTarget(Target), but subclasses may provide their own implementations to handle multiple targets specially.
      Overrides:
      getCallableMultiTarget in class Grader
      Parameters:
      targets - the targets
      Returns:
      a Callable through which this grader can be called