1 | |
package org.apache.maven.plugin.checkstyle; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.Iterator; |
5 | |
import java.util.List; |
6 | |
import java.util.StringTokenizer; |
7 | |
|
8 | |
import org.apache.maven.plugin.AbstractMojo; |
9 | |
import org.apache.maven.plugin.MojoExecutionException; |
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | 0 | public class HelpMojo |
18 | |
extends AbstractMojo |
19 | |
{ |
20 | |
|
21 | |
private static final int DEFAULT_WIDTH = 80; |
22 | |
|
23 | |
|
24 | 0 | private static final String DEFAULT_INDENT = repeat( " ", 2 ); |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
private boolean detail; |
32 | |
|
33 | |
|
34 | |
public void execute() |
35 | |
throws MojoExecutionException |
36 | |
{ |
37 | 0 | StringBuffer sb = new StringBuffer(); |
38 | |
|
39 | 0 | sb.append( "The 'org.apache.maven.plugins:maven-checkstyle-plugin' plugin has 4 goals:" ).append( "\n" ); |
40 | 0 | sb.append( "\n" ); |
41 | |
|
42 | 0 | sb.append( "checkstyle:checkstyle" ).append( "\n" ); |
43 | 0 | for ( Iterator it = toLines( "Perform a Checkstyle analysis, and generate a report on violations." ).iterator(); it.hasNext(); ) |
44 | |
{ |
45 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
46 | |
} |
47 | 0 | if ( detail ) |
48 | |
{ |
49 | 0 | sb.append( "\n" ); |
50 | |
|
51 | 0 | sb.append( repeat( " ", 2 ) ); |
52 | 0 | sb.append( "Available parameters:" ).append( "\n" ); |
53 | |
|
54 | 0 | sb.append( "\n" ); |
55 | |
|
56 | 0 | for ( Iterator it = toLines( "cacheFile (Default: '${project.build.directory}/checkstyle-cachefile')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
57 | |
{ |
58 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
59 | |
} |
60 | 0 | for ( Iterator it = toLines( "Specifies the cache file used to speed up Checkstyle on successive runs.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
61 | |
{ |
62 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
63 | |
} |
64 | 0 | for ( Iterator it = toLines( "configLocation (Default: 'config/sun_checks.xml')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
65 | |
{ |
66 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
67 | |
} |
68 | 0 | for ( Iterator it = toLines( "Specifies the location of the XML configuration to use.Potential 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.This 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.There are 4 predefined rulesets.config/sun_checks.xml: Sun Checks.config/turbine_checks.xml: Turbine Checks.config/avalon_checks.xml: Avalon Checks.config/maven_checks.xml: Maven Source Checks.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
69 | |
{ |
70 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
71 | |
} |
72 | 0 | for ( Iterator it = toLines( "consoleOutput (Default: 'false')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
73 | |
{ |
74 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
75 | |
} |
76 | 0 | for ( Iterator it = toLines( "Output errors to console.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
77 | |
{ |
78 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
79 | |
} |
80 | 0 | for ( Iterator it = toLines( "enableFilesSummary (Default: 'true')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
81 | |
{ |
82 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
83 | |
} |
84 | 0 | for ( Iterator it = toLines( "Specifies if the Files summary should be enabled or not.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
85 | |
{ |
86 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
87 | |
} |
88 | 0 | for ( Iterator it = toLines( "enableRSS (Default: 'true')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
89 | |
{ |
90 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
91 | |
} |
92 | 0 | for ( Iterator it = toLines( "Specifies if the RSS should be enabled or not.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
93 | |
{ |
94 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
95 | |
} |
96 | 0 | for ( Iterator it = toLines( "enableRulesSummary (Default: 'true')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
97 | |
{ |
98 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
99 | |
} |
100 | 0 | for ( Iterator it = toLines( "Specifies if the Rules summary should be enabled or not.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
101 | 0 | { |
102 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
103 | 0 | } |
104 | 0 | for ( Iterator it = toLines( "enableSeveritySummary (Default: 'true')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
105 | 0 | { |
106 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
107 | 0 | } |
108 | 0 | for ( Iterator it = toLines( "Specifies if the Severity summary should be enabled or not.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
109 | 0 | { |
110 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
111 | |
} |
112 | 0 | for ( Iterator it = toLines( "encoding (Default: '${project.build.sourceEncoding}')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
113 | |
{ |
114 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
115 | |
} |
116 | 0 | for ( Iterator it = toLines( "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.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
117 | |
{ |
118 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
119 | |
} |
120 | 0 | for ( Iterator it = toLines( "excludes", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
121 | |
{ |
122 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
123 | |
} |
124 | 0 | for ( Iterator it = toLines( "Specifies the names filter of the source files to be excluded for Checkstyle.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
125 | |
{ |
126 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
127 | |
} |
128 | 0 | for ( Iterator it = toLines( "failsOnError (Default: 'false')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
129 | |
{ |
130 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
131 | |
} |
132 | 0 | for ( Iterator it = toLines( "Specifies if the build should fail upon a violation.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
133 | |
{ |
134 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
135 | |
} |
136 | 0 | for ( Iterator it = toLines( "format (Default: 'sun')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
137 | |
{ |
138 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
139 | |
} |
140 | 0 | for ( Iterator it = toLines( "Specifies what predefined check set to use. Available sets are 'sun' (for the Sun coding conventions), 'turbine', and 'avalon'.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
141 | |
{ |
142 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
143 | |
} |
144 | 0 | for ( Iterator it = toLines( "headerFile", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
145 | |
{ |
146 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
147 | |
} |
148 | 0 | for ( Iterator it = toLines( "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.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
149 | |
{ |
150 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
151 | |
} |
152 | 0 | for ( Iterator it = toLines( "headerLocation (Default: 'LICENSE.txt')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
153 | |
{ |
154 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
155 | |
} |
156 | 0 | for ( Iterator it = toLines( "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.You need to use ${checkstyle.header.file} in your Checkstyle xml configuration to reference the name of this header file.For instance:<module name='RegexpHeader'> <property name='headerFile' value='${checkstyle.header.file}'/> </module> ", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
157 | |
{ |
158 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
159 | |
} |
160 | 0 | for ( Iterator it = toLines( "includeTestSourceDirectory (Default: '${false}')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
161 | |
{ |
162 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
163 | |
} |
164 | 0 | for ( Iterator it = toLines( "Include or not the test source directory to be used for Checkstyle.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
165 | |
{ |
166 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
167 | |
} |
168 | 0 | for ( Iterator it = toLines( "includes (Default: '**/*.java')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
169 | |
{ |
170 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
171 | |
} |
172 | 0 | for ( Iterator it = toLines( "Specifies the names filter of the source files to be used for Checkstyle.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
173 | |
{ |
174 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
175 | |
} |
176 | 0 | for ( Iterator it = toLines( "linkXRef (Default: 'true')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
177 | |
{ |
178 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
179 | |
} |
180 | 0 | for ( Iterator it = toLines( "Link the violation line numbers to the source xref. Will link automatically if Maven JXR plugin is being used.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
181 | |
{ |
182 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
183 | |
} |
184 | 0 | for ( Iterator it = toLines( "outputDirectory (Default: '${project.reporting.outputDirectory}')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
185 | |
{ |
186 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
187 | |
} |
188 | 0 | for ( Iterator it = toLines( "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.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
189 | |
{ |
190 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
191 | |
} |
192 | 0 | for ( Iterator it = toLines( "outputFile (Default: '${project.build.directory}/checkstyle-result.xml')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
193 | |
{ |
194 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
195 | |
} |
196 | 0 | for ( Iterator it = toLines( "Specifies the path and filename to save the checkstyle output. The format of the output file is determined by the outputFileFormat parameter.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
197 | |
{ |
198 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
199 | |
} |
200 | 0 | for ( Iterator it = toLines( "outputFileFormat (Default: 'xml')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
201 | |
{ |
202 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
203 | |
} |
204 | 0 | for ( Iterator it = toLines( "Specifies the format of the output to be used when writing to the output file. Valid values are 'plain' and 'xml'.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
205 | |
{ |
206 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
207 | |
} |
208 | 0 | for ( Iterator it = toLines( "packageNamesFile", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
209 | |
{ |
210 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
211 | |
} |
212 | 0 | for ( Iterator it = toLines( "Specifies the location of the package names XML to be used to configure Checkstyle.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
213 | |
{ |
214 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
215 | |
} |
216 | 0 | for ( Iterator it = toLines( "packageNamesLocation", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
217 | |
{ |
218 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
219 | |
} |
220 | 0 | for ( Iterator it = toLines( "Specifies the location of the package names XML to be used to configure the Checkstyle Packages.This 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.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
221 | |
{ |
222 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
223 | |
} |
224 | 0 | for ( Iterator it = toLines( "propertiesFile", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
225 | |
{ |
226 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
227 | |
} |
228 | 0 | for ( Iterator it = toLines( "Specifies the location of the Checkstyle properties file that will be used to check the source.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
229 | |
{ |
230 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
231 | |
} |
232 | 0 | for ( Iterator it = toLines( "propertiesLocation", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
233 | |
{ |
234 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
235 | |
} |
236 | 0 | for ( Iterator it = toLines( "Specifies the location of the properties file.This 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.The contents of the propertiesLocation will be made available to Checkstyle for specifying values for parameters within the xml configuration (specified in the configLocation parameter).", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
237 | |
{ |
238 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
239 | |
} |
240 | 0 | for ( Iterator it = toLines( "propertiesURL", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
241 | |
{ |
242 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
243 | |
} |
244 | 0 | for ( Iterator it = toLines( "Specifies the URL of the Checkstyle properties that will be used to check the source.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
245 | |
{ |
246 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
247 | |
} |
248 | 0 | for ( Iterator it = toLines( "propertyExpansion", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
249 | |
{ |
250 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
251 | |
} |
252 | 0 | for ( Iterator it = toLines( "Allows for specifying raw property expansion information.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
253 | |
{ |
254 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
255 | |
} |
256 | 0 | for ( Iterator it = toLines( "skip (Default: 'false')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
257 | |
{ |
258 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
259 | |
} |
260 | 0 | for ( Iterator it = toLines( "Skip entire check.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
261 | |
{ |
262 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
263 | |
} |
264 | 0 | for ( Iterator it = toLines( "sourceDirectory (Default: '${project.build.sourceDirectory}')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
265 | |
{ |
266 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
267 | |
} |
268 | 0 | for ( Iterator it = toLines( "Specifies the location of the source directory to be used for Checkstyle.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
269 | |
{ |
270 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
271 | |
} |
272 | 0 | for ( Iterator it = toLines( "suppressionsFile", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
273 | |
{ |
274 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
275 | |
} |
276 | 0 | for ( Iterator it = toLines( "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.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
277 | |
{ |
278 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
279 | |
} |
280 | 0 | for ( Iterator it = toLines( "suppressionsFileExpression (Default: 'checkstyle.suppressions.file')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
281 | |
{ |
282 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
283 | |
} |
284 | 0 | for ( Iterator it = toLines( "The key to be used in the properties for the suppressions file.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
285 | |
{ |
286 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
287 | |
} |
288 | 0 | for ( Iterator it = toLines( "suppressionsLocation", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
289 | |
{ |
290 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
291 | |
} |
292 | 0 | for ( Iterator it = toLines( "Specifies the location of the suppressions XML file to use.This 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.See suppressionsFileExpression for the property that will be made available to your checkstyle configuration.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
293 | |
{ |
294 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
295 | |
} |
296 | 0 | for ( Iterator it = toLines( "testSourceDirectory (Default: '${project.build.testSourceDirectory}')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
297 | |
{ |
298 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
299 | |
} |
300 | 0 | for ( Iterator it = toLines( "Specifies the location of the test source directory to be used for Checkstyle.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
301 | |
{ |
302 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
303 | |
} |
304 | 0 | for ( Iterator it = toLines( "useFile", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
305 | |
{ |
306 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
307 | |
} |
308 | 0 | for ( Iterator it = toLines( "If null, the Checkstyle plugin will display violations on stdout. Otherwise, a text file will be created with the violations.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
309 | |
{ |
310 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
311 | |
} |
312 | 0 | for ( Iterator it = toLines( "xrefLocation (Default: '${project.reporting.outputDirectory}/xref')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
313 | |
{ |
314 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
315 | |
} |
316 | 0 | for ( Iterator it = toLines( "Location of the Xrefs to link to.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
317 | |
{ |
318 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
319 | |
} |
320 | 0 | } |
321 | |
|
322 | 0 | sb.append( "\n" ); |
323 | |
|
324 | 0 | sb.append( "checkstyle:check" ).append( "\n" ); |
325 | 0 | for ( Iterator it = toLines( "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." ).iterator(); it.hasNext(); ) |
326 | 0 | { |
327 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
328 | 0 | } |
329 | 0 | if ( detail ) |
330 | 0 | { |
331 | 0 | sb.append( "\n" ); |
332 | 0 | |
333 | 0 | sb.append( repeat( " ", 2 ) ); |
334 | 0 | sb.append( "Available parameters:" ).append( "\n" ); |
335 | |
|
336 | 0 | sb.append( "\n" ); |
337 | |
|
338 | 0 | for ( Iterator it = toLines( "failOnViolation (Default: 'true')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
339 | |
{ |
340 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
341 | |
} |
342 | 0 | for ( Iterator it = toLines( "Do we fail the build on a violation?", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
343 | |
{ |
344 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
345 | |
} |
346 | 0 | for ( Iterator it = toLines( "outputFile (Default: '${project.build.directory}/checkstyle-result.xml')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
347 | |
{ |
348 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
349 | |
} |
350 | 0 | for ( Iterator it = toLines( "Specifies the path and filename to save the Checkstyle output. The format of the output file is determined by the outputFileFormat parameter.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
351 | |
{ |
352 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
353 | |
} |
354 | 0 | for ( Iterator it = toLines( "outputFileFormat (Default: 'xml')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
355 | |
{ |
356 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
357 | |
} |
358 | 0 | for ( Iterator it = toLines( "Specifies the format of the output to be used when writing to the output file. Valid values are 'plain' and 'xml'.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
359 | |
{ |
360 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
361 | |
} |
362 | 0 | for ( Iterator it = toLines( "skip (Default: 'false')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
363 | |
{ |
364 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
365 | |
} |
366 | 0 | for ( Iterator it = toLines( "Skip entire check.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
367 | |
{ |
368 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
369 | |
} |
370 | 0 | for ( Iterator it = toLines( "violationSeverity (Default: 'error')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
371 | |
{ |
372 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
373 | |
} |
374 | 0 | for ( Iterator it = toLines( "The lowest severity level that is considered a violation. Valid values are 'error', 'warning' and 'info'.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
375 | |
{ |
376 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
377 | |
} |
378 | |
} |
379 | |
|
380 | 0 | sb.append( "\n" ); |
381 | |
|
382 | 0 | sb.append( "checkstyle:help" ).append( "\n" ); |
383 | 0 | for ( Iterator it = toLines( "Display help information on 'org.apache.maven.plugins:maven-checkstyle-plugin' plugin. Call 'mvn checkstyle:help -Ddetail=true' to display all details." ).iterator(); it.hasNext(); ) |
384 | |
{ |
385 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
386 | |
} |
387 | 0 | if ( detail ) |
388 | |
{ |
389 | 0 | sb.append( "\n" ); |
390 | |
|
391 | 0 | sb.append( repeat( " ", 2 ) ); |
392 | 0 | sb.append( "Available parameters:" ).append( "\n" ); |
393 | |
|
394 | 0 | sb.append( "\n" ); |
395 | |
|
396 | 0 | for ( Iterator it = toLines( "detail (Default: 'false')", repeat( " ", 4 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
397 | |
{ |
398 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
399 | |
} |
400 | 0 | for ( Iterator it = toLines( "If true, display all settable properies for each goal.", repeat( " ", 6 ), DEFAULT_WIDTH ).iterator(); it.hasNext(); ) |
401 | |
{ |
402 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
403 | |
} |
404 | |
} |
405 | |
|
406 | 0 | sb.append( "\n" ); |
407 | |
|
408 | 0 | sb.append( "checkstyle:help" ).append( "\n" ); |
409 | 0 | for ( Iterator it = toLines( "Display help information on 'org.apache.maven.plugins:maven-checkstyle-plugin' plugin. Call 'mvn checkstyle:help -Ddetail=true' to display all details." ).iterator(); it.hasNext(); ) |
410 | |
{ |
411 | 0 | sb.append( it.next().toString() ).append( "\n" ); |
412 | |
} |
413 | |
|
414 | 0 | if ( getLog().isInfoEnabled() ) |
415 | |
{ |
416 | 0 | getLog().info( sb.toString() ); |
417 | |
} |
418 | 0 | } |
419 | |
|
420 | |
|
421 | |
|
422 | |
|
423 | |
|
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
|
429 | |
private static String repeat( String str, int repeat ) |
430 | |
{ |
431 | 0 | StringBuffer buffer = new StringBuffer( repeat * str.length() ); |
432 | |
|
433 | 0 | for ( int i = 0; i < repeat; i++ ) |
434 | |
{ |
435 | 0 | buffer.append( str ); |
436 | |
} |
437 | |
|
438 | 0 | return buffer.toString(); |
439 | |
} |
440 | |
|
441 | |
|
442 | |
|
443 | |
|
444 | |
|
445 | |
|
446 | |
|
447 | |
|
448 | |
|
449 | |
private static List toLines( String str ) |
450 | |
{ |
451 | 0 | return toLines( str, DEFAULT_INDENT, DEFAULT_WIDTH ); |
452 | |
} |
453 | |
|
454 | |
|
455 | |
|
456 | |
|
457 | |
|
458 | |
|
459 | |
|
460 | |
|
461 | |
|
462 | |
|
463 | |
|
464 | |
|
465 | |
private static List toLines( String str, String indent, int size ) |
466 | |
{ |
467 | 0 | List sentences = new ArrayList(); |
468 | |
|
469 | 0 | if ( indent == null ) |
470 | |
{ |
471 | 0 | indent = ""; |
472 | |
} |
473 | |
|
474 | 0 | if ( size < 0 ) |
475 | |
{ |
476 | 0 | throw new IllegalArgumentException( "size should be positive" ); |
477 | |
} |
478 | |
|
479 | 0 | StringBuffer tmp = new StringBuffer( indent ); |
480 | 0 | StringTokenizer tokenizer = new StringTokenizer( str, " " ); |
481 | 0 | while ( tokenizer.hasMoreTokens() ) |
482 | |
{ |
483 | 0 | String word = tokenizer.nextToken(); |
484 | |
|
485 | 0 | if ( tmp.length() + word.length() + 1 < size ) |
486 | |
{ |
487 | 0 | tmp.append( word ).append( " " ); |
488 | |
} |
489 | |
else |
490 | |
{ |
491 | 0 | sentences.add( tmp.toString() ); |
492 | 0 | tmp = new StringBuffer( indent ); |
493 | 0 | tmp.append( word ).append( " " ); |
494 | |
} |
495 | |
} |
496 | |
|
497 | 0 | if ( tmp.toString().length() > 0 ) |
498 | |
{ |
499 | 0 | sentences.add( tmp.toString() ); |
500 | |
} |
501 | |
|
502 | 0 | return sentences; |
503 | |
} |
504 | |
} |