Class CheckstyleReportGenerator
- java.lang.Object
-
- org.apache.maven.plugins.checkstyle.CheckstyleReportGenerator
-
public class CheckstyleReportGenerator extends java.lang.ObjectGenerate a report based on CheckstyleResults.- Version:
- $Id$
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCheckstyleReportGenerator.ChainedItem<T>private static classCheckstyleReportGenerator.ConfReference
-
Field Summary
Fields Modifier and Type Field Description private java.io.Filebasedirprivate java.util.ResourceBundlebundleprivate com.puppycrawl.tools.checkstyle.api.ConfigurationcheckstyleConfigprivate booleanenableFilesSummaryprivate booleanenableRSSprivate booleanenableRulesSummaryprivate booleanenableSeveritySummaryprivate IconTooliconToolprivate org.apache.maven.plugin.logging.Loglogprivate java.lang.Stringrulesetprivate com.puppycrawl.tools.checkstyle.api.SeverityLevelseverityLevelprivate org.apache.maven.doxia.sink.Sinksinkprivate org.apache.maven.doxia.tools.SiteToolsiteToolprivate java.util.List<java.lang.String>treeWalkerNamesprivate java.lang.StringxrefLocation
-
Constructor Summary
Constructors Constructor Description CheckstyleReportGenerator(org.apache.maven.doxia.sink.Sink sink, java.util.ResourceBundle bundle, java.io.File basedir, org.apache.maven.doxia.tools.SiteTool siteTool, java.lang.String ruleset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiddoDetails(CheckstyleResults results)private voiddoFileEvents(java.util.List<com.puppycrawl.tools.checkstyle.api.AuditEvent> eventList, java.lang.String filename)private voiddoFilesSummary(CheckstyleResults results)private voiddoHeading()private voiddoRuleRow(CheckstyleReportGenerator.ConfReference ref, CheckstyleResults results, java.lang.String previousCategory)Create a summary for one Checkstyle rule.private voiddoRulesSummary(CheckstyleResults results)Create the rules summary section of the report.private voiddoSeveritySummary(CheckstyleResults results)voidgenerateReport(CheckstyleResults results)com.puppycrawl.tools.checkstyle.api.ConfigurationgetCheckstyleConfig()private java.lang.StringgetCheckstyleVersion()Get the effective Checkstyle version at runtime.private java.lang.StringgetConfigAttribute(com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportGenerator.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parentConfiguration, java.lang.String attributeName, java.lang.String defaultValue)Get the value of the specified attribute from the Checkstyle configuration.org.apache.maven.plugin.logging.LoggetLog()com.puppycrawl.tools.checkstyle.api.SeverityLevelgetSeverityLevel()private java.lang.StringgetTitle()java.util.List<java.lang.String>getTreeWalkerNames()java.lang.StringgetXrefLocation()booleanisEnableFilesSummary()booleanisEnableRSS()booleanisEnableRulesSummary()booleanisEnableSeveritySummary()booleanmatchRule(com.puppycrawl.tools.checkstyle.api.AuditEvent event, java.lang.String ruleName, java.lang.String expectedMessage, java.lang.String expectedSeverity)Check if a violation matches a rule.voidsetCheckstyleConfig(com.puppycrawl.tools.checkstyle.api.Configuration config)voidsetEnableFilesSummary(boolean enableFilesSummary)voidsetEnableRSS(boolean enableRSS)voidsetEnableRulesSummary(boolean enableRulesSummary)voidsetEnableSeveritySummary(boolean enableSeveritySummary)voidsetLog(org.apache.maven.plugin.logging.Log log)voidsetSeverityLevel(com.puppycrawl.tools.checkstyle.api.SeverityLevel severityLevel)voidsetTreeWalkerNames(java.util.List<java.lang.String> treeWalkerNames)voidsetXrefLocation(java.lang.String xrefLocation)private voidsortConfiguration(java.util.List<CheckstyleReportGenerator.ConfReference> result, com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportGenerator.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parent, CheckstyleResults results)java.util.List<CheckstyleReportGenerator.ConfReference>sortConfiguration(CheckstyleResults results)
-
-
-
Field Detail
-
log
private org.apache.maven.plugin.logging.Log log
-
basedir
private final java.io.File basedir
-
bundle
private final java.util.ResourceBundle 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
private java.lang.String xrefLocation
-
treeWalkerNames
private java.util.List<java.lang.String> treeWalkerNames
-
iconTool
private final IconTool iconTool
-
ruleset
private final java.lang.String ruleset
-
-
Method Detail
-
getLog
public org.apache.maven.plugin.logging.Log getLog()
-
setLog
public void setLog(org.apache.maven.plugin.logging.Log log)
-
getTitle
private java.lang.String getTitle()
-
generateReport
public void generateReport(CheckstyleResults results)
-
doHeading
private void doHeading()
-
getConfigAttribute
private java.lang.String getConfigAttribute(com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportGenerator.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parentConfiguration, java.lang.String attributeName, java.lang.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
private void doRulesSummary(CheckstyleResults results)
Create the rules summary section of the report.- Parameters:
results- The results to summarize
-
doRuleRow
private void doRuleRow(CheckstyleReportGenerator.ConfReference ref, CheckstyleResults results, java.lang.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, java.lang.String ruleName, java.lang.String expectedMessage, java.lang.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
private void doSeveritySummary(CheckstyleResults results)
-
doFilesSummary
private void doFilesSummary(CheckstyleResults results)
-
doDetails
private void doDetails(CheckstyleResults results)
-
doFileEvents
private void doFileEvents(java.util.List<com.puppycrawl.tools.checkstyle.api.AuditEvent> eventList, java.lang.String filename)
-
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
public java.lang.String getXrefLocation()
-
setXrefLocation
public void setXrefLocation(java.lang.String xrefLocation)
-
getCheckstyleConfig
public com.puppycrawl.tools.checkstyle.api.Configuration getCheckstyleConfig()
-
setCheckstyleConfig
public void setCheckstyleConfig(com.puppycrawl.tools.checkstyle.api.Configuration config)
-
setTreeWalkerNames
public void setTreeWalkerNames(java.util.List<java.lang.String> treeWalkerNames)
-
getTreeWalkerNames
public java.util.List<java.lang.String> getTreeWalkerNames()
-
getCheckstyleVersion
private java.lang.String getCheckstyleVersion()
Get the effective Checkstyle version at runtime.- Returns:
- the MANIFEST implementation version of Checkstyle API package (can be
null)
-
sortConfiguration
public java.util.List<CheckstyleReportGenerator.ConfReference> sortConfiguration(CheckstyleResults results)
-
sortConfiguration
private void sortConfiguration(java.util.List<CheckstyleReportGenerator.ConfReference> result, com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportGenerator.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parent, CheckstyleResults results)
-
-