public class PMD
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
protected PMDConfiguration |
configuration |
Contains the configuration with which this PMD instance has been created.
|
static java.lang.String |
EOL |
The line delimiter used by PMD in outputs.
|
static java.lang.String |
SUPPRESS_MARKER |
The default suppress marker string.
|
static java.lang.String |
VERSION |
Deprecated.
Use
PMDVersion.VERSION instead. |
| Constructor | Description |
|---|---|
PMD() |
Create a PMD instance using a default Configuration.
|
PMD(PMDConfiguration configuration) |
Create a PMD instance using the specified Configuration.
|
| Modifier and Type | Method | Description |
|---|---|---|
static int |
doPMD(PMDConfiguration configuration) |
This method is the main entry point for command line usage.
|
static java.util.List<DataSource> |
getApplicableFiles(PMDConfiguration configuration,
java.util.Set<Language> languages) |
Determines all the files, that should be analyzed by PMD.
|
PMDConfiguration |
getConfiguration() |
Get the runtime configuration.
|
SourceCodeProcessor |
getSourceCodeProcessor() |
Gets the source code processor.
|
static java.util.List<DataSource> |
getURIDataSources(java.lang.String uriString) |
Parses the given string as a database uri and returns a list of
datasources.
|
static void |
main(java.lang.String[] args) |
Entry to invoke PMD as command line tool
|
static RuleContext |
newRuleContext(java.lang.String sourceCodeFilename,
java.io.File sourceCodeFile) |
Creates a new rule context, initialized with a new, empty report.
|
static Parser |
parserFor(LanguageVersion languageVersion,
PMDConfiguration configuration) |
Helper method to get a configured parser for the requested language.
|
static void |
processFiles(PMDConfiguration configuration,
RuleSetFactory ruleSetFactory,
java.util.List<DataSource> files,
RuleContext ctx,
java.util.List<Renderer> renderers) |
Run PMD on a list of files using multiple threads - if more than one is
available
|
static int |
run(java.lang.String[] args) |
Parses the command line arguments and executes PMD.
|
public static final java.lang.String EOL
public static final java.lang.String SUPPRESS_MARKER
protected final PMDConfiguration configuration
@Deprecated public static final java.lang.String VERSION
PMDVersion.VERSION instead.public PMD()
public PMD(PMDConfiguration configuration)
configuration - The runtime Configuration of PMD to use.public static java.util.List<DataSource> getURIDataSources(java.lang.String uriString) throws PMDException
uriString - the URI to parsePMDException - if the URI couldn't be parsedDBURIpublic static Parser parserFor(LanguageVersion languageVersion, PMDConfiguration configuration)
PMDConfiguration.languageVersion - the requested languageconfiguration - the given configurationpublic PMDConfiguration getConfiguration()
PMDConfigurationpublic SourceCodeProcessor getSourceCodeProcessor()
public static int doPMD(PMDConfiguration configuration)
configuration - the configure to usepublic static RuleContext newRuleContext(java.lang.String sourceCodeFilename, java.io.File sourceCodeFile)
sourceCodeFilename - the source code filenamesourceCodeFile - the source code filepublic static void processFiles(PMDConfiguration configuration, RuleSetFactory ruleSetFactory, java.util.List<DataSource> files, RuleContext ctx, java.util.List<Renderer> renderers)
configuration - ConfigurationruleSetFactory - RuleSetFactoryfiles - List of DataSourcesctx - RuleContextrenderers - List of Rendererspublic static java.util.List<DataSource> getApplicableFiles(PMDConfiguration configuration, java.util.Set<Language> languages)
configuration - contains either the file path or the DB URI, from where to
load the fileslanguages - used to filter by file extensionDataSource of filespublic static void main(java.lang.String[] args)
args - command line argumentspublic static int run(java.lang.String[] args)
args - command line arguments0 means successful execution,
1 means error, 4 means there have been
violations found.Copyright © 2002–2018 PMD. All rights reserved.