Class CheckstyleReportGenerator
java.lang.Object
org.apache.maven.plugins.checkstyle.CheckstyleReportGenerator
Generate a report based on CheckstyleResults.
- Version:
- $Id$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final File
private final ResourceBundle
private com.puppycrawl.tools.checkstyle.api.Configuration
private boolean
private boolean
private boolean
private boolean
private final IconTool
private org.apache.maven.plugin.logging.Log
private final String
private com.puppycrawl.tools.checkstyle.api.SeverityLevel
private final org.apache.maven.doxia.sink.Sink
private final org.apache.maven.doxia.tools.SiteTool
private String
-
Constructor Summary
ConstructorsConstructorDescriptionCheckstyleReportGenerator
(org.apache.maven.doxia.sink.Sink sink, ResourceBundle bundle, File basedir, org.apache.maven.doxia.tools.SiteTool siteTool, String ruleset) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
doDetails
(CheckstyleResults results) private void
doFileEvents
(List<com.puppycrawl.tools.checkstyle.api.AuditEvent> eventList, String filename) private void
doFilesSummary
(CheckstyleResults results) private void
private void
doRuleRow
(CheckstyleReportGenerator.ConfReference ref, CheckstyleResults results, String previousCategory) Create a summary for one Checkstyle rule.private void
doRulesSummary
(CheckstyleResults results) Create the rules summary section of the report.private void
doSeveritySummary
(CheckstyleResults results) void
generateReport
(CheckstyleResults results) com.puppycrawl.tools.checkstyle.api.Configuration
private String
Get the effective Checkstyle version at runtime.private String
getConfigAttribute
(com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportGenerator.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parentConfiguration, String attributeName, String defaultValue) Get the value of the specified attribute from the Checkstyle configuration.org.apache.maven.plugin.logging.Log
getLog()
com.puppycrawl.tools.checkstyle.api.SeverityLevel
private String
getTitle()
boolean
boolean
boolean
boolean
boolean
matchRule
(com.puppycrawl.tools.checkstyle.api.AuditEvent event, String ruleName, String expectedMessage, String expectedSeverity) Check if a violation matches a rule.void
setCheckstyleConfig
(com.puppycrawl.tools.checkstyle.api.Configuration config) void
setEnableFilesSummary
(boolean enableFilesSummary) void
setEnableRSS
(boolean enableRSS) void
setEnableRulesSummary
(boolean enableRulesSummary) void
setEnableSeveritySummary
(boolean enableSeveritySummary) void
setLog
(org.apache.maven.plugin.logging.Log log) void
setSeverityLevel
(com.puppycrawl.tools.checkstyle.api.SeverityLevel severityLevel) void
setTreeWalkerNames
(List<String> treeWalkerNames) void
setXrefLocation
(String xrefLocation) private void
sortConfiguration
(List<CheckstyleReportGenerator.ConfReference> result, com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportGenerator.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parent, CheckstyleResults results) sortConfiguration
(CheckstyleResults results)
-
Field Details
-
log
private org.apache.maven.plugin.logging.Log log -
basedir
-
bundle
-
sink
private final org.apache.maven.doxia.sink.Sink sink -
severityLevel
private com.puppycrawl.tools.checkstyle.api.SeverityLevel severityLevel -
checkstyleConfig
private com.puppycrawl.tools.checkstyle.api.Configuration checkstyleConfig -
enableRulesSummary
private boolean enableRulesSummary -
enableSeveritySummary
private boolean enableSeveritySummary -
enableFilesSummary
private boolean enableFilesSummary -
enableRSS
private boolean enableRSS -
siteTool
private final org.apache.maven.doxia.tools.SiteTool siteTool -
xrefLocation
-
treeWalkerNames
-
iconTool
-
ruleset
-
-
Constructor Details
-
CheckstyleReportGenerator
public CheckstyleReportGenerator(org.apache.maven.doxia.sink.Sink sink, ResourceBundle bundle, File basedir, org.apache.maven.doxia.tools.SiteTool siteTool, String ruleset)
-
-
Method Details
-
getLog
public org.apache.maven.plugin.logging.Log getLog() -
setLog
public void setLog(org.apache.maven.plugin.logging.Log log) -
getTitle
-
generateReport
-
doHeading
private void doHeading() -
getConfigAttribute
private String getConfigAttribute(com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportGenerator.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parentConfiguration, String attributeName, String defaultValue) Get the value of the specified attribute from the Checkstyle configuration. If parentConfigurations is non-null and non-empty, the parent configurations are searched if the attribute cannot be found in the current configuration. If the attribute is still not found, the specified default value will be returned.- Parameters:
config
- The current Checkstyle configurationparentConfiguration
- The configuration of the parent of the current configurationattributeName
- The name of the attributedefaultValue
- The default value to use if the attribute cannot be found in any configuration- Returns:
- The value of the specified attribute
-
doRulesSummary
Create the rules summary section of the report.- Parameters:
results
- The results to summarize
-
doRuleRow
private void doRuleRow(CheckstyleReportGenerator.ConfReference ref, CheckstyleResults results, String previousCategory) Create a summary for one Checkstyle rule.- Parameters:
ref
- The configuration reference for the rowresults
- The results to summarizepreviousCategory
- The previous row's category
-
matchRule
public boolean matchRule(com.puppycrawl.tools.checkstyle.api.AuditEvent event, String ruleName, String expectedMessage, String expectedSeverity) Check if a violation matches a rule.- Parameters:
event
- the violation to checkruleName
- The name of the ruleexpectedMessage
- A message that, if it's not null, will be matched to the message from the violationexpectedSeverity
- A severity that, if it's not null, will be matched to the severity from the violation- Returns:
- The number of rule violations
-
doSeveritySummary
-
doFilesSummary
-
doDetails
-
doFileEvents
-
getSeverityLevel
public com.puppycrawl.tools.checkstyle.api.SeverityLevel getSeverityLevel() -
setSeverityLevel
public void setSeverityLevel(com.puppycrawl.tools.checkstyle.api.SeverityLevel severityLevel) -
isEnableRulesSummary
public boolean isEnableRulesSummary() -
setEnableRulesSummary
public void setEnableRulesSummary(boolean enableRulesSummary) -
isEnableSeveritySummary
public boolean isEnableSeveritySummary() -
setEnableSeveritySummary
public void setEnableSeveritySummary(boolean enableSeveritySummary) -
isEnableFilesSummary
public boolean isEnableFilesSummary() -
setEnableFilesSummary
public void setEnableFilesSummary(boolean enableFilesSummary) -
isEnableRSS
public boolean isEnableRSS() -
setEnableRSS
public void setEnableRSS(boolean enableRSS) -
getXrefLocation
-
setXrefLocation
-
getCheckstyleConfig
public com.puppycrawl.tools.checkstyle.api.Configuration getCheckstyleConfig() -
setCheckstyleConfig
public void setCheckstyleConfig(com.puppycrawl.tools.checkstyle.api.Configuration config) -
setTreeWalkerNames
-
getTreeWalkerNames
-
getCheckstyleVersion
Get the effective Checkstyle version at runtime.- Returns:
- the MANIFEST implementation version of Checkstyle API package (can be
null
)
-
sortConfiguration
-
sortConfiguration
private void sortConfiguration(List<CheckstyleReportGenerator.ConfReference> result, com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportGenerator.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parent, CheckstyleResults results)
-