root/trunk/config/jcoderz-checkstyle.xml

Revision 1089, 22.8 kB (checked in by amandel, 4 years ago)

Don't fail if no class information is found

  • Property svn:mime-type set to text/xml
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1<?xml version="1.0"?>
2<!DOCTYPE module PUBLIC
3    "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
4    "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
5
6<!-- $Id$ -->
7
8<!--
9  a Checkstyle configuration that checks
10  the jCoderZ Java Code Conventions and
11  some best practices
12-->
13
14<module name="Checker">
15
16    <!-- force locale settings, because the checkstyle finding message is used to detect the finding type -->
17    <property name="localeCountry" value="US"/>
18    <property name="localeLanguage" value="en"/>
19   <!--
20      <property name="severity" value="ignore"/>
21
22      ignore
23      info
24      warning
25      error
26   -->
27   <!-- we now have a package xml....
28   <module name="PackageHtml">
29      <property name="severity" value="info"/>
30   </module>
31   -->
32
33   <!-- Checks whether files end with a new line. [new] -->
34   <!-- No need with SVN... And always confusing false positives.
35   <module name="NewlineAtEndOfFile">
36      <property name="severity" value="warning"/>
37   </module>
38      -->
39
40   <!-- Performs a line-by-line comparison of all code lines and
41        reports  duplicate code, i.e. a sequence of lines that differ
42        only in indentation. -->
43   <!--
44   <module name="StrictDuplicateCode">
45      <property name="min" value="45"/>
46      <property name="severity" value="warning"/>
47   </module>
48   -->
49
50   <module name="TreeWalker">
51      <property name="tabWidth" value="4"/>
52
53      <!-- jCoderZ Java Code Conventions -->
54
55      <!-- Don't use magics -->
56      <module name="MagicNumber">
57         <property name="ignoreNumbers" value="-1, 0, 1"/>
58         <!-- property name="allowInConstants" value="true"/ Checkstyle Feature Request: 1244439-->
59      </module>
60
61      <!-- We require a whitespace after method declarations just before the '('. -->
62      <module name="MethodParamPad">
63         <property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
64         <property name="option" value="space"/>
65         <property name="allowLineBreaks" value="true"/>
66      </module>
67
68      <!-- File Header conventions -->
69
70      <!-- Checks the header of a source file against a header file that contains a regular expression -->
71     <module name="RegexpHeader">
72         <property name="header" value='^/\*$\n^ \* \$[I]d.*\$$\n^ \*$\n^ \* Copyright .*, The jCoderZ.org Project. All rights reserved.$\n^ \*$\n^ \* Redistribution and use in source and binary forms, with or without$\n^ \* modification, are permitted provided that the following conditions are$\n^ \* met:$\n^ \*$\n^ \*    \* Redistributions of source code must retain the above copyright$\n^ \*      notice, this list of conditions and the following disclaimer.$\n^ \*    \* Redistributions in binary form must reproduce the above$\n^ \*      copyright notice, this list of conditions and the following$\n^ \*      disclaimer in the documentation and/or other materials$\n^ \*      provided with the distribution.$\n^ \*    \* Neither the name of the jCoderZ.org Project nor the names of$\n^ \*      its contributors may be used to endorse or promote products$\n^ \*      derived from this software without specific prior written$\n^ \*      permission.$\n^ \*$\n^ \* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND$\n^ \* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE$\n^ \* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR$\n^ \* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS$\n^ \* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR$\n^ \* CONSEQUENTIAL DAMAGES \(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF$\n^ \* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR$\n^ \* BUSINESS INTERRUPTION\) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,$\n^ \* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \(INCLUDING NEGLIGENCE OR$\n^ \* OTHERWISE\) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF$\n^ \* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.$\n^ \*/$\n'/>
73         <property name="severity" value="warning"/>
74      </module>
75
76      <!-- Source File content ordering conventions -->
77
78      <!-- Checks that the order of modifiers conforms to the Java Language specification -->
79      <module name="ModifierOrder">
80         <property name="severity" value="warning"/>
81      </module>
82
83
84      <!-- Comments conventions -->
85
86      <!-- Checks Javadoc comments for class and interface definitions -->
87      <module name="JavadocType">
88         <property name="scope" value="public"/>
89         <property name="authorFormat" value="\S"/>
90         <property name="severity" value="warning"/>
91      </module>
92
93      <!-- Checks Javadoc comments for constructor and method definitions -->
94      <module name="JavadocMethod">
95         <property name="scope" value="public"/>
96         <property name="allowUndeclaredRTE" value="true"/>
97         <property name="severity" value="warning"/>
98      </module>
99
100      <!-- Checks that variables have Javadoc comments. -->
101      <module name="JavadocVariable">
102         <property name="scope" value="public"/>
103         <property name="severity" value="warning"/>
104      </module>
105
106      <!-- Validates Javadoc comments to help ensure they are well formed. -->
107      <module name="JavadocStyle">
108         <property name="scope" value="public"/>
109         <property name="severity" value="warning"/>
110      </module>
111
112      <!-- Naming conventions -->
113
114      <!-- The prefix of a unique package name is always org.jcoderz. -->
115      <module name="PackageName">
116         <property name="format" value="^org\.(jcoderz)(\.[a-z][a-z0-9]*)+$"/>
117         <property name="severity" value="error"/>
118      </module>
119
120      <!-- Class and interface names should be capitalized -->
121      <!-- In mixed case with the first letter of each internal word capitalized -->
122      <module name="TypeName">
123         <property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
124         <property name="severity" value="error"/>
125      </module>
126
127      <!-- The name of natural members should start with a lowercase 'm' -->
128      <module name="MemberName">
129         <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
130         <property name="severity" value="error"/>
131      </module>
132
133      <!-- The name of class members should start with a lowercase 's' -->
134      <module name="StaticVariableName">
135         <property name="format" value="^s[A-Z][a-zA-Z0-9]*$"/>
136         <property name="severity" value="error"/>
137      </module>
138
139      <!-- The name of constants should be all uppercase with words separated by underscores -->
140      <module name="ConstantName">
141         <property name="format" value="^((logger)|([A-Z](_?[A-Z0-9]+)*)$)"/>
142         <property name="severity" value="error"/>
143      </module>
144
145      <!-- The name of methods should be lowercase -->
146      <!-- In mixed case with the first letter of each internal word capitalized -->
147      <module name="MethodName">
148         <property name="severity" value="error"/>
149      </module>
150
151      <!-- Variable names are in mixed case with a lowercase first letter, -->
152      <!-- internal words start with capital letters-->
153      <module name="LocalVariableName">
154         <property name="severity" value="error"/>
155      </module>
156
157
158      <!-- Checks for imports -->
159
160      <!-- Checks that there are no import statements that use the * notation. -->
161      <module name="AvoidStarImport">
162         <property name="severity" value="info"/>
163      </module>
164
165      <!-- Checks for imports from a set of illegal packages. -->
166      <module name="IllegalImport">
167         <property name="illegalPkgs"
168                   value="com.brokat, sun"/>
169         <property name="severity" value="warning"/>
170      </module>
171
172      <!-- Checks for redundant import statements. [new] -->
173      <module name="RedundantImport">
174         <property name="severity" value="info"/>
175      </module>
176
177      <!-- Checks for unused import statements. -->
178      <module name="UnusedImports">
179         <property name="severity" value="info"/>
180      </module>
181
182
183      <!-- Checks for Size Violations -->
184
185      <!-- enforce default line length limit -->
186      <module name="LineLength">
187         <property name="max" value="80"/>
188         <property name="severity" value="warning"/>
189         <property name="ignorePattern" value="(.*\*.*home=)|(.*\*.*business=)|(\$Id: .*)|(.*\*.*\{@link)|(.*\*.*@see )|(.*\*.*remote-business-interface)" />
190      </module>
191
192      <!-- enforce default method length limit (max = 150) -->
193      <module name="MethodLength">
194         <property name="severity" value="warning"/>
195         <property name="max" value="100"/>
196      </module>
197
198      <!-- enforce default class length limit (max = 2000) -->
199      <module name="FileLength">
200         <property name="severity" value="warning"/>
201         <property name="max" value="2500"/>
202      </module>
203
204      <!-- Checks for long anonymous inner classes. -->
205      <module name="AnonInnerLength">
206         <property name="max" value="20"/>
207         <property name="severity" value="info"/>
208      </module>
209
210      <!-- Checks the number of parameters of a method or constructor.  -->
211      <module name="ParameterNumber">
212         <property name="max" value="10"/>
213         <property name="severity" value="warning"/>
214      </module>
215
216
217      <!-- White Space conventions -->
218
219      <!-- Checks that there are no tab characters ('\t') in the source code -->
220      <module name="TabCharacter">
221         <property name="severity" value="error"/>
222      </module>
223
224      <!-- Checks that there is no whitespace after '.' and unary operators -->
225      <module name="NoWhitespaceAfter">
226         <property name="tokens"
227             value="ARRAY_INIT, BNOT, DEC, DOT, INC, UNARY_MINUS, UNARY_PLUS"/>
228         <property name="severity" value="warning"/>
229      </module>
230
231      <!-- Checks that there is no whitespace before tokens SEMI, DOT, POST_DEC, POST_INC -->
232      <module name="NoWhitespaceBefore">
233         <property name="severity" value="warning"/>
234      </module>
235
236      <!-- Checks the policy on how to wrap lines on operators -->
237      <!-- The operator must be on a new line, except assignment operators -->
238      <module name="OperatorWrap">
239         <property name="severity" value="warning"/>
240      </module>
241
242      <!-- Checks the policy on the padding of parentheses; i.e. whether
243           a space is required after a left parenthesis and before a
244           right parenthesis, or such spaces are forbidden. -->
245      <module name="ParenPad">
246         <property name="severity" value="warning"/>
247      </module>
248
249      <!-- Checks that commas and casts are followed by whitespace -->
250      <module name="WhitespaceAfter">
251         <property name="tokens" value="COMMA, TYPECAST"/>
252         <property name="severity" value="warning"/>
253      </module>
254
255      <!-- Checks that a token is surrounded by whitespace -->
256      <module name="WhitespaceAround">
257         <property name="severity" value="warning"/>
258         <property name="tokens"
259             value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR,
260                 BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
261                 EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT,
262                 LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
263                 LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED,
264                 LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD,
265                 MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY,
266                 SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
267          <!-- NOT: GENERIC_START  GENERIC_END  AND TYPE_EXTENSION_AND  WILDCARD_TYPE -->
268      </module>
269
270
271      <!-- Checks for blocks -->
272
273      <!-- The left brace must always be on a new line -->
274      <module name="LeftCurly">
275         <property name="option" value="nl"/>
276         <property name="severity" value="error"/>
277      </module>
278
279      <!-- The right brace must be alone on the line -->
280      <module name="RightCurly">
281         <property name="option" value="alone"/>
282         <property name="severity" value="error"/>
283      </module>
284
285      <!-- Checks for braces around code blocks -->
286      <module name="NeedBraces">
287         <property name="severity" value="warning"/>
288      </module>
289
290      <!-- Checks for empty block text policy -->
291      <module name="EmptyBlock">
292         <property name="option" value="text"/>
293         <property name="severity" value="warning"/>
294      </module>
295
296
297      <!-- Coding Problems -->
298
299      <!-- Checks that classes that define a covariant equals() method also
300           override method equals(java.lang.Object). -->
301      <module name="CovariantEquals">
302         <property name="severity" value="error"/>
303      </module>
304
305      <!-- The "double-checked locking" idiom (DCL) tries to avoid
306           the runtime cost of synchronization. -->
307      <module name="DoubleCheckedLocking">
308         <property name="severity" value="error"/>
309      </module>
310
311      <!-- Detects empty statements (standalone ;). [new] -->
312      <module name="EmptyStatement">
313         <property name="severity" value="warning"/>
314      </module>
315
316      <!-- Checks that classes that override equals() also override
317           hashCode().  [new] -->
318      <module name="EqualsHashCode">
319         <property name="severity" value="error"/>
320      </module>
321
322      <!-- Checks that local variables that never have their values
323           changed are declared final. -->
324      <module name="FinalLocalVariable">
325         <property name="severity" value="info"/>
326      </module>
327
328      <!-- Checks that a local variable or a parameter does not shadow
329           a field that is defined in the same class.  [new] -->
330      <module name="HiddenField">
331         <property name="severity" value="warning"/>
332      </module>
333
334      <!-- Checks for illegal instantiations where a factory method
335           is preferred. [new]  -->
336      <module name="IllegalInstantiation">
337         <property name="classes" value="java.lang.Boolean, java.util.Calendar"/>
338         <property name="severity" value="warning"/>
339      </module>
340
341      <!-- Checks for assignments in subexpressions, such as in
342           String s = Integer.toString(i = 2);. [new] -->
343      <module name="InnerAssignment">
344         <property name="severity" value="warning"/>
345      </module>
346
347      <!-- Checks that switch statement has "default" clause -->
348      <module name="MissingSwitchDefault">
349         <property name="severity" value="error"/>
350      </module>
351
352      <!-- Checks for redundant exceptions declared in throws clause
353           such as duplicates, unchecked exceptions or subclasses of
354           another declared exception. -->
355      <module name="RedundantThrows">
356         <property name="allowUnchecked" value="true"/>
357         <property name="allowSubclasses" value="true"/>
358         <property name="severity" value="warning"/>
359         <property name="logLoadErrors" value="true"/>
360      </module>
361
362      <!-- Checks for overly complicated boolean expressions.
363           Currently finds code like if (b == true),
364           b || true, !false, etc. [new] -->
365      <module name="SimplifyBooleanExpression">
366         <property name="severity" value="info"/>
367      </module>
368
369      <!-- Checks for overly complicated boolean return statements.
370           For example the following code [new] -->
371      <module name="SimplifyBooleanReturn">
372         <property name="severity" value="info"/>
373      </module>
374
375      <!-- Checks that string literals are not used with == or !=. -->
376      <module name="StringLiteralEquality">
377         <property name="severity" value="error"/>
378      </module>
379
380      <!-- Restricts nested if-else blocks to a specified depth. -->
381      <module name="NestedIfDepth">
382         <property name="max" value="2"/>
383         <property name="severity" value="warning"/>
384      </module>
385
386      <!-- Restricts nested if-else blocks to a specified depth. -->
387      <module name="NestedTryDepth">
388         <property name="max" value="2"/>
389         <property name="severity" value="warning"/>
390      </module>
391
392      <!--  Checks that an overriding clone() method invokes super.clone(). -->
393      <module name="SuperClone">
394         <property name="severity" value="error"/>
395      </module>
396
397      <!-- Checks that an overriding finalize() method invokes super.finalize().
398           -->
399      <module name="SuperFinalize">
400         <property name="severity" value="error"/>
401      </module>
402
403      <!-- Catching java.lang.Throwable, java.lang.Error is almost never acceptable. -->
404      <module name="IllegalCatch">
405         <property name="illegalClassNames"
406                   value="java.lang.Error, java.lang.Throwable"/>
407         <property name="severity" value="warning"/>
408      </module>
409
410      <!-- Ensures that the setUp(), tearDown()methods are named correctly,
411           have no arguments, return void and are either public or protected.
412           Also ensures that suite() is named correctly, have no arguments,
413           return junit.framewotk.Test, public and static.
414      <module name="JUnitTestCase">
415         <property name="severity" value="warning"/>
416      </module> -->
417
418      <!-- Restrict the number of return statements. -->
419      <module name="ReturnCount">
420         <property name="max" value="1"/>
421         <property name="severity" value="warning"/>
422      </module>
423
424      <!-- Checks that particular class are never used as types in
425           variable declarations, return values or parameters.
426           Includes a pattern check that by default disallows
427           abstract classes. -->
428      <module name="IllegalType">
429         <property name="illegalClassNames"
430                   value="java.util.Hashtable, java.util.Vector"/>
431         <property name="severity" value="error"/>
432      </module>
433      <module name="IllegalType">
434         <property name="severity" value="warning"/>
435      </module>
436
437      <!-- According to Code Conventions for the Java Programming Language ,
438           the parts of a class or interface declaration should appear in the
439           well-defined order. -->
440      <module name="DeclarationOrder">
441         <property name="severity" value="warning"/>
442      </module>
443
444      <!-- Disallow assignment of parameters. -->
445      <module name="ParameterAssignment">
446         <property name="severity" value="warning"/>
447      </module>
448
449      <!--
450         Checks that logger calls use level FINE or smaller.
451      -->
452      <!--module name="org.jcoderz.phoenix.checkstyle.LoggingLevel">
453         <property name="severity" value="warning"/>
454         <property name="loggerName" value="log"/>
455         <property name="logCallMaxLevel" value="CONFIG"/>
456         <property name="allowedLoggerMethods" value="config,fine,finer,entering,exiting,throwing,finest"/>
457      </module-->
458
459      <!-- Checks if any class or object member explicitly initialized to
460           default for its type value (null for object references, zero
461           for numeric types and char and false for booolean. -->
462      <!--
463      <module name="ExplicitInitialization">
464         <property name="severity" value="warning"/>
465      </module>
466      -->
467
468
469      <!-- Design Problems -->
470
471      <!-- Checks visibility of class members. -->
472      <module name="VisibilityModifier">
473         <property name="severity" value="warning"/>
474      </module>
475
476      <!-- Checks that a class which has only private constructors
477           is declared as final. [new] -->
478      <module name="FinalClass">
479         <property name="severity" value="info"/>
480      </module>
481
482      <!-- Implements Bloch, Effective Java, Item 17 -
483           Use Interfaces only to define types.  [new] -->
484      <module name="InterfaceIsType">
485         <property name="severity" value="warning"/>
486      </module>
487
488      <!-- Make sure that utility classes
489           (classes that contain only static methods) do not
490           have a public constructor. [new] -->
491      <module name="HideUtilityClassConstructor">
492         <property name="severity" value="warning"/>
493      </module>
494
495      <!-- Ensures that exceptions are immutable. -->
496      <!--
497      <module name="MutableException">
498         <property name="severity" value="warning"/>
499      </module>
500      -->
501
502      <!-- Restricts throws statements to a specified count. -->
503      <!--
504      <module name="ThrowsCount">
505         <property name="max" value="2"/>
506         <property name="severity" value="warning"/>
507      </module>
508      -->
509
510      <!-- Metrics Checks -->
511
512      <!-- Checks cyclomatic complexity against a specified limit. -->
513      <module name="CyclomaticComplexity">
514         <property name="max" value="12"/>
515         <property name="severity" value="warning"/>
516      </module>
517      <module name="CyclomaticComplexity">
518         <property name="max" value="20"/>
519         <property name="severity" value="error"/>
520      </module>
521
522      <!-- Misc -->
523
524      <!-- checks for reminder comments -->
525      <module name="TodoComment">
526         <property name="format"
527            value="(TODO|FIXME|CHECKME)"/>
528         <property name="severity" value="info"/>
529      </module>
530
531      <!-- checks for wrong reminder comments -->
532      <module name="TodoComment">
533         <property name="format"
534            value="(DOCUMENT ME|To change the template)"/>
535         <property name="severity" value="warning"/>
536      </module>
537
538      <!-- Checks that long constants are defined with an upper ell.
539           That is ' L' and not 'l'. [new] -->
540      <module name="UpperEll">
541         <property name="severity" value="warning"/>
542      </module>
543
544      <!-- Checks the style of array type definitions. [new] -->
545      <module name="ArrayTypeStyle">
546         <property name="severity" value="info"/>
547      </module>
548
549      <!-- Checks correct indentation of Java Code. -->
550      <!-- DISABLED [mig] (caused 43752 findings in current code [am])
551      <module name="Indentation">
552         <property name="caseIndent" value="0"/>
553         <property name="basicOffset" value="4"/>
554         <property name="severity" value="warning"/>
555      </module>
556      -->
557
558
559      <!-- Checks for Usage -->
560
561      <!-- Checks that a private field is used in more than one method,
562           constructor, or initializer.-->
563      <!--
564      <module name="usage.OneMethodPrivateField">
565         <property name="severity" value="warning"/>
566      </module>
567      -->
568
569      <!-- Checks that a local variable is used after its declaration. -->
570<!--
571      <module name="usage.UnusedLocalVariable">
572         <property name="severity" value="warning"/>
573      </module>
574-->
575      <!-- Checks that a parameter is used. -->
576      <!--
577      <module name="usage.UnusedParameter">
578         <property name="severity" value="warning"/>
579      </module>
580      -->
581<!--
582      <module name="usage.UnusedPrivateField">
583         <property name="severity" value="warning"/>
584         <property name="ignoreFormat" value="(^logger$)|(^serialVersionUID$)"/>
585      </module>
586-->
587      <!-- Checks that a private method is used. -->
588      <!-- DISABLED, pmd rule used instead (this one generates
589           many false-positives -->
590      <!--
591      <module name="usage.UnusedPrivateMethod">
592         <property name="ignoreFormat" value="^readResolve$"/>
593         <property name="severity" value="warning"/>
594      </module>
595      -->
596   </module>
597
598
599</module>
Note: See TracBrowser for help on using the browser.