Class CheckstyleReportRenderer
java.lang.Object
org.apache.maven.reporting.AbstractMavenReportRenderer
org.apache.maven.plugins.checkstyle.CheckstyleReportRenderer
- All Implemented Interfaces:
org.apache.maven.reporting.MavenReportRenderer
public class CheckstyleReportRenderer
extends org.apache.maven.reporting.AbstractMavenReportRenderer
Generate a report based on CheckstyleResults.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.puppycrawl.tools.checkstyle.api.Configurationprivate final booleanprivate final booleanprivate final booleanprivate final org.codehaus.plexus.i18n.I18Nprivate final Localeprivate static final intprivate final org.apache.maven.project.MavenProjectprivate final CheckstyleResultsprivate final Stringprivate final org.apache.maven.doxia.tools.SiteToolprivate static final intprivate static final intprivate static final intprivate Stringprivate StringFields inherited from class org.apache.maven.reporting.AbstractMavenReportRenderer
sink -
Constructor Summary
ConstructorsConstructorDescriptionCheckstyleReportRenderer(org.apache.maven.doxia.sink.Sink sink, org.codehaus.plexus.i18n.I18N i18n, Locale locale, org.apache.maven.project.MavenProject project, org.apache.maven.doxia.tools.SiteTool siteTool, String ruleset, String xrefLocation, String xrefTestLocation, List<File> testSourceDirectories, boolean enableRulesSummary, boolean enableSeveritySummary, boolean enableFilesSummary, CheckstyleResults results) -
Method Summary
Modifier and TypeMethodDescriptionprivate StringGet the effective Checkstyle version at runtime.private StringgetConfigAttribute(com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportRenderer.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parentConfiguration, String attributeName, String defaultValue) Get the value of the specified attribute from the Checkstyle configuration.private StringgetEffectiveXrefLocation(List<com.puppycrawl.tools.checkstyle.api.AuditEvent> eventList) private StringgetI18nString(String key) getTitle()private voidiconSeverity(String level, int textType) Render an icon of given level with associated text.private booleanisTestSource(String absoluteFilename) booleanmatchRule(com.puppycrawl.tools.checkstyle.api.AuditEvent event, String ruleName, String expectedMessage, String expectedSeverity) Check if a violation matches a rule.protected voidprivate voidprivate voidrenderFileEvents(List<com.puppycrawl.tools.checkstyle.api.AuditEvent> eventList, String filename) private voidprivate voidrenderRuleRow(CheckstyleReportRenderer.ConfReference ref, CheckstyleResults results, String previousCategory) Create a summary for one Checkstyle rule.private voidCreate the rules summary section of the report.private voidvoidsetTreeWalkerNames(List<String> treeWalkerNames) private voidsortConfiguration(List<CheckstyleReportRenderer.ConfReference> result, com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportRenderer.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parent, CheckstyleResults results) sortConfiguration(CheckstyleResults results) Methods inherited from class org.apache.maven.reporting.AbstractMavenReportRenderer
createLinkPatternedText, endSection, endTable, javaScript, link, linkPatternedText, paragraph, propertiesToString, render, startSection, startSection, startTable, startTable, tableCaption, tableCell, tableCell, tableHeader, tableHeaderCell, tableRow, text, verbatimLink, verbatimSource, verbatimText
-
Field Details
-
NO_TEXT
private static final int NO_TEXT- See Also:
-
TEXT_SIMPLE
private static final int TEXT_SIMPLE- See Also:
-
TEXT_TITLE
private static final int TEXT_TITLE- See Also:
-
TEXT_ABBREV
private static final int TEXT_ABBREV- See Also:
-
i18n
private final org.codehaus.plexus.i18n.I18N i18n -
locale
-
project
private final org.apache.maven.project.MavenProject project -
checkstyleConfig
private final com.puppycrawl.tools.checkstyle.api.Configuration checkstyleConfig -
enableRulesSummary
private final boolean enableRulesSummary -
enableSeveritySummary
private final boolean enableSeveritySummary -
enableFilesSummary
private final boolean enableFilesSummary -
siteTool
private final org.apache.maven.doxia.tools.SiteTool siteTool -
xrefLocation
-
xrefTestLocation
-
testSourceDirectories
-
treeWalkerNames
-
ruleset
-
results
-
-
Constructor Details
-
CheckstyleReportRenderer
public CheckstyleReportRenderer(org.apache.maven.doxia.sink.Sink sink, org.codehaus.plexus.i18n.I18N i18n, Locale locale, org.apache.maven.project.MavenProject project, org.apache.maven.doxia.tools.SiteTool siteTool, String ruleset, String xrefLocation, String xrefTestLocation, List<File> testSourceDirectories, boolean enableRulesSummary, boolean enableSeveritySummary, boolean enableFilesSummary, CheckstyleResults results)
-
-
Method Details
-
getTitle
- Specified by:
getTitlein interfaceorg.apache.maven.reporting.MavenReportRenderer- Specified by:
getTitlein classorg.apache.maven.reporting.AbstractMavenReportRenderer
-
getI18nString
- Parameters:
key- The key.- Returns:
- The translated string.
-
renderBody
protected void renderBody()- Specified by:
renderBodyin classorg.apache.maven.reporting.AbstractMavenReportRenderer
-
getConfigAttribute
private String getConfigAttribute(com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportRenderer.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
-
renderRulesSummarySection
private void renderRulesSummarySection()Create the rules summary section of the report.- Parameters:
results- The results to summarize
-
renderRuleRow
private void renderRuleRow(CheckstyleReportRenderer.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
-
renderSeveritySummarySection
private void renderSeveritySummarySection() -
renderFilesSummarySection
private void renderFilesSummarySection() -
renderDetailsSection
private void renderDetailsSection() -
renderFileEvents
-
getEffectiveXrefLocation
-
isTestSource
-
setTreeWalkerNames
-
iconSeverity
Render an icon of given level with associated text.- Parameters:
level- one ofINFO,WARNINGorERRORconstantstextType- one ofNO_TEXT,TEXT_SIMPLE,TEXT_TITLEorTEXT_ABBREVconstants
-
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<CheckstyleReportRenderer.ConfReference> result, com.puppycrawl.tools.checkstyle.api.Configuration config, CheckstyleReportRenderer.ChainedItem<com.puppycrawl.tools.checkstyle.api.Configuration> parent, CheckstyleResults results)
-