public class PMDConfiguration extends AbstractConfiguration
The aspects related to generic PMD behavior:
PMD.SUPPRESS_MARKER
.
getSuppressMarker()
getThreads()
getClassLoader()
prependClasspath(String)
getLanguageVersionDiscoverer()
The aspects related to Rules and Source files are:
getRuleSets()
RulePriority.LOW
.
getMinimumPriority()
System.getProperty("file.encoding")
.
AbstractConfiguration.getSourceEncoding()
getInputPaths()
getReportFormat()
getReportFile()
false
.
isReportShortNames()
getReportProperties()
isShowSuppressedViolations()
The aspects related to special PMD behavior are:
AbstractConfiguration.isDebug()
isStressTest()
isBenchmark()
Constructor and Description |
---|
PMDConfiguration() |
Modifier and Type | Method and Description |
---|---|
Renderer |
createRenderer()
Create a Renderer instance based upon the configured reporting options.
|
Renderer |
createRenderer(boolean withReportWriter)
Create a Renderer instance based upon the configured reporting options.
|
ClassLoader |
getClassLoader()
Get the ClassLoader being used by PMD when processing Rules.
|
String |
getInputPaths()
Get the comma separated list of input paths to process for source files.
|
String |
getInputUri()
Get the input URI to process for source code objects.
|
LanguageVersionDiscoverer |
getLanguageVersionDiscoverer()
Get the LanguageVersionDiscoverer, used to determine the LanguageVersion
of a source file.
|
LanguageVersion |
getLanguageVersionOfFile(String fileName)
Get the LanguageVersion of the source file with given name.
|
RulePriority |
getMinimumPriority()
Get the minimum priority threshold when loading Rules from RuleSets.
|
String |
getReportFile()
Get the file to which the report should render.
|
String |
getReportFormat()
Get the report format.
|
Properties |
getReportProperties()
Get the Report properties.
|
String |
getRuleSets()
Get the comma separated list of RuleSet URIs.
|
String |
getSuppressMarker()
Get the suppress marker.
|
int |
getThreads()
Get the number of threads to use when processing Rules.
|
boolean |
isBenchmark()
Return the benchmark indicator.
|
boolean |
isFailOnViolation()
Whether PMD should exit with status 4 (the default behavior, true) if violations
are found or just with 0 (to not break the build, e.g.).
|
boolean |
isReportShortNames()
Get whether to use File short names in Reports.
|
boolean |
isShowSuppressedViolations()
Get whether the report should show suppressed violations.
|
boolean |
isStressTest()
Return the stress test indicator.
|
void |
prependClasspath(String classpath)
Prepend the specified classpath like string to the current ClassLoader of
the configuration.
|
void |
setBenchmark(boolean benchmark)
Set the benchmark indicator.
|
void |
setClassLoader(ClassLoader classLoader)
Set the ClassLoader being used by PMD when processing Rules.
|
void |
setDefaultLanguageVersion(LanguageVersion languageVersion)
Set the given LanguageVersion as the current default for it's Language.
|
void |
setDefaultLanguageVersions(List<LanguageVersion> languageVersions)
Set the given LanguageVersions as the current default for their
Languages.
|
void |
setFailOnViolation(boolean failOnViolation)
Sets whether PMD should exit with status 4 (the default behavior, true) if violations
are found or just with 0 (to not break the build, e.g.).
|
void |
setInputPaths(String inputPaths)
Set the comma separated list of input paths to process for source files.
|
void |
setInputUri(String inputUri)
Set the input URI to process for source code objects.
|
void |
setMinimumPriority(RulePriority minimumPriority)
Set the minimum priority threshold when loading Rules from RuleSets.
|
void |
setReportFile(String reportFile)
Set the file to which the report should render.
|
void |
setReportFormat(String reportFormat)
Set the report format.
|
void |
setReportProperties(Properties reportProperties)
Set the Report properties.
|
void |
setReportShortNames(boolean reportShortNames)
Set whether to use File short names in Reports.
|
void |
setRuleSets(String ruleSets)
Set the comma separated list of RuleSet URIs.
|
void |
setShowSuppressedViolations(boolean showSuppressedViolations)
Set whether the report should show suppressed violations.
|
void |
setStressTest(boolean stressTest)
Set the stress test indicator.
|
void |
setSuppressMarker(String suppressMarker)
Set the suppress marker.
|
void |
setThreads(int threads)
Set the number of threads to use when processing Rules.
|
getSourceEncoding, isDebug, setDebug, setSourceEncoding
public String getSuppressMarker()
public void setSuppressMarker(String suppressMarker)
suppressMarker
- The suppress marker to use.public int getThreads()
public void setThreads(int threads)
threads
- The number of threads.public ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
null
will cause the default ClassLoader to be used.classLoader
- The ClassLoader to usepublic void prependClasspath(String classpath) throws IOException
PMDConfiguration
class will be used
as the parent ClassLoader of the created ClassLoader.
If the classpath String looks like a URL to a file (i.e. starts with
file://
) the file will be read with each line representing
an entry on the classpath.
classpath
- The prepended classpath.IOException
- if the given classpath is invalid (e.g. does not exist)setClassLoader(ClassLoader)
,
ClasspathClassLoader
public LanguageVersionDiscoverer getLanguageVersionDiscoverer()
public void setDefaultLanguageVersion(LanguageVersion languageVersion)
languageVersion
- the LanguageVersionpublic void setDefaultLanguageVersions(List<LanguageVersion> languageVersions)
languageVersions
- The LanguageVersions.public LanguageVersion getLanguageVersionOfFile(String fileName)
fileName
- Name of the file, can be absolute, or simple.public String getRuleSets()
public void setRuleSets(String ruleSets)
ruleSets
- the rulesets to setpublic RulePriority getMinimumPriority()
public void setMinimumPriority(RulePriority minimumPriority)
minimumPriority
- The minimum priority.public String getInputPaths()
public void setInputPaths(String inputPaths)
inputPaths
- The comma separated list.public String getInputUri()
public void setInputUri(String inputUri)
inputUri
- a single URIpublic boolean isReportShortNames()
true
when using short names in reports.public void setReportShortNames(boolean reportShortNames)
reportShortNames
- true
when using short names in reports.public Renderer createRenderer()
public Renderer createRenderer(boolean withReportWriter)
withReportWriter
- whether to configure a writer or notpublic String getReportFormat()
public void setReportFormat(String reportFormat)
reportFormat
- The report format.Renderer
public String getReportFile()
public void setReportFile(String reportFile)
reportFile
- the file to setpublic boolean isShowSuppressedViolations()
true
if showing suppressed violations,
false
otherwise.public void setShowSuppressedViolations(boolean showSuppressedViolations)
showSuppressedViolations
- true
if showing suppressed violations,
false
otherwise.public Properties getReportProperties()
public void setReportProperties(Properties reportProperties)
reportProperties
- The Report properties to set.public boolean isStressTest()
true
then
PMD will randomize the order of file processing to attempt to shake out
bugs.true
if stress test is enbaled, false
otherwise.public void setStressTest(boolean stressTest)
stressTest
- The stree test indicator to set.isStressTest()
public boolean isBenchmark()
true
then
PMD will log benchmark information.true
if benchmark logging is enbaled,
false
otherwise.public void setBenchmark(boolean benchmark)
benchmark
- The benchmark indicator to set.isBenchmark()
public boolean isFailOnViolation()
public void setFailOnViolation(boolean failOnViolation)
failOnViolation
- failOnViolationCopyright © 2002-2015 InfoEther. All Rights Reserved.