net.sourceforge.pmd

## Class PMD

- java.lang.Object
- - net.sourceforge.pmd.PMD

- Direct Known Subclasses:
    PmdRunnable

      public class PMD
      extends Object

  This is the main class for interacting with PMD. The primary flow of all Rule process is controlled via interactions with this class. A command line interface is supported, as well as a programmatic API for integrating PMD with other software such as IDEs and Ant.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `PMD.ProgressMonitor` A callback that would be implemented by IDEs keeping track of PMD's progress as it evaluates a set of files.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected PMDConfiguration` | `configuration`
    `static String` | `EOL`
    `static String` | `SUPPRESS_MARKER`
    `static String` | `VERSION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PMD()` Create a PMD instance using a default Configuration.
    `PMD(PMDConfiguration configuration)` Create a PMD instance using the specified Configuration.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `doPMD(PMDConfiguration configuration)` This method is the main entry point for command line usage.
    `static List<DataSource>` | `getApplicableFiles(PMDConfiguration configuration, Set<Language> languages)`
    `PMDConfiguration` | `getConfiguration()` Get the runtime configuration.
    `SourceCodeProcessor` | `getSourceCodeProcessor()`
    `static void` | `main(String[] args)` Entry to invoke PMD as command line tool
    `static RuleContext` | `newRuleContext(String sourceCodeFilename, File sourceCodeFile)`
    `static Parser` | `parserFor(LanguageVersion languageVersion, PMDConfiguration configuration)`
    `static void` | `processFiles(PMDConfiguration configuration, RuleSetFactory ruleSetFactory, Collection<File> files, RuleContext ctx, PMD.ProgressMonitor monitor)` An entry point that would typically be used by IDEs intent on providing ongoing feedback and the ability to terminate it at will.
    `static void` | `processFiles(PMDConfiguration configuration, RuleSetFactory ruleSetFactory, List<DataSource> files, RuleContext ctx, List<Renderer> renderers)` Run PMD on a list of files using multiple threads - if more than one is available
    `static int` | `run(String[] args)`
    `static Report` | `setupReport(RuleSets rs, RuleContext ctx, String fileName)` Create a report, filter out any defective rules, and keep a record of them.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EOL

          public static final String EOL

    - #### SUPPRESS_MARKER

          public static final String SUPPRESS_MARKER

      See Also:
        Constant Field Values

    - #### configuration

          protected final PMDConfiguration configuration

    - #### VERSION

          public static final String VERSION

  - ### Constructor Detail

    - #### PMD

          public PMD()

      Create a PMD instance using a default Configuration. Changes to the configuration may be required.

    - #### PMD

          public PMD(PMDConfiguration configuration)

      Create a PMD instance using the specified Configuration.
      Parameters:
        `configuration` - The runtime Configuration of PMD to use.

  - ### Method Detail

    - #### parserFor

          public static Parser parserFor(LanguageVersion languageVersion,
                         PMDConfiguration configuration)

    - #### setupReport

          public static Report setupReport(RuleSets rs,
                           RuleContext ctx,
                           String fileName)

      Create a report, filter out any defective rules, and keep a record of them.
      Parameters:
        `rs` -
        `ctx` -
        `fileName` -
      Returns:
        Report

    - #### getConfiguration

          public PMDConfiguration getConfiguration()

      Get the runtime configuration. The configuration can be modified to affect how PMD behaves.
      Returns:
        The configuration.
      See Also:
        `PMDConfiguration`

    - #### getSourceCodeProcessor

          public SourceCodeProcessor getSourceCodeProcessor()

      Returns:
        SourceCodeProcessor

    - #### doPMD

          public static void doPMD(PMDConfiguration configuration)

      This method is the main entry point for command line usage.
      Parameters:
        `configuration` -

    - #### newRuleContext

          public static RuleContext newRuleContext(String sourceCodeFilename,
                                   File sourceCodeFile)

    - #### processFiles

          public static void processFiles(PMDConfiguration configuration,
                          RuleSetFactory ruleSetFactory,
                          Collection<File> files,
                          RuleContext ctx,
                          PMD.ProgressMonitor monitor)

      An entry point that would typically be used by IDEs intent on providing ongoing feedback and the ability to terminate it at will.
      Parameters:
        `configuration` -
        `ruleSetFactory` -
        `files` -
        `ctx` -
        `monitor` -

    - #### processFiles

          public static void processFiles(PMDConfiguration configuration,
                          RuleSetFactory ruleSetFactory,
                          List<DataSource> files,
                          RuleContext ctx,
                          List<Renderer> renderers)

      Run PMD on a list of files using multiple threads - if more than one is available
      Parameters:
        `configuration` - Configuration
        `ruleSetFactory` - RuleSetFactory
        `files` - List
        `ctx` - RuleContext
        `renderers` - List

    - #### getApplicableFiles

          public static List<DataSource> getApplicableFiles(PMDConfiguration configuration,
                                            Set<Language> languages)

      Parameters:
        `configuration` - Configuration
        `languages` - Set
      Returns:
        List

    - #### main

          public static void main(String[] args)

      Entry to invoke PMD as command line tool
      Parameters:
        `args` -

    - #### run

          public static int run(String[] args)

      Parameters:
        `args` - String[]
      Returns:
        int

Copyright © 2002-2013 InfoEther. All Rights Reserved.