4040
4141/**
4242 * Generate a report based on CheckstyleResults.
43- *
44- *
4543 */
4644public class CheckstyleReportRenderer extends AbstractMavenReportRenderer {
4745 private static final int NO_TEXT = 0 ;
@@ -120,6 +118,7 @@ private String getI18nString(String key) {
120118 return i18n .getString ("checkstyle-report" , locale , "report.checkstyle." + key );
121119 }
122120
121+ @ Override
123122 protected void renderBody () {
124123 startSection (getTitle ());
125124
@@ -150,31 +149,31 @@ protected void renderBody() {
150149 }
151150
152151 /**
153- * Get the value of the specified attribute from the Checkstyle configuration.
152+ * Get the value of the specified property from the Checkstyle configuration.
154153 * If parentConfigurations is non-null and non-empty, the parent
155- * configurations are searched if the attribute cannot be found in the
156- * current configuration. If the attribute is still not found, the
154+ * configurations are searched if the property cannot be found in the
155+ * current configuration. If the property is still not found, the
157156 * specified default value will be returned.
158157 *
159- * @param config The current Checkstyle configuration
160- * @param parentConfiguration The configuration of the parent of the current configuration
161- * @param attributeName The name of the attribute
162- * @param defaultValue The default value to use if the attribute cannot be found in any configuration
163- * @return The value of the specified attribute
158+ * @param config the current Checkstyle configuration
159+ * @param parentConfiguration the configuration of the parent of the current configuration
160+ * @param propertyName the name of the property
161+ * @param defaultValue the default value to use if the property cannot be found in any configuration
162+ * @return the value of the specified property
164163 */
165- private String getConfigAttribute (
164+ private String getConfigProperty (
166165 Configuration config ,
167166 ChainedItem <Configuration > parentConfiguration ,
168- String attributeName ,
167+ String propertyName ,
169168 String defaultValue ) {
170169 String ret ;
171170 try {
172- ret = config .getAttribute ( attributeName );
171+ ret = config .getProperty ( propertyName );
173172 } catch (CheckstyleException e ) {
174- // Try to find the attribute in a parent, if there are any
173+ // Try to find the property in a parent, if there are any
175174 if (parentConfiguration != null ) {
176- ret = getConfigAttribute (
177- parentConfiguration .value , parentConfiguration .parent , attributeName , defaultValue );
175+ ret = getConfigProperty (
176+ parentConfiguration .value , parentConfiguration .parent , propertyName , defaultValue );
178177 } else {
179178 ret = defaultValue ;
180179 }
@@ -185,7 +184,7 @@ private String getConfigAttribute(
185184 /**
186185 * Create the rules summary section of the report.
187186 *
188- * @param results The results to summarize
187+ * @param results the results to summarize
189188 */
190189 private void renderRulesSummarySection () {
191190 if (!enableRulesSummary ) {
@@ -256,16 +255,16 @@ private void renderRuleRow(ConfReference ref, CheckstyleResults results, String
256255 sink .text (ruleName );
257256 }
258257
259- List <String > attribnames = new ArrayList <>(Arrays .asList (checkerConfig .getAttributeNames ()));
260- attribnames .remove ("severity" ); // special value (deserves unique column)
261- if (!attribnames .isEmpty ()) {
258+ List <String > propertyNames = new ArrayList <>(Arrays .asList (checkerConfig .getPropertyNames ()));
259+ propertyNames .remove ("severity" ); // special value (deserves unique column)
260+ if (!propertyNames .isEmpty ()) {
262261 sink .list ();
263- for (String name : attribnames ) {
262+ for (String name : propertyNames ) {
264263 sink .listItem ();
265264
266265 sink .text (name );
267266
268- String value = getConfigAttribute (checkerConfig , null , name , "" );
267+ String value = getConfigProperty (checkerConfig , null , name , "" );
269268 // special case, Header.header and RegexpHeader.header
270269 if ("header" .equals (name ) && ("Header" .equals (ruleName ) || "RegexpHeader" .equals (ruleName ))) {
271270 String [] lines = StringUtils .split (value , "\\ n" );
@@ -316,7 +315,7 @@ private void renderRuleRow(ConfReference ref, CheckstyleResults results, String
316315 sink .tableCell ();
317316 // Grab the severity from the rule configuration, this time use error as default value
318317 // Also pass along all parent configurations, so that we can try to find the severity there
319- String severity = getConfigAttribute (checkerConfig , parentConfiguration , "severity" , "error" );
318+ String severity = getConfigProperty (checkerConfig , parentConfiguration , "severity" , "error" );
320319 iconSeverity (severity , TEXT_SIMPLE );
321320 sink .tableCell_ ();
322321
@@ -626,11 +625,11 @@ private void sortConfiguration(
626625 // special sub-case: TreeWalker is the parent of multiple rules, not an effective rule
627626 sortConfiguration (result , childConfig , new ChainedItem <>(config , parent ), results );
628627 } else {
629- String fixedmessage = getConfigAttribute (childConfig , null , "message" , null );
628+ String fixedmessage = getConfigProperty (childConfig , null , "message" , null );
630629 // Grab the severity from the rule configuration. Do not set default value here as
631630 // it breaks our rule aggregate section entirely. The counts are off but this is
632631 // not appropriate fix location per MCHECKSTYLE-365.
633- String configSeverity = getConfigAttribute (childConfig , null , "severity" , null );
632+ String configSeverity = getConfigProperty (childConfig , null , "severity" , null );
634633
635634 // count rule violations
636635 long violations = 0 ;
@@ -674,6 +673,7 @@ private static class ConfReference implements Comparable<ConfReference> {
674673 this .count = count ;
675674 }
676675
676+ @ Override
677677 public int compareTo (ConfReference o ) {
678678 int compare = category .compareTo (o .category );
679679 if (compare == 0 ) {
0 commit comments