net.sourceforge.pmd
Class PMD

java.lang.Object
  extended by net.sourceforge.pmd.PMD

public class PMD
extends java.lang.Object


Field Summary
static java.lang.String EOL
           
static java.lang.String EXCLUDE_MARKER
           
static java.lang.String VERSION
           
 
Constructor Summary
PMD()
           
 
Method Summary
static java.lang.ClassLoader createClasspathClassLoader(java.lang.String classpath)
          Create a ClassLoader which loads classes using a CLASSPATH like String.
 java.lang.ClassLoader getClassLoader()
          Get the ClassLoader being used by PMD when processing Rules.
static void main(java.lang.String[] args)
           
 void processFile(java.io.InputStream fileContents, RuleSet ruleSet, RuleContext ctx)
          Processes the input stream against a rule set assuming the platform character set.
 void processFile(java.io.InputStream fileContents, java.lang.String encoding, RuleSet ruleSet, RuleContext ctx)
          Processes the input stream against a rule set using the given input encoding.
 void processFile(java.io.InputStream fileContents, java.lang.String encoding, RuleSets ruleSets, RuleContext ctx)
          Processes the input stream against a rule set using the given input encoding.
 void processFile(java.io.Reader reader, RuleSet ruleSet, RuleContext ctx)
          Processes the file read by the reader against the rule set.
 void processFile(java.io.Reader reader, RuleSets ruleSets, RuleContext ctx)
          Processes the file read by the reader against the rule set.
 void processFile(java.io.Reader reader, RuleSets ruleSets, RuleContext ctx, SourceType sourceType)
          Processes the file read by the reader against the rule set.
static void processFiles(int threadCount, RuleSetFactory ruleSetFactory, SourceType sourceType, java.util.List<DataSource> files, RuleContext ctx, java.util.List<Renderer> renderers, boolean stressTestEnabled, java.lang.String rulesets, boolean shortNamesEnabled, java.lang.String inputPath, java.lang.String encoding, java.lang.String excludeMarker, java.lang.ClassLoader classLoader)
          Run PMD on a list of files using multiple threads.
static void processFiles(int threadCount, RuleSetFactory ruleSetFactory, SourceType sourceType, java.util.List<DataSource> files, RuleContext ctx, java.util.List<Renderer> renderers, java.lang.String rulesets, boolean shortNamesEnabled, java.lang.String inputPath, java.lang.String encoding, java.lang.String excludeMarker, java.lang.ClassLoader classLoader)
          Run PMD on a list of files using multiple threads.
 void processFiles(java.util.List<DataSource> files, RuleContext ctx, RuleSets rulesets, boolean debugEnabled, boolean shortNamesEnabled, java.lang.String inputPath, java.lang.String encoding)
          Run PMD on a list of files.
 void setClassLoader(java.lang.ClassLoader classLoader)
          Set the ClassLoader being used by PMD when processing Rules.
 void setExcludeMarker(java.lang.String marker)
           
 void setJavaVersion(SourceType javaVersion)
          Set the SourceType to be used for ".java" files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EOL

public static final java.lang.String EOL

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

EXCLUDE_MARKER

public static final java.lang.String EXCLUDE_MARKER
See Also:
Constant Field Values
Constructor Detail

PMD

public PMD()
Method Detail

processFile

public void processFile(java.io.Reader reader,
                        RuleSets ruleSets,
                        RuleContext ctx)
                 throws PMDException
Processes the file read by the reader against the rule set.

Parameters:
reader - input stream reader
ruleSets - set of rules to process against the file
ctx - context in which PMD is operating. This contains the Renderer and whatnot
Throws:
PMDException - if the input could not be parsed or processed

processFile

public void processFile(java.io.Reader reader,
                        RuleSets ruleSets,
                        RuleContext ctx,
                        SourceType sourceType)
                 throws PMDException
Processes the file read by the reader against the rule set.

Parameters:
reader - input stream reader
ruleSets - set of rules to process against the file
ctx - context in which PMD is operating. This contains the Renderer and whatnot
sourceType - the SourceType of the source
Throws:
PMDException - if the input could not be parsed or processed

processFile

public void processFile(java.io.Reader reader,
                        RuleSet ruleSet,
                        RuleContext ctx)
                 throws PMDException
Processes the file read by the reader against the rule set.

Parameters:
reader - input stream reader
ruleSet - set of rules to process against the file
ctx - context in which PMD is operating. This contains the Renderer and whatnot
Throws:
PMDException - if the input could not be parsed or processed

processFile

public void processFile(java.io.InputStream fileContents,
                        java.lang.String encoding,
                        RuleSet ruleSet,
                        RuleContext ctx)
                 throws PMDException
