Coverage Report - org.apache.maven.plugin.checkstyle.HelpMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
HelpMojo
0%
0/422
0%
0/70
6,833
 
 1  
 package org.apache.maven.plugin.checkstyle;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.Iterator;
 5  
 import java.util.List;
 6  
 
 7  
 import org.apache.maven.plugin.AbstractMojo;
 8  
 import org.apache.maven.plugin.MojoExecutionException;
 9  
 
 10  
 /**
 11  
  * Display help information on maven-checkstyle-plugin.<br/> Call <pre>  mvn checkstyle:help -Ddetail=true -Dgoal=&lt;goal-name&gt;</pre> to display parameter details.
 12  
  *
 13  
  * @version generated on Wed Feb 22 14:42:38 CET 2012
 14  
  * @author org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.8)
 15  
  * @goal help
 16  
  * @requiresProject false
 17  
  * @threadSafe
 18  
  */
 19  
 @SuppressWarnings( "all" )
 20  0
 public class HelpMojo
 21  
     extends AbstractMojo
 22  
 {
 23  
     /**
 24  
      * If <code>true</code>, display all settable properties for each goal.
 25  
      * 
 26  
      * @parameter expression="${detail}" default-value="false"
 27  
      */
 28  
     private boolean detail;
 29  
 
 30  
     /**
 31  
      * The name of the goal for which to show help. If unspecified, all goals will be displayed.
 32  
      * 
 33  
      * @parameter expression="${goal}"
 34  
      */
 35  
     private java.lang.String goal;
 36  
 
 37  
     /**
 38  
      * The maximum length of a display line, should be positive.
 39  
      * 
 40  
      * @parameter expression="${lineLength}" default-value="80"
 41  
      */
 42  
     private int lineLength;
 43  
 
 44  
     /**
 45  
      * The number of spaces per indentation level, should be positive.
 46  
      * 
 47  
      * @parameter expression="${indentSize}" default-value="2"
 48  
      */
 49  
     private int indentSize;
 50  
 
 51  
 
 52  
     /** {@inheritDoc} */
 53  
     public void execute()
 54  
         throws MojoExecutionException
 55  
     {
 56  0
         if ( lineLength <= 0 )
 57  
         {
 58  0
             getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." );
 59  0
             lineLength = 80;
 60  
         }
 61  0
         if ( indentSize <= 0 )
 62  
         {
 63  0
             getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." );
 64  0
             indentSize = 2;
 65  
         }
 66  
 
 67  0
         StringBuffer sb = new StringBuffer();
 68  
 
 69  0
         append( sb, "org.apache.maven.plugins:maven-checkstyle-plugin:2.9.1", 0 );
 70  0
         append( sb, "", 0 );
 71  
 
 72  0
         append( sb, "Maven Checkstyle Plugin", 0 );
 73  0
         append( sb, "Generates a report on violations of code style and optionally fails the build if violations are detected.", 1 );
 74  0
         append( sb, "", 0 );
 75  
 
 76  0
         if ( goal == null || goal.length() <= 0 )
 77  
         {
 78  0
             append( sb, "This plugin has 4 goals:", 0 );
 79  0
             append( sb, "", 0 );
 80  
         }
 81  
 
 82  0
         if ( goal == null || goal.length() <= 0 || "check".equals( goal ) )
 83  
         {
 84  0
             append( sb, "checkstyle:check", 0 );
 85  0
             append( sb, "Perform a violation check against the last Checkstyle run to see if there are any violations. It reads the Checkstyle output file, counts the number of violations found and displays it on the console.", 1 );
 86  0
             append( sb, "", 0 );
 87  0
             if ( detail )
 88  
             {
 89  0
                 append( sb, "Available parameters:", 1 );
 90  0
                 append( sb, "", 0 );
 91  
 
 92  0
                 append( sb, "cacheFile (Default: ${project.build.directory}/checkstyle-cachefile)", 2 );
 93  0
                 append( sb, "Specifies the cache file used to speed up Checkstyle on successive runs.", 3 );
 94  0
                 append( sb, "", 0 );
 95  
 
 96  0
                 append( sb, "configLocation (Default: config/sun_checks.xml)", 2 );
 97  0
                 append( sb, "Specifies the location of the XML configuration to use.\n\nPotential 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.\n\nThis 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.\n\nThere are 4 predefined rulesets.\n\n-\tconfig/sun_checks.xml: Sun Checks.\n-\tconfig/turbine_checks.xml: Turbine Checks.\n-\tconfig/avalon_checks.xml: Avalon Checks.\n-\tconfig/maven_checks.xml: Maven Source Checks.\n", 3 );
 98  0
                 append( sb, "Expression: ${checkstyle.config.location}", 3 );
 99  0
                 append( sb, "", 0 );
 100  
 
 101  0
                 append( sb, "consoleOutput (Default: false)", 2 );
 102  0
                 append( sb, "Output errors to console.", 3 );
 103  0
                 append( sb, "", 0 );
 104  
 
 105  0
                 append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 );
 106  0
                 append( sb, "The file encoding to use when reading the source files. If the property 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.", 3 );
 107  0
                 append( sb, "Expression: ${encoding}", 3 );
 108  0
                 append( sb, "", 0 );
 109  
 
 110  0
                 append( sb, "excludes", 2 );
 111  0
                 append( sb, "Specifies the names filter of the source files to be excluded for Checkstyle.", 3 );
 112  0
                 append( sb, "Expression: ${checkstyle.excludes}", 3 );
 113  0
                 append( sb, "", 0 );
 114  
 
 115  0
                 append( sb, "failOnViolation (Default: true)", 2 );
 116  0
                 append( sb, "Do we fail the build on a violation?", 3 );
 117  0
                 append( sb, "Expression: ${checkstyle.failOnViolation}", 3 );
 118  0
                 append( sb, "", 0 );
 119  
 
 120  0
                 append( sb, "failsOnError (Default: false)", 2 );
 121  0
                 append( sb, "Specifies if the build should fail upon a violation.", 3 );
 122  0
                 append( sb, "", 0 );
 123  
 
 124  0
                 append( sb, "headerLocation (Default: LICENSE.txt)", 2 );
 125  0
                 append( sb, "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.\n\nYou need to use ${checkstyle.header.file} in your Checkstyle xml configuration to reference the name of this header file.\n\nFor instance:\n\n<module name=\'RegexpHeader\'> <property name=\'headerFile\' value=\'${checkstyle.header.file}\'/> </module>\n", 3 );
 126  0
                 append( sb, "Expression: ${checkstyle.header.file}", 3 );
 127  0
                 append( sb, "", 0 );
 128  
 
 129  0
                 append( sb, "includes (Default: **/*.java)", 2 );
 130  0
                 append( sb, "Specifies the names filter of the source files to be used for Checkstyle.", 3 );
 131  0
                 append( sb, "Required: Yes", 3 );
 132  0
                 append( sb, "Expression: ${checkstyle.includes}", 3 );
 133  0
                 append( sb, "", 0 );
 134  
 
 135  0
                 append( sb, "includeTestSourceDirectory (Default: ${false})", 2 );
 136  0
                 append( sb, "Include or not the test source directory to be used for Checkstyle.", 3 );
 137  0
                 append( sb, "", 0 );
 138  
 
 139  0
                 append( sb, "logViolationsToConsole (Default: false)", 2 );
 140  0
                 append( sb, "Output the detected violations to the console.", 3 );
 141  0
                 append( sb, "Expression: ${checkstyle.console}", 3 );
 142  0
                 append( sb, "", 0 );
 143  
 
 144  0
                 append( sb, "maxAllowedViolations (Default: 0)", 2 );
 145  0
                 append( sb, "The maximum number of allowed violations. The execution fails only if the number of violations is above this limit.", 3 );
 146  0
                 append( sb, "Expression: ${checkstyle.maxAllowedViolations}", 3 );
 147  0
                 append( sb, "", 0 );
 148  
 
 149  0
                 append( sb, "outputFile (Default: ${project.build.directory}/checkstyle-result.xml)", 2 );
 150  0
                 append( sb, "Specifies the path and filename to save the Checkstyle output. The format of the output file is determined by the outputFileFormat parameter.", 3 );
 151  0
                 append( sb, "Expression: ${checkstyle.output.file}", 3 );
 152  0
                 append( sb, "", 0 );
 153  
 
 154  0
                 append( sb, "outputFileFormat (Default: xml)", 2 );
 155  0
                 append( sb, "Specifies the format of the output to be used when writing to the output file. Valid values are \'plain\' and \'xml\'.", 3 );
 156  0
                 append( sb, "Expression: ${checkstyle.output.format}", 3 );
 157  0
                 append( sb, "", 0 );
 158  
 
 159  0
                 append( sb, "propertiesLocation", 2 );
 160  0
                 append( sb, "Specifies the location of the properties file.\n\nThis 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.\n\nThe contents of the propertiesLocation will be made available to Checkstyle for specifying values for parameters within the xml configuration (specified in the configLocation parameter).\n", 3 );
 161  0
                 append( sb, "Expression: ${checkstyle.properties.location}", 3 );
 162  0
                 append( sb, "", 0 );
 163  
 
 164  0
                 append( sb, "propertyExpansion", 2 );
 165  0
                 append( sb, "Allows for specifying raw property expansion information.", 3 );
 166  0
                 append( sb, "", 0 );
 167  
 
 168  0
                 append( sb, "skip (Default: false)", 2 );
 169  0
                 append( sb, "Skip entire check.", 3 );
 170  0
                 append( sb, "Expression: ${checkstyle.skip}", 3 );
 171  0
                 append( sb, "", 0 );
 172  
 
 173  0
                 append( sb, "skipExec (Default: false)", 2 );
 174  0
                 append( sb, "Skip checktyle execution will only scan the outputFile.", 3 );
 175  0
                 append( sb, "Expression: ${checkstyle.skipExec}", 3 );
 176  0
                 append( sb, "", 0 );
 177  
 
 178  0
                 append( sb, "sourceDirectory (Default: ${project.build.sourceDirectory})", 2 );
 179  0
                 append( sb, "Specifies the location of the source directory to be used for Checkstyle.", 3 );
 180  0
                 append( sb, "Required: Yes", 3 );
 181  0
                 append( sb, "", 0 );
 182  
 
 183  0
                 append( sb, "suppressionsFileExpression (Default: checkstyle.suppressions.file)", 2 );
 184  0
                 append( sb, "The key to be used in the properties for the suppressions file.", 3 );
 185  0
                 append( sb, "Expression: ${checkstyle.suppression.expression}", 3 );
 186  0
                 append( sb, "", 0 );
 187  
 
 188  0
                 append( sb, "suppressionsLocation", 2 );
 189  0
                 append( sb, "Specifies the location of the suppressions XML file to use.\n\nThis 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.\n\nSee suppressionsFileExpression for the property that will be made available to your checkstyle configuration.\n", 3 );
 190  0
                 append( sb, "Expression: ${checkstyle.suppressions.location}", 3 );
 191  0
                 append( sb, "", 0 );
 192  
 
 193  0
                 append( sb, "testSourceDirectory (Default: ${project.build.testSourceDirectory})", 2 );
 194  0
                 append( sb, "Specifies the location of the test source directory to be used for Checkstyle.", 3 );
 195  0
                 append( sb, "", 0 );
 196  
 
 197  0
                 append( sb, "useFile", 2 );
 198  0
                 append( sb, "If null, the Checkstyle plugin will display violations on stdout. Otherwise, a text file will be created with the violations.", 3 );
 199  0
                 append( sb, "", 0 );
 200  
 
 201  0
                 append( sb, "violationSeverity (Default: error)", 2 );
 202  0
                 append( sb, "The lowest severity level that is considered a violation. Valid values are \'error\', \'warning\' and \'info\'.", 3 );
 203  0
                 append( sb, "Expression: ${checkstyle.violationSeverity}", 3 );
 204  0
                 append( sb, "", 0 );
 205  
             }
 206  
         }
 207  
 
 208  0
         if ( goal == null || goal.length() <= 0 || "checkstyle".equals( goal ) )
 209  
         {
 210  0
             append( sb, "checkstyle:checkstyle", 0 );
 211  0
             append( sb, "Perform a Checkstyle analysis, and generate a report on violations.", 1 );
 212  0
             append( sb, "", 0 );
 213  0
             if ( detail )
 214  
             {
 215  0
                 append( sb, "Available parameters:", 1 );
 216  0
                 append( sb, "", 0 );
 217  
 
 218  0
                 append( sb, "cacheFile (Default: ${project.build.directory}/checkstyle-cachefile)", 2 );
 219  0
                 append( sb, "Specifies the cache file used to speed up Checkstyle on successive runs.", 3 );
 220  0
                 append( sb, "", 0 );
 221  
 
 222  0
                 append( sb, "configLocation (Default: config/sun_checks.xml)", 2 );
 223  0
                 append( sb, "Specifies the location of the XML configuration to use.\n\nPotential 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.\n\nThis 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.\n\nThere are 4 predefined rulesets.\n\n-\tconfig/sun_checks.xml: Sun Checks.\n-\tconfig/turbine_checks.xml: Turbine Checks.\n-\tconfig/avalon_checks.xml: Avalon Checks.\n-\tconfig/maven_checks.xml: Maven Source Checks.\n", 3 );
 224  0
                 append( sb, "Expression: ${checkstyle.config.location}", 3 );
 225  0
                 append( sb, "", 0 );
 226  
 
 227  0
                 append( sb, "consoleOutput (Default: false)", 2 );
 228  0
                 append( sb, "Output errors to console.", 3 );
 229  0
                 append( sb, "", 0 );
 230  
 
 231  0
                 append( sb, "enableFilesSummary (Default: true)", 2 );
 232  0
                 append( sb, "Specifies if the Files summary should be enabled or not.", 3 );
 233  0
                 append( sb, "Expression: ${checkstyle.enable.files.summary}", 3 );
 234  0
                 append( sb, "", 0 );
 235  
 
 236  0
                 append( sb, "enableRSS (Default: true)", 2 );
 237  0
                 append( sb, "Specifies if the RSS should be enabled or not.", 3 );
 238  0
                 append( sb, "Expression: ${checkstyle.enable.rss}", 3 );
 239  0
                 append( sb, "", 0 );
 240  
 
 241  0
                 append( sb, "enableRulesSummary (Default: true)", 2 );
 242  0
                 append( sb, "Specifies if the Rules summary should be enabled or not.", 3 );
 243  0
                 append( sb, "Expression: ${checkstyle.enable.rules.summary}", 3 );
 244  0
                 append( sb, "", 0 );
 245  
 
 246  0
                 append( sb, "enableSeveritySummary (Default: true)", 2 );
 247  0
                 append( sb, "Specifies if the Severity summary should be enabled or not.", 3 );
 248  0
                 append( sb, "Expression: ${checkstyle.enable.severity.summary}", 3 );
 249  0
                 append( sb, "", 0 );
 250  
 
 251  0
                 append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 );
 252  0
                 append( sb, "The file encoding to use when reading the source files. If the property 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.", 3 );
 253  0
                 append( sb, "Expression: ${encoding}", 3 );
 254  0
                 append( sb, "", 0 );
 255  
 
 256  0
                 append( sb, "excludes", 2 );
 257  0
                 append( sb, "Specifies the names filter of the source files to be excluded for Checkstyle.", 3 );
 258  0
                 append( sb, "Expression: ${checkstyle.excludes}", 3 );
 259  0
                 append( sb, "", 0 );
 260  
 
 261  0
                 append( sb, "failsOnError (Default: false)", 2 );
 262  0
                 append( sb, "Specifies if the build should fail upon a violation.", 3 );
 263  0
                 append( sb, "", 0 );
 264  
 
 265  0
                 append( sb, "format (Default: sun)", 2 );
 266  0
                 append( sb, "Deprecated. Use configLocation instead.", 3 );
 267  0
                 append( sb, "", 0 );
 268  0
                 append( sb, "Specifies what predefined check set to use. Available sets are \'sun\' (for the Sun coding conventions), \'turbine\', and \'avalon\'.", 3 );
 269  0
                 append( sb, "", 0 );
 270  
 
 271  0
                 append( sb, "headerFile", 2 );
 272  0
                 append( sb, "Deprecated. Use headerLocation instead.", 3 );
 273  0
                 append( sb, "", 0 );
 274  0
                 append( sb, "Specifies the location of the License file (a.k.a. the header file) that is used by Checkstyle to verify that source code has the correct license header.", 3 );
 275  0
                 append( sb, "Expression: ${basedir}/LICENSE.txt", 3 );
 276  0
                 append( sb, "", 0 );
 277  
 
 278  0
                 append( sb, "headerLocation (Default: LICENSE.txt)", 2 );
 279  0
                 append( sb, "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.\n\nYou need to use ${checkstyle.header.file} in your Checkstyle xml configuration to reference the name of this header file.\n\nFor instance:\n\n<module name=\'RegexpHeader\'> <property name=\'headerFile\' value=\'${checkstyle.header.file}\'/> </module>\n", 3 );
 280  0
                 append( sb, "Expression: ${checkstyle.header.file}", 3 );
 281  0
                 append( sb, "", 0 );
 282  
 
 283  0
                 append( sb, "includes (Default: **/*.java)", 2 );
 284  0
                 append( sb, "Specifies the names filter of the source files to be used for Checkstyle.", 3 );
 285  0
                 append( sb, "Required: Yes", 3 );
 286  0
                 append( sb, "Expression: ${checkstyle.includes}", 3 );
 287  0
                 append( sb, "", 0 );
 288  
 
 289  0
                 append( sb, "includeTestSourceDirectory (Default: ${false})", 2 );
 290  0
                 append( sb, "Include or not the test source directory to be used for Checkstyle.", 3 );
 291  0
                 append( sb, "", 0 );
 292  
 
 293  0
                 append( sb, "linkXRef (Default: true)", 2 );
 294  0
                 append( sb, "Link the violation line numbers to the source xref. Will link automatically if Maven JXR plugin is being used.", 3 );
 295  0
                 append( sb, "Expression: ${linkXRef}", 3 );
 296  0
                 append( sb, "", 0 );
 297  
 
 298  0
                 append( sb, "outputDirectory (Default: ${project.reporting.outputDirectory})", 2 );
 299  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in Maven Site Plugin is used instead.", 3 );
 300  0
                 append( sb, "Required: Yes", 3 );
 301  0
                 append( sb, "", 0 );
 302  
 
 303  0
                 append( sb, "outputFile (Default: ${project.build.directory}/checkstyle-result.xml)", 2 );
 304  0
                 append( sb, "Specifies the path and filename to save the checkstyle output. The format of the output file is determined by the outputFileFormat parameter.", 3 );
 305  0
                 append( sb, "Expression: ${checkstyle.output.file}", 3 );
 306  0
                 append( sb, "", 0 );
 307  
 
 308  0
                 append( sb, "outputFileFormat (Default: xml)", 2 );
 309  0
                 append( sb, "Specifies the format of the output to be used when writing to the output file. Valid values are \'plain\' and \'xml\'.", 3 );
 310  0
                 append( sb, "Expression: ${checkstyle.output.format}", 3 );
 311  0
                 append( sb, "", 0 );
 312  
 
 313  0
                 append( sb, "packageNamesFile", 2 );
 314  0
                 append( sb, "Deprecated. Use packageNamesLocation instead.", 3 );
 315  0
                 append( sb, "", 0 );
 316  0
                 append( sb, "Specifies the location of the package names XML to be used to configure Checkstyle.", 3 );
 317  0
                 append( sb, "", 0 );
 318  
 
 319  0
                 append( sb, "packageNamesLocation", 2 );
 320  0
                 append( sb, "Specifies the location of the package names XML to be used to configure the Checkstyle Packages.\n\nThis parameter is resolved as resource, URL, then file. If resolved to a resource, or a URL, the contents of the package names XML is copied into the ${project.build.directory}/checkstyle-packagenames.xml file before being passed to Checkstyle for loading.\n", 3 );
 321  0
                 append( sb, "", 0 );
 322  
 
 323  0
                 append( sb, "propertiesFile", 2 );
 324  0
                 append( sb, "Deprecated. Use propertiesLocation instead.", 3 );
 325  0
                 append( sb, "", 0 );
 326  0
                 append( sb, "Specifies the location of the Checkstyle properties file that will be used to check the source.", 3 );
 327  0
                 append( sb, "", 0 );
 328  
 
 329  0
                 append( sb, "propertiesLocation", 2 );
 330  0
                 append( sb, "Specifies the location of the properties file.\n\nThis 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.\n\nThe contents of the propertiesLocation will be made available to Checkstyle for specifying values for parameters within the xml configuration (specified in the configLocation parameter).\n", 3 );
 331  0
                 append( sb, "Expression: ${checkstyle.properties.location}", 3 );
 332  0
                 append( sb, "", 0 );
 333  
 
 334  0
                 append( sb, "propertiesURL", 2 );
 335  0
                 append( sb, "Deprecated. Use propertiesLocation instead.", 3 );
 336  0
                 append( sb, "", 0 );
 337  0
                 append( sb, "Specifies the URL of the Checkstyle properties that will be used to check the source.", 3 );
 338  0
                 append( sb, "", 0 );
 339  
 
 340  0
                 append( sb, "propertyExpansion", 2 );
 341  0
                 append( sb, "Allows for specifying raw property expansion information.", 3 );
 342  0
                 append( sb, "", 0 );
 343  
 
 344  0
                 append( sb, "skip (Default: false)", 2 );
 345  0
                 append( sb, "Skip entire check.", 3 );
 346  0
                 append( sb, "Expression: ${checkstyle.skip}", 3 );
 347  0
                 append( sb, "", 0 );
 348  
 
 349  0
                 append( sb, "sourceDirectory (Default: ${project.build.sourceDirectory})", 2 );
 350  0
                 append( sb, "Specifies the location of the source directory to be used for Checkstyle.", 3 );
 351  0
                 append( sb, "Required: Yes", 3 );
 352  0
                 append( sb, "", 0 );
 353  
 
 354  0
                 append( sb, "suppressionsFile", 2 );
 355  0
                 append( sb, "Deprecated. Use suppressionsLocation instead.", 3 );
 356  0
                 append( sb, "", 0 );
 357  0
                 append( sb, "Specifies the location of the suppressions XML file to use. The plugin defines a Checkstyle property named checkstyle.suppressions.file with the value of this property. This allows using the Checkstyle property in your own custom checkstyle configuration file when specifying a suppressions file.", 3 );
 358  0
                 append( sb, "", 0 );
 359  
 
 360  0
                 append( sb, "suppressionsFileExpression (Default: checkstyle.suppressions.file)", 2 );
 361  0
                 append( sb, "The key to be used in the properties for the suppressions file.", 3 );
 362  0
                 append( sb, "Expression: ${checkstyle.suppression.expression}", 3 );
 363  0
                 append( sb, "", 0 );
 364  
 
 365  0
                 append( sb, "suppressionsLocation", 2 );
 366  0
                 append( sb, "Specifies the location of the suppressions XML file to use.\n\nThis 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.\n\nSee suppressionsFileExpression for the property that will be made available to your checkstyle configuration.\n", 3 );
 367  0
                 append( sb, "Expression: ${checkstyle.suppressions.location}", 3 );
 368  0
                 append( sb, "", 0 );
 369  
 
 370  0
                 append( sb, "testSourceDirectory (Default: ${project.build.testSourceDirectory})", 2 );
 371  0
                 append( sb, "Specifies the location of the test source directory to be used for Checkstyle.", 3 );
 372  0
                 append( sb, "", 0 );
 373  
 
 374  0
                 append( sb, "useFile", 2 );
 375  0
                 append( sb, "If null, the Checkstyle plugin will display violations on stdout. Otherwise, a text file will be created with the violations.", 3 );
 376  0
                 append( sb, "", 0 );
 377  
 
 378  0
                 append( sb, "xrefLocation (Default: ${project.reporting.outputDirectory}/xref)", 2 );
 379  0
                 append( sb, "Location of the Xrefs to link to.", 3 );
 380  0
                 append( sb, "", 0 );
 381  
             }
 382  
         }
 383  
 
 384  0
         if ( goal == null || goal.length() <= 0 || "checkstyle-aggregate".equals( goal ) )
 385  
         {
 386  0
             append( sb, "checkstyle:checkstyle-aggregate", 0 );
 387  0
             append( sb, "Perform a Checkstyle analysis, and generate a report on violations, aggregating the result in the project which started this mojo.", 1 );
 388  0
             append( sb, "", 0 );
 389  0
             if ( detail )
 390  
             {
 391  0
                 append( sb, "Available parameters:", 1 );
 392  0
                 append( sb, "", 0 );
 393  
 
 394  0
                 append( sb, "cacheFile (Default: ${project.build.directory}/checkstyle-cachefile)", 2 );
 395  0
                 append( sb, "Specifies the cache file used to speed up Checkstyle on successive runs.", 3 );
 396  0
                 append( sb, "", 0 );
 397  
 
 398  0
                 append( sb, "configLocation (Default: config/sun_checks.xml)", 2 );
 399  0
                 append( sb, "Specifies the location of the XML configuration to use.\n\nPotential 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.\n\nThis 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.\n\nThere are 4 predefined rulesets.\n\n-\tconfig/sun_checks.xml: Sun Checks.\n-\tconfig/turbine_checks.xml: Turbine Checks.\n-\tconfig/avalon_checks.xml: Avalon Checks.\n-\tconfig/maven_checks.xml: Maven Source Checks.\n", 3 );
 400  0
                 append( sb, "Expression: ${checkstyle.config.location}", 3 );
 401  0
                 append( sb, "", 0 );
 402  
 
 403  0
                 append( sb, "consoleOutput (Default: false)", 2 );
 404  0
                 append( sb, "Output errors to console.", 3 );
 405  0
                 append( sb, "", 0 );
 406  
 
 407  0
                 append( sb, "enableFilesSummary (Default: true)", 2 );
 408  0
                 append( sb, "Specifies if the Files summary should be enabled or not.", 3 );
 409  0
                 append( sb, "Expression: ${checkstyle.enable.files.summary}", 3 );
 410  0
                 append( sb, "", 0 );
 411  
 
 412  0
                 append( sb, "enableRSS (Default: true)", 2 );
 413  0
                 append( sb, "Specifies if the RSS should be enabled or not.", 3 );
 414  0
                 append( sb, "Expression: ${checkstyle.enable.rss}", 3 );
 415  0
                 append( sb, "", 0 );
 416  
 
 417  0
                 append( sb, "enableRulesSummary (Default: true)", 2 );
 418  0
                 append( sb, "Specifies if the Rules summary should be enabled or not.", 3 );
 419  0
                 append( sb, "Expression: ${checkstyle.enable.rules.summary}", 3 );
 420  0
                 append( sb, "", 0 );
 421  
 
 422  0
                 append( sb, "enableSeveritySummary (Default: true)", 2 );
 423  0
                 append( sb, "Specifies if the Severity summary should be enabled or not.", 3 );
 424  0
                 append( sb, "Expression: ${checkstyle.enable.severity.summary}", 3 );
 425  0
                 append( sb, "", 0 );
 426  
 
 427  0
                 append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 );
 428  0
                 append( sb, "The file encoding to use when reading the source files. If the property 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.", 3 );
 429  0
                 append( sb, "Expression: ${encoding}", 3 );
 430  0
                 append( sb, "", 0 );
 431  
 
 432  0
                 append( sb, "excludes", 2 );
 433  0
                 append( sb, "Specifies the names filter of the source files to be excluded for Checkstyle.", 3 );
 434  0
                 append( sb, "Expression: ${checkstyle.excludes}", 3 );
 435  0
                 append( sb, "", 0 );
 436  
 
 437  0
                 append( sb, "failsOnError (Default: false)", 2 );
 438  0
                 append( sb, "Specifies if the build should fail upon a violation.", 3 );
 439  0
                 append( sb, "", 0 );
 440  
 
 441  0
                 append( sb, "headerLocation (Default: LICENSE.txt)", 2 );
 442  0
                 append( sb, "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.\n\nYou need to use ${checkstyle.header.file} in your Checkstyle xml configuration to reference the name of this header file.\n\nFor instance:\n\n<module name=\'RegexpHeader\'> <property name=\'headerFile\' value=\'${checkstyle.header.file}\'/> </module>\n", 3 );
 443  0
                 append( sb, "Expression: ${checkstyle.header.file}", 3 );
 444  0
                 append( sb, "", 0 );
 445  
 
 446  0
                 append( sb, "includes (Default: **/*.java)", 2 );
 447  0
                 append( sb, "Specifies the names filter of the source files to be used for Checkstyle.", 3 );
 448  0
                 append( sb, "Required: Yes", 3 );
 449  0
                 append( sb, "Expression: ${checkstyle.includes}", 3 );
 450  0
                 append( sb, "", 0 );
 451  
 
 452  0
                 append( sb, "includeTestSourceDirectory (Default: ${false})", 2 );
 453  0
                 append( sb, "Include or not the test source directory to be used for Checkstyle.", 3 );
 454  0
                 append( sb, "", 0 );
 455  
 
 456  0
                 append( sb, "linkXRef (Default: true)", 2 );
 457  0
                 append( sb, "Link the violation line numbers to the source xref. Will link automatically if Maven JXR plugin is being used.", 3 );
 458  0
                 append( sb, "Expression: ${linkXRef}", 3 );
 459  0
                 append( sb, "", 0 );
 460  
 
 461  0
                 append( sb, "outputDirectory (Default: ${project.reporting.outputDirectory})", 2 );
 462  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in Maven Site Plugin is used instead.", 3 );
 463  0
                 append( sb, "Required: Yes", 3 );
 464  0
                 append( sb, "", 0 );
 465  
 
 466  0
                 append( sb, "outputFile (Default: ${project.build.directory}/checkstyle-result.xml)", 2 );
 467  0
                 append( sb, "Specifies the path and filename to save the checkstyle output. The format of the output file is determined by the outputFileFormat parameter.", 3 );
 468  0
                 append( sb, "Expression: ${checkstyle.output.file}", 3 );
 469  0
                 append( sb, "", 0 );
 470  
 
 471  0
                 append( sb, "outputFileFormat (Default: xml)", 2 );
 472  0
                 append( sb, "Specifies the format of the output to be used when writing to the output file. Valid values are \'plain\' and \'xml\'.", 3 );
 473  0
                 append( sb, "Expression: ${checkstyle.output.format}", 3 );
 474  0
                 append( sb, "", 0 );
 475  
 
 476  0
                 append( sb, "propertiesLocation", 2 );
 477  0
                 append( sb, "Specifies the location of the properties file.\n\nThis 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.\n\nThe contents of the propertiesLocation will be made available to Checkstyle for specifying values for parameters within the xml configuration (specified in the configLocation parameter).\n", 3 );
 478  0
                 append( sb, "Expression: ${checkstyle.properties.location}", 3 );
 479  0
                 append( sb, "", 0 );
 480  
 
 481  0
                 append( sb, "propertyExpansion", 2 );
 482  0
                 append( sb, "Allows for specifying raw property expansion information.", 3 );
 483  0
                 append( sb, "", 0 );
 484  
 
 485  0
                 append( sb, "skip (Default: false)", 2 );
 486  0
                 append( sb, "Skip entire check.", 3 );
 487  0
                 append( sb, "Expression: ${checkstyle.skip}", 3 );
 488  0
                 append( sb, "", 0 );
 489  
 
 490  0
                 append( sb, "sourceDirectory (Default: ${project.build.sourceDirectory})", 2 );
 491  0
                 append( sb, "Specifies the location of the source directory to be used for Checkstyle.", 3 );
 492  0
                 append( sb, "Required: Yes", 3 );
 493  0
                 append( sb, "", 0 );
 494  
 
 495  0
                 append( sb, "suppressionsFileExpression (Default: checkstyle.suppressions.file)", 2 );
 496  0
                 append( sb, "The key to be used in the properties for the suppressions file.", 3 );
 497  0
                 append( sb, "Expression: ${checkstyle.suppression.expression}", 3 );
 498  0
                 append( sb, "", 0 );
 499  
 
 500  0
                 append( sb, "suppressionsLocation", 2 );
 501  0
                 append( sb, "Specifies the location of the suppressions XML file to use.\n\nThis 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.\n\nSee suppressionsFileExpression for the property that will be made available to your checkstyle configuration.\n", 3 );
 502  0
                 append( sb, "Expression: ${checkstyle.suppressions.location}", 3 );
 503  0
                 append( sb, "", 0 );
 504  
 
 505  0
                 append( sb, "testSourceDirectory (Default: ${project.build.testSourceDirectory})", 2 );
 506  0
                 append( sb, "Specifies the location of the test source directory to be used for Checkstyle.", 3 );
 507  0
                 append( sb, "", 0 );
 508  
 
 509  0
                 append( sb, "useFile", 2 );
 510  0
                 append( sb, "If null, the Checkstyle plugin will display violations on stdout. Otherwise, a text file will be created with the violations.", 3 );
 511  0
                 append( sb, "", 0 );
 512  
 
 513  0
                 append( sb, "xrefLocation (Default: ${project.reporting.outputDirectory}/xref)", 2 );
 514  0
                 append( sb, "Location of the Xrefs to link to.", 3 );
 515  0
                 append( sb, "", 0 );
 516  
             }
 517  
         }
 518  
 
 519  0
         if ( goal == null || goal.length() <= 0 || "help".equals( goal ) )
 520  
         {
 521  0
             append( sb, "checkstyle:help", 0 );
 522  0
             append( sb, "Display help information on maven-checkstyle-plugin.\nCall\n\u00a0\u00a0mvn\u00a0checkstyle:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 );
 523  0
             append( sb, "", 0 );
 524  0
             if ( detail )
 525  
             {
 526  0
                 append( sb, "Available parameters:", 1 );
 527  0
                 append( sb, "", 0 );
 528  
 
 529  0
                 append( sb, "detail (Default: false)", 2 );
 530  0
                 append( sb, "If true, display all settable properties for each goal.", 3 );
 531  0
                 append( sb, "Expression: ${detail}", 3 );
 532  0
                 append( sb, "", 0 );
 533  
 
 534  0
                 append( sb, "goal", 2 );
 535  0
                 append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 );
 536  0
                 append( sb, "Expression: ${goal}", 3 );
 537  0
                 append( sb, "", 0 );
 538  
 
 539  0
                 append( sb, "indentSize (Default: 2)", 2 );
 540  0
                 append( sb, "The number of spaces per indentation level, should be positive.", 3 );
 541  0
                 append( sb, "Expression: ${indentSize}", 3 );
 542  0
                 append( sb, "", 0 );
 543  
 
 544  0
                 append( sb, "lineLength (Default: 80)", 2 );
 545  0
                 append( sb, "The maximum length of a display line, should be positive.", 3 );
 546  0
                 append( sb, "Expression: ${lineLength}", 3 );
 547  0
                 append( sb, "", 0 );
 548  
             }
 549  
         }
 550  
 
 551  0
         if ( getLog().isInfoEnabled() )
 552  
         {
 553  0
             getLog().info( sb.toString() );
 554  
         }
 555  0
     }
 556  
 
 557  
     /**
 558  
      * <p>Repeat a String <code>n</code> times to form a new string.</p>
 559  
      *
 560  
      * @param str String to repeat
 561  
      * @param repeat number of times to repeat str
 562  
      * @return String with repeated String
 563  
      * @throws NegativeArraySizeException if <code>repeat < 0</code>
 564  
      * @throws NullPointerException if str is <code>null</code>
 565  
      */
 566  
     private static String repeat( String str, int repeat )
 567  
     {
 568  0
         StringBuffer buffer = new StringBuffer( repeat * str.length() );
 569  
 
 570  0
         for ( int i = 0; i < repeat; i++ )
 571  
         {
 572  0
             buffer.append( str );
 573  
         }
 574  
 
 575  0
         return buffer.toString();
 576  
     }
 577  
 
 578  
     /** 
 579  
      * Append a description to the buffer by respecting the indentSize and lineLength parameters.
 580  
      * <b>Note</b>: The last character is always a new line.
 581  
      * 
 582  
      * @param sb The buffer to append the description, not <code>null</code>.
 583  
      * @param description The description, not <code>null</code>.
 584  
      * @param indent The base indentation level of each line, must not be negative.
 585  
      */
 586  
     private void append( StringBuffer sb, String description, int indent )
 587  
     {
 588  0
         for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); )
 589  
         {
 590  0
             sb.append( it.next().toString() ).append( '\n' );
 591  
         }
 592  0
     }
 593  
 
 594  
     /** 
 595  
      * Splits the specified text into lines of convenient display length.
 596  
      * 
 597  
      * @param text The text to split into lines, must not be <code>null</code>.
 598  
      * @param indent The base indentation level of each line, must not be negative.
 599  
      * @param indentSize The size of each indentation, must not be negative.
 600  
      * @param lineLength The length of the line, must not be negative.
 601  
      * @return The sequence of display lines, never <code>null</code>.
 602  
      * @throws NegativeArraySizeException if <code>indent < 0</code>
 603  
      */
 604  
     private static List toLines( String text, int indent, int indentSize, int lineLength )
 605  
     {
 606  0
         List<String> lines = new ArrayList<String>();
 607  
 
 608  0
         String ind = repeat( "\t", indent );
 609  0
         String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
 610  0
         for ( int i = 0; i < plainLines.length; i++ )
 611  
         {
 612  0
             toLines( lines, ind + plainLines[i], indentSize, lineLength );
 613  
         }
 614  
 
 615  0
         return lines;
 616  
     }
 617  
 
 618  
     /** 
 619  
      * Adds the specified line to the output sequence, performing line wrapping if necessary.
 620  
      * 
 621  
      * @param lines The sequence of display lines, must not be <code>null</code>.
 622  
      * @param line The line to add, must not be <code>null</code>.
 623  
      * @param indentSize The size of each indentation, must not be negative.
 624  
      * @param lineLength The length of the line, must not be negative.
 625  
      */
 626  
     private static void toLines( List<String> lines, String line, int indentSize, int lineLength )
 627  
     {
 628  0
         int lineIndent = getIndentLevel( line );
 629  0
         StringBuffer buf = new StringBuffer( 256 );
 630  0
         String[] tokens = line.split( " +" );
 631  0
         for ( int i = 0; i < tokens.length; i++ )
 632  
         {
 633  0
             String token = tokens[i];
 634  0
             if ( i > 0 )
 635  
             {
 636  0
                 if ( buf.length() + token.length() >= lineLength )
 637  
                 {
 638  0
                     lines.add( buf.toString() );
 639  0
                     buf.setLength( 0 );
 640  0
                     buf.append( repeat( " ", lineIndent * indentSize ) );
 641  
                 }
 642  
                 else
 643  
                 {
 644  0
                     buf.append( ' ' );
 645  
                 }
 646  
             }
 647  0
             for ( int j = 0; j < token.length(); j++ )
 648  
             {
 649  0
                 char c = token.charAt( j );
 650  0
                 if ( c == '\t' )
 651  
                 {
 652  0
                     buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
 653  
                 }
 654  0
                 else if ( c == '\u00A0' )
 655  
                 {
 656  0
                     buf.append( ' ' );
 657  
                 }
 658  
                 else
 659  
                 {
 660  0
                     buf.append( c );
 661  
                 }
 662  
             }
 663  
         }
 664  0
         lines.add( buf.toString() );
 665  0
     }
 666  
 
 667  
     /** 
 668  
      * Gets the indentation level of the specified line.
 669  
      * 
 670  
      * @param line The line whose indentation level should be retrieved, must not be <code>null</code>.
 671  
      * @return The indentation level of the line.
 672  
      */
 673  
     private static int getIndentLevel( String line )
 674  
     {
 675  0
         int level = 0;
 676  0
         for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ )
 677  
         {
 678  0
             level++;
 679  
         }
 680  0
         for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
 681  
         {
 682  0
             if ( line.charAt( i ) == '\t' )
 683  
             {
 684  0
                 level++;
 685  0
                 break;
 686  
             }
 687  
         }
 688  0
         return level;
 689  
     }
 690  
 }