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()
RuleSetFactoryCompatibility
filter
should be used or not: #isRuleSetFactoryCompatibilityEnabled;
getReportFormat()
getReportFile()
false
. isReportShortNames()
getReportProperties()
isShowSuppressedViolations()
The aspects related to special PMD behavior are:
AbstractConfiguration.isDebug()
isStressTest()
isBenchmark()
Constructor | Description |
---|---|
PMDConfiguration() |
Modifier and Type | Method | 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.
|
AnalysisCache |
getAnalysisCache() |
Retrieves the currently used analysis cache.
|
java.lang.ClassLoader |
getClassLoader() |
Get the ClassLoader being used by PMD when processing Rules.
|
java.lang.String |
getInputFilePath() |
|
java.lang.String |
getInputPaths() |
Get the comma separated list of input paths to process for source files.
|
java.lang.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(java.lang.String fileName) |
Get the LanguageVersion of the source file with given name.
|
RulePriority |
getMinimumPriority() |
Get the minimum priority threshold when loading Rules from RuleSets.
|
java.lang.String |
getReportFile() |
Get the file to which the report should render.
|
java.lang.String |
getReportFormat() |
Get the report format.
|
java.util.Properties |
getReportProperties() |
Get the Report properties.
|
java.lang.String |
getRuleSets() |
Get the comma separated list of RuleSet URIs.
|
java.lang.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 |
isRuleSetFactoryCompatibilityEnabled() |
Checks if the rule set factory compatibility feature is enabled.
|
boolean |
isShowSuppressedViolations() |
Get whether the report should show suppressed violations.
|
boolean |
isStressTest() |
Return the stress test indicator.
|
void |
prependClasspath(java.lang.String classpath) |
Prepend the specified classpath like string to the current ClassLoader of
the configuration.
|
void |
setAnalysisCache(AnalysisCache cache) |
Sets the analysis cache to be used.
|
void |
setAnalysisCacheLocation(java.lang.String cacheLocation) |
Sets the location of the analysis cache to be used.
|
void |
setBenchmark(boolean benchmark) |
Set the benchmark indicator.
|
void |
setClassLoader(java.lang.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(java.util.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 |
setInputFilePath(java.lang.String inputFilePath) |
The input file path points to a single file, which contains a
comma-separated list of source file names to process.
|
void |
setInputPaths(java.lang.String inputPaths) |
Set the comma separated list of input paths to process for source files.
|
void |
setInputUri(java.lang.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(java.lang.String reportFile) |
Set the file to which the report should render.
|
void |
setReportFormat(java.lang.String reportFormat) |
Set the report format.
|
void |
setReportProperties(java.util.Properties reportProperties) |
Set the Report properties.
|
void |
setReportShortNames(boolean reportShortNames) |
Set whether to use File short names in Reports.
|
void |
setRuleSetFactoryCompatibilityEnabled(boolean ruleSetFactoryCompatibilityEnabled) |
Sets the rule set factory compatibility feature enabled/disabled.
|
void |
setRuleSets(java.lang.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(java.lang.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 java.lang.String getSuppressMarker()
public void setSuppressMarker(java.lang.String suppressMarker)
suppressMarker
- The suppress marker to use.public int getThreads()
public void setThreads(int threads)
threads
- The number of threads.public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader classLoader)
null
will cause the default ClassLoader to be used.classLoader
- The ClassLoader to usepublic void prependClasspath(java.lang.String classpath) throws java.io.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.java.io.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(java.util.List<LanguageVersion> languageVersions)
languageVersions
- The LanguageVersions.public LanguageVersion getLanguageVersionOfFile(java.lang.String fileName)
For compatibility with older code that does not always pass in a correct filename, unrecognized files are assumed to be java files.
fileName
- Name of the file, can be absolute, or simple.public java.lang.String getRuleSets()
public void setRuleSets(java.lang.String ruleSets)
ruleSets
- the rulesets to setpublic RulePriority getMinimumPriority()
public void setMinimumPriority(RulePriority minimumPriority)
minimumPriority
- The minimum priority.public java.lang.String getInputPaths()
public void setInputPaths(java.lang.String inputPaths)
inputPaths
- The comma separated list.public java.lang.String getInputFilePath()
public void setInputFilePath(java.lang.String inputFilePath)
inputFilePath
- path to the filepublic java.lang.String getInputUri()
public void setInputUri(java.lang.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 java.lang.String getReportFormat()
public void setReportFormat(java.lang.String reportFormat)
reportFormat
- The report format.Renderer
public java.lang.String getReportFile()
public void setReportFile(java.lang.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 java.util.Properties getReportProperties()
public void setReportProperties(java.util.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
- failOnViolationpublic boolean isRuleSetFactoryCompatibilityEnabled()
RuleSetFactoryCompatibility
public void setRuleSetFactoryCompatibilityEnabled(boolean ruleSetFactoryCompatibilityEnabled)
ruleSetFactoryCompatibilityEnabled
- true
if the feature should be enabledRuleSetFactoryCompatibility
public AnalysisCache getAnalysisCache()
public void setAnalysisCache(AnalysisCache cache)
null
will cause a Noop AnalysisCache to be used.cache
- The analysis cache to be used.public void setAnalysisCacheLocation(java.lang.String cacheLocation)
cacheLocation
- The location of the analysis cache to be used.Copyright © 2002–2018 PMD. All rights reserved.