public abstract class AbstractCheckstyleReport
extends org.apache.maven.reporting.AbstractMavenReport
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
cacheFile
Specifies the cache file used to speed up Checkstyle on successive runs.
|
protected CheckstyleExecutor |
checkstyleExecutor |
protected CheckstyleRssGenerator |
checkstyleRssGenerator
CheckstyleRssGenerator.
|
protected java.lang.String |
configLocation
Specifies the location of the XML configuration to use.
|
protected boolean |
consoleOutput
Output errors to console.
|
private boolean |
enableFilesSummary
Specifies if the Files summary should be enabled or not.
|
private boolean |
enableRSS
Specifies if the RSS should be enabled or not.
|
private boolean |
enableRulesSummary
Specifies if the Rules summary should be enabled or not.
|
private boolean |
enableSeveritySummary
Specifies if the Severity summary should be enabled or not.
|
protected java.lang.String |
encoding
The file encoding to use when reading the source files.
|
protected java.lang.String |
excludes
Specifies the names filter of the source files to be excluded for
Checkstyle.
|
protected boolean |
failsOnError
Specifies if the build should fail upon a violation.
|
protected java.lang.String |
headerLocation
Specifies the location of the License file (a.k.a.
|
protected boolean |
includeResources
Specifies whether to include the resource directories in the check.
|
protected java.lang.String |
includes
Specifies the names filter of the source files to be used for Checkstyle.
|
protected boolean |
includeTestResources
Specifies whether to include the test resource directories in the check.
|
protected boolean |
includeTestSourceDirectory
Include or not the test source directory/directories to be used for Checkstyle.
|
protected static java.lang.String |
JAVA_FILES |
private boolean |
linkXRef
Link the violation line numbers to the source xref.
|
protected org.codehaus.plexus.resource.ResourceManager |
locator |
private boolean |
omitIgnoredModules
Specifies whether modules with a configured severity of
ignore should be omitted during Checkstyle
invocation. |
private java.io.File |
outputFile
Specifies the path and filename to save the Checkstyle output.
|
private java.lang.String |
outputFileFormat
Specifies the format of the output to be used when writing to the output
file.
|
private org.apache.maven.plugin.descriptor.PluginDescriptor |
plugin
The Plugin Descriptor
|
static java.lang.String |
PLUGIN_RESOURCES |
protected java.lang.String |
propertiesLocation
Specifies the location of the properties file.
|
protected java.lang.String |
propertyExpansion
Allows for specifying raw property expansion information.
|
protected java.lang.String |
resourceExcludes
Specifies the names filter of the resource files to be excluded for
Checkstyle.
|
protected java.lang.String |
resourceIncludes
Specifies the names filter of the resource files to be used for Checkstyle.
|
protected java.util.List<org.apache.maven.model.Resource> |
resources
Specifies the location of the resources to be used for Checkstyle.
|
protected org.apache.maven.doxia.tools.SiteTool |
siteTool
SiteTool.
|
protected boolean |
skip
Skip entire check.
|
private java.util.List<java.lang.String> |
sourceDirectories
Specifies the location of the source directories to be used for Checkstyle.
|
private java.io.File |
sourceDirectory
Deprecated.
instead use
sourceDirectories. For version 3.0.0, this parameter is only defined to break
the build if you use it! |
protected java.io.ByteArrayOutputStream |
stringOutputStream |
protected java.lang.String |
suppressionsFileExpression
The key to be used in the properties for the suppressions file.
|
protected java.lang.String |
suppressionsLocation
Specifies the location of the suppressions XML file to use.
|
protected java.util.List<org.apache.maven.model.Resource> |
testResources
Specifies the location of the test resources to be used for Checkstyle.
|
private java.util.List<java.lang.String> |
testSourceDirectories
Specifies the location of the test source directories to be used for Checkstyle.
|
private java.io.File |
testSourceDirectory
Deprecated.
instead use
testSourceDirectories. For version 3.0.0, this parameter is only defined to
break the build if you use it! |
private java.util.List<java.lang.String> |
treeWalkerNames
When using custom treeWalkers, specify their names here so the checks
inside the treeWalker end up the the rule-summary.
|
private java.io.File |
useFile
If
null, the Checkstyle plugin will display violations on stdout. |
private java.io.File |
xrefLocation
Location of the Xrefs to link to.
|
outputDirectory, project, siteRenderer| Constructor and Description |
|---|
AbstractCheckstyleReport() |
| Modifier and Type | Method and Description |
|---|---|
private void |
checkDeprecatedParameterUsage(java.lang.Object parameter,
java.lang.String name,
java.lang.String replacement) |
private java.util.List<org.apache.maven.artifact.Artifact> |
collectArtifacts(java.lang.String hint) |
protected abstract CheckstyleExecutorRequest |
createRequest()
Create the Checkstyle executor request.
|
void |
executeReport(java.util.Locale locale) |
private void |
generateMainReport(CheckstyleResults results,
java.util.ResourceBundle bundle) |
private void |
generateReportStatics() |
private static java.util.ResourceBundle |
getBundle(java.util.Locale locale) |
private java.util.List<org.apache.maven.artifact.Artifact> |
getCheckstylePluginDependenciesAsArtifacts(java.util.Map<java.lang.String,org.apache.maven.model.Plugin> plugins,
java.lang.String hint) |
protected com.puppycrawl.tools.checkstyle.DefaultLogger |
getConsoleListener()
Creates and returns the console listener.
|
private java.lang.String |
getCopyright() |
java.lang.String |
getDescription(java.util.Locale locale) |
protected com.puppycrawl.tools.checkstyle.api.AuditListener |
getListener()
Creates and returns the report generation listener.
|
java.lang.String |
getName(java.util.Locale locale) |
private java.io.OutputStream |
getOutputStream(java.io.File file) |
protected java.util.List<java.io.File> |
getSourceDirectories() |
protected java.util.List<java.io.File> |
getTestSourceDirectories() |
canGenerateReport, closeReport, execute, generate, generate, generate, getCategoryName, getInputEncoding, getOutputDirectory, getOutputEncoding, getProject, getReportOutputDirectory, getSink, getSinkFactory, getSiteRenderer, isExternalReport, setReportOutputDirectorygetLog, getPluginContext, setLog, setPluginContextpublic static final java.lang.String PLUGIN_RESOURCES
protected static final java.lang.String JAVA_FILES
@Parameter(defaultValue="${project.build.directory}/checkstyle-cachefile")
protected java.lang.String cacheFile
@Parameter(property="checkstyle.config.location",
defaultValue="sun_checks.xml")
protected java.lang.String configLocation
Specifies the location of the XML configuration to use.
Potential values are a filesystem path, a URL, or a classpath resource. This parameter expects that the contents of the location conform to the xml format (Checkstyle Checker module) configuration of rulesets.
This parameter is resolved as resource, URL, then file. If successfully
resolved, the contents of the configuration is copied into the
${project.build.directory}/checkstyle-configuration.xml
file before being passed to Checkstyle as a configuration.
There are 2 predefined rulesets included in Maven Checkstyle Plugin:
sun_checks.xml: Sun Checks.google_checks.xml: Google Checks.@Parameter(property="checkstyle.consoleOutput",
defaultValue="false")
protected boolean consoleOutput
@Parameter(property="encoding",
defaultValue="${project.build.sourceEncoding}")
protected java.lang.String encoding
project.build.sourceEncoding
is not set, the platform default encoding is used. Note: This parameter always overrides the
property charset from Checkstyle's TreeWalker module.@Parameter(defaultValue="false") protected boolean failsOnError
@Parameter(property="checkstyle.header.file",
defaultValue="LICENSE.txt")
protected java.lang.String headerLocation
Specifies the location of the License file (a.k.a. the header file) that can be used by Checkstyle to verify that source code has the correct license header.
You need to use ${checkstyle.header.file} in your Checkstyle xml
configuration to reference the name of this header file.
For instance:
<module name="RegexpHeader">
<property name="headerFile" value="${checkstyle.header.file}"/>
</module>
@Parameter(property="checkstyle.skip",
defaultValue="false")
protected boolean skip
@Parameter(property="checkstyle.output.file",
defaultValue="${project.build.directory}/checkstyle-result.xml")
private java.io.File outputFile
outputFileFormat
parameter.@Parameter(property="checkstyle.properties.location") protected java.lang.String propertiesLocation
Specifies the location of the properties file.
This parameter is resolved as URL, File then resource. If successfully
resolved, the contents of the properties location is copied into the
${project.build.directory}/checkstyle-checker.properties
file before being passed to Checkstyle for loading.
The contents of the propertiesLocation will be made
available to Checkstyle for specifying values for parameters within the
xml configuration (specified in the configLocation
parameter).
@Parameter protected java.lang.String propertyExpansion
@Parameter(defaultValue="${project.resources}",
readonly=true)
protected java.util.List<org.apache.maven.model.Resource> resources
@Parameter(defaultValue="${project.testResources}",
readonly=true)
protected java.util.List<org.apache.maven.model.Resource> testResources
@Parameter(property="checkstyle.includes",
defaultValue="**\\/*.java",
required=true)
protected java.lang.String includes
@Parameter(property="checkstyle.excludes") protected java.lang.String excludes
@Parameter(property="checkstyle.resourceIncludes",
defaultValue="**/*.properties",
required=true)
protected java.lang.String resourceIncludes
@Parameter(property="checkstyle.resourceExcludes") protected java.lang.String resourceExcludes
@Parameter(property="checkstyle.includeResources",
defaultValue="true",
required=true)
protected boolean includeResources
@Parameter(property="checkstyle.includeTestResources",
defaultValue="true",
required=true)
protected boolean includeTestResources
@Deprecated @Parameter private java.io.File sourceDirectory
sourceDirectories. For version 3.0.0, this parameter is only defined to break
the build if you use it!@Parameter private java.util.List<java.lang.String> sourceDirectories
${project.compileSourceRoots}.@Parameter @Deprecated private java.io.File testSourceDirectory
testSourceDirectories. For version 3.0.0, this parameter is only defined to
break the build if you use it!@Parameter private java.util.List<java.lang.String> testSourceDirectories
${project.testCompileSourceRoots}.@Parameter(defaultValue="false") protected boolean includeTestSourceDirectory
@Parameter(property="checkstyle.suppression.expression",
defaultValue="checkstyle.suppressions.file")
protected java.lang.String suppressionsFileExpression
@Parameter(property="checkstyle.suppressions.location") protected java.lang.String suppressionsLocation
Specifies the location of the suppressions XML file to use.
This parameter is resolved as resource, URL, then file. If successfully
resolved, the contents of the suppressions XML is copied into the
${project.build.directory}/checkstyle-supressions.xml file
before being passed to Checkstyle for loading.
See suppressionsFileExpression for the property that will
be made available to your Checkstyle configuration.
@Parameter private java.io.File useFile
null, the Checkstyle plugin will display violations on stdout.
Otherwise, a text file will be created with the violations.@Parameter(property="checkstyle.output.format",
defaultValue="xml")
private java.lang.String outputFileFormat
plain" and "xml".@Parameter(property="checkstyle.enable.rules.summary",
defaultValue="true")
private boolean enableRulesSummary
@Parameter(property="checkstyle.enable.severity.summary",
defaultValue="true")
private boolean enableSeveritySummary
@Parameter(property="checkstyle.enable.files.summary",
defaultValue="true")
private boolean enableFilesSummary
@Parameter(property="checkstyle.enable.rss",
defaultValue="true")
private boolean enableRSS
@Component(role=org.apache.maven.doxia.tools.SiteTool.class) protected org.apache.maven.doxia.tools.SiteTool siteTool
@Parameter(defaultValue="${plugin}",
readonly=true,
required=true)
private org.apache.maven.plugin.descriptor.PluginDescriptor plugin
@Parameter(property="linkXRef",
defaultValue="true")
private boolean linkXRef
@Parameter(defaultValue="${project.reporting.outputDirectory}/xref")
private java.io.File xrefLocation
@Parameter private java.util.List<java.lang.String> treeWalkerNames
@Parameter(defaultValue="false") private boolean omitIgnoredModules
ignore should be omitted during Checkstyle
invocation.@Component protected org.codehaus.plexus.resource.ResourceManager locator
@Component(role=CheckstyleRssGenerator.class, hint="default") protected CheckstyleRssGenerator checkstyleRssGenerator
@Component(role=CheckstyleExecutor.class, hint="default") protected CheckstyleExecutor checkstyleExecutor
protected java.io.ByteArrayOutputStream stringOutputStream
public java.lang.String getName(java.util.Locale locale)
public java.lang.String getDescription(java.util.Locale locale)
public void executeReport(java.util.Locale locale)
throws org.apache.maven.reporting.MavenReportException
executeReport in class org.apache.maven.reporting.AbstractMavenReportorg.apache.maven.reporting.MavenReportExceptionprivate void checkDeprecatedParameterUsage(java.lang.Object parameter,
java.lang.String name,
java.lang.String replacement)
throws org.apache.maven.reporting.MavenReportException
org.apache.maven.reporting.MavenReportExceptionprotected abstract CheckstyleExecutorRequest createRequest() throws org.apache.maven.reporting.MavenReportException
org.apache.maven.reporting.MavenReportException - If something goes wrong during creation.private java.util.List<org.apache.maven.artifact.Artifact> collectArtifacts(java.lang.String hint)
private java.util.List<org.apache.maven.artifact.Artifact> getCheckstylePluginDependenciesAsArtifacts(java.util.Map<java.lang.String,org.apache.maven.model.Plugin> plugins,
java.lang.String hint)
protected com.puppycrawl.tools.checkstyle.api.AuditListener getListener()
throws org.apache.maven.reporting.MavenReportException
org.apache.maven.reporting.MavenReportException - If something goes wrong.private java.io.OutputStream getOutputStream(java.io.File file)
throws org.apache.maven.reporting.MavenReportException
org.apache.maven.reporting.MavenReportExceptionprotected com.puppycrawl.tools.checkstyle.DefaultLogger getConsoleListener()
throws org.apache.maven.reporting.MavenReportException
org.apache.maven.reporting.MavenReportException - If something goes wrong.private void generateReportStatics()
throws org.apache.maven.reporting.MavenReportException
org.apache.maven.reporting.MavenReportExceptionprivate java.lang.String getCopyright()
private void generateMainReport(CheckstyleResults results, java.util.ResourceBundle bundle)
private static java.util.ResourceBundle getBundle(java.util.Locale locale)
protected java.util.List<java.io.File> getSourceDirectories()
protected java.util.List<java.io.File> getTestSourceDirectories()