Processes the input stream against a rule set using the given input encoding.

Parameters:
fileContents - an input stream to analyze
encoding - input stream's encoding
ruleSet - set of rules to process against the file
ctx - context in which PMD is operating. This contains the Report and whatnot
Throws:
PMDException - if the input encoding is unsupported or the input stream could not be parsed
See Also:
processFile(Reader, RuleSet, RuleContext)

processFile

public void processFile(java.io.InputStream fileContents,
                        java.lang.String encoding,
                        RuleSets ruleSets,
                        RuleContext ctx)
                 throws PMDException
Processes the input stream against a rule set using the given input encoding.

Parameters:
fileContents - an input stream to analyze
encoding - input stream's encoding
ruleSets - set of rules to process against the file
ctx - context in which PMD is operating. This contains the Report and whatnot
Throws:
PMDException - if the input encoding is unsupported or the input stream could not be parsed
See Also:
processFile(Reader, RuleSet, RuleContext)

processFile

public void processFile(java.io.InputStream fileContents,
                        RuleSet ruleSet,
                        RuleContext ctx)
                 throws PMDException
Processes the input stream against a rule set assuming the platform character set.

Parameters:
fileContents - input stream to check
ruleSet - the set of rules to process against the source code
ctx - the context in which PMD is operating. This contains the Report and whatnot
Throws:
PMDException - if the input encoding is unsupported or the input input stream could not be parsed
See Also:
processFile(InputStream, String, RuleSet, RuleContext)

setExcludeMarker

public void setExcludeMarker(java.lang.String marker)

setJavaVersion

public void setJavaVersion(SourceType javaVersion)
Set the SourceType to be used for ".java" files.

Parameters:
javaVersion - the SourceType that indicates the java version

getClassLoader

public java.lang.ClassLoader getClassLoader()
Get the ClassLoader being used by PMD when processing Rules.

Returns:
The ClassLoader being used

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Set the ClassLoader being used by PMD when processing Rules. Setting a value of null will cause the default ClassLoader to be used.

Parameters:
classLoader - The ClassLoader to use

createClasspathClassLoader

public static java.lang.ClassLoader createClasspathClassLoader(java.lang.String classpath)
                                                        throws java.io.IOException
Create a ClassLoader which loads classes using a CLASSPATH like String. If the String looks like a URL to a file (e.g. starts with file://) the file will be read with each line representing an entry on the classpath.

The ClassLoader used to load the net.sourceforge.pmd.PMD class will be used as the parent ClassLoader of the created ClassLoader.

Parameters:
classpath - The classpath String.
Returns:
A ClassLoader
Throws:
java.io.IOException
See Also:
ClasspathClassLoader

main

public static void main(java.lang.String[] args)

processFiles

public static void processFiles(int threadCount,
                                RuleSetFactory ruleSetFactory,
                                SourceType sourceType,
                                java.util.List<DataSource> files,
                                RuleContext ctx,
                                java.util.List<Renderer> renderers,
                                java.lang.String rulesets,
                                boolean shortNamesEnabled,
                                java.lang.String inputPath,
                                java.lang.String encoding,
                                java.lang.String excludeMarker,
                                java.lang.ClassLoader classLoader)
Run PMD on a list of files using multiple threads.

Throws:
java.io.IOException - If one of the files could not be read

processFiles

public static void processFiles(int threadCount,
                                RuleSetFactory ruleSetFactory,
                                SourceType sourceType,
                                java.util.List<DataSource> files,
                                RuleContext ctx,
                                java.util.List<Renderer> renderers,
                                boolean stressTestEnabled,
                                java.lang.String rulesets,
                                boolean shortNamesEnabled,
                                java.lang.String inputPath,
                                java.lang.String encoding,
                                java.lang.String excludeMarker,
                                java.lang.ClassLoader classLoader)
Run PMD on a list of files using multiple threads.

Throws:
java.io.IOException - If one of the files could not be read

processFiles

public void processFiles(java.util.List<DataSource> files,
                         RuleContext ctx,
                         RuleSets rulesets,
                         boolean debugEnabled,
                         boolean shortNamesEnabled,
                         java.lang.String inputPath,
                         java.lang.String encoding)
                  throws java.io.IOException
Run PMD on a list of files.

Parameters:
files - the List of DataSource instances.
ctx - the context in which PMD is operating. This contains the Report and whatnot
rulesets - the RuleSets
debugEnabled -
shortNamesEnabled -
inputPath -
encoding -
Throws:
java.io.IOException - If one of the files could not be read


Copyright © 2002-2011 InfoEther. All Rights Reserved.