root/trunk/src/xml/checkstyle-messages.xml

Revision 1449, 77.8 kB (checked in by amandel, 3 years ago)

Start of a generic reader for text based log files.
Many open ends and several fields are not used yet.
Initial support for javadoc logfile #63

  • Property svn:mime-type set to text/xml
  • Property svn:eol-style set to native
Line 
1<?xml version="1.0" encoding="ASCII"?>
2<CheckstyleMessages
3        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
4   xsi:noNamespaceSchemaLocation='schema/checkstyle-message.xsd'>
5
6   <FindingType>
7      <Symbol>CS_CONTENT</Symbol>
8      <ShortDescription>content</ShortDescription>
9      <MessagePattern>Empty .* block\.</MessagePattern>
10      <DetailedDescription>
11<![CDATA[
12<p>The block should not be empty.
13If you think this is ok you must at least put a comment inside
14this block, describing why it is ok.</p>
15]]>
16      </DetailedDescription>
17   </FindingType>
18
19   <FindingType>
20      <Symbol>CS_CURLY</Symbol>
21      <ShortDescription>Curly</ShortDescription>
22      <MessagePattern>'[\{\}]' should be on a new line\.</MessagePattern>
23      <DetailedDescription>
24<![CDATA[
25<p>Curley braces must be placed on a new line.</p>
26]]>
27      </DetailedDescription>
28   </FindingType>
29
30   <FindingType>
31      <Symbol>CS_RIGHT_CURLY</Symbol>
32      <ShortDescription>RightCurly</ShortDescription>
33      <MessagePattern>'\}' should be alone on a line\.</MessagePattern>
34      <DetailedDescription>
35<![CDATA[
36<p>Curley braces must be placed on a new line. Right curley braces are always
37alone in a line.</p>
38]]>
39      </DetailedDescription>
40   </FindingType>
41
42   <FindingType>
43      <Symbol>CS_OPERATOR</Symbol>
44      <ShortDescription>Operator should be on a new line.</ShortDescription>
45      <MessagePattern>'[^\}\{]*' should be on a new line\.</MessagePattern>
46      <DetailedDescription>
47<![CDATA[
48<p>line break should be placed before operator.</p>
49]]>
50      </DetailedDescription>
51   </FindingType>
52
53   <FindingType>
54      <Symbol>CS_NEED_BRACES</Symbol>
55      <ShortDescription>NeedBraces</ShortDescription>
56      <MessagePattern>'.*' construct must use '\{\}'s\.</MessagePattern>
57      <DetailedDescription>
58<![CDATA[
59      <p class="body">
60      Checks for braces around code blocks.
61      </p>
62]]>
63      </DetailedDescription>
64   </FindingType>
65
66   <FindingType>
67      <Symbol>CS_AVOID_NESTED_BLOCKS</Symbol>
68      <ShortDescription>Avoid nested blocks.</ShortDescription>
69      <MessagePattern>Avoid nested blocks\.</MessagePattern>
70      <DetailedDescription>
71<![CDATA[
72      <p class="body">
73      Finds nested blocks, i.e. blocks that are used freely in the code.
74      <p class="body">
75          Rationale: Nested blocks are often leftovers from the debugging process,
76          they confuse the reader.
77      </p>
78
79      <p>
80      For example this Check finds the obsolete braces in
81      </p>
82      <pre class="body">
83 public void guessTheOutput()
84 {
85     int whichIsWich = 0;
86     {
87         int whichIsWhich = 2;
88     }
89     System.out.println("value = " + whichIsWhich);
90 }
91 </pre>
92      <p class="body">
93      and debugging / refactoring leftovers such as
94      </p>
95
96      <pre class="body">
97// if (conditionThatIsNotUsedAnyLonger)
98{
99    System.out.println("unconditional");
100}
101</pre>
102
103      <p class="body">
104      A case in a switch statement does not implicitly form a block.
105      Thus to be able to introduce local variables that have case scope
106      it is necessary to open a nested block. This is supported, set
107      the allowInSwitchCase property to true and include all statements
108      of the case in the block.
109      </p>
110
111  <pre class="body">
112switch (a)
113{
114    case 0:
115        // Never OK, break outside block
116        {
117            x = 1;
118        }
119        break;
120    case 1:
121        // Never OK, statement outside block
122        System.out.println("Hello");
123        {
124            x = 2;
125            break;
126        }
127    case 1:
128        // OK if allowInSwitchCase is true
129        {
130            System.out.println("Hello");
131            x = 2;
132            break;
133        }
134}
135</pre>
136
137
138]]>
139      </DetailedDescription>
140   </FindingType>
141
142   <FindingType>
143      <Symbol>CS_ARRAY_TRAILING_COMMA</Symbol>
144      <ShortDescription>ArrayTrailingComma</ShortDescription>
145      <MessagePattern>TODO</MessagePattern>
146      <DetailedDescription>
147<![CDATA[
148      <p class="body">
149      Checks that array initialization contains a trailing comma.
150      </p>
151      <pre class="body" >
152      int[] a = new int[]
153      {
154          1,
155          2,
156          3,
157      };
158      </pre>
159      <p class="body">
160      The check allows to not add a comma if both left and right curlys
161      are on the same line.
162      </p>
163      <pre class="body">
164      return new int[] { 0 };
165      </pre>
166      <p class="body">
167      Rationale: Putting this comma in makes it easier to change the
168      order of the elements or add new elements on the end.
169      </p>
170]]>
171      </DetailedDescription>
172   </FindingType>
173
174   <FindingType>
175      <Symbol>CS_AVOID_INLINE_CONDITIONALS</Symbol>
176      <ShortDescription>AvoidInlineConditionals</ShortDescription>
177      <MessagePattern>TODO</MessagePattern>
178      <DetailedDescription>
179<![CDATA[
180      <p class="body">
181      Detects inline conditionals.
182
183      An example inline conditional is this:
184      </p>
185      <pre class="body" >
186String a = getParameter("a");
187String b = (a==null || a.length&lt;1) ? null : a.substring(1);
188      </pre>
189      <p class="body">
190      Rationale: Some developers find inline conditionals hard to read,
191      so their company's coding standards forbids them.
192      </p>
193]]>
194      </DetailedDescription>
195   </FindingType>
196
197   <FindingType>
198      <Symbol>CS_COVARIANT_EQUALS</Symbol>
199      <ShortDescription>CovariantEquals</ShortDescription>
200      <MessagePattern>covariant equals without overriding equals\(java.lang.Object\)\.</MessagePattern>
201      <DetailedDescription>
202<![CDATA[
203<p class="body">
204Rationale: Mistakenly defining a covariant equals() method
205without overriding method equals(java.lang.Object) can produce
206unexpected runtime behaviour.
207</p>
208]]>
209      </DetailedDescription>
210   </FindingType>
211
212   <FindingType>
213      <Symbol>CS_DOUBLE_CHECKED_LOCKING</Symbol>
214      <ShortDescription>DoubleCheckedLocking</ShortDescription>
215      <MessagePattern>The double-checked locking idiom is broken and should be avoided\.</MessagePattern>
216      <DetailedDescription>
217<![CDATA[
218      <p class="body">
219      The &quot;double-checked locking&quot; idiom (DCL) tries to avoid the runtime cost
220      of synchronization. An example that uses the DCL idiom is this:
221      </p>
222      <pre class="body">
223public class MySingleton
224{
225    private static theInstance = null;
226
227    private MySingleton() {}
228
229    public MySingleton getInstance() {
230        if ( theInstance == null ) { // synchronize only if necessary
231            synchronized( MySingleton.class ) {
232                if ( theInstance == null ) {
233                    theInstance = new MySingleton();
234                }
235            }
236        }
237    }
238}
239      </pre>
240      <p class="body">
241      The problem with the DCL idiom in Java is that it just does not work correctly.
242      Using it introduces bugs that are extremely hard to track down and reproduce.
243      The <a href="http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html">
244      &quot;Double-Checked Locking is Broken&quot; Declaration</a> has an in depth explanation
245      of the exact problem which has to do with the semantics of the Java memory model.
246      </p>
247      <p class="body">
248      The DoubleCheckedLocking check will find source code where a test is wrapped in a
249      synchronized block that is wrapped in the same test, like in the example above.
250      </p>
251]]>
252      </DetailedDescription>
253   </FindingType>
254
255   <FindingType>
256      <Symbol>CS_EMPTY_STATEMENT</Symbol>
257      <ShortDescription>Empty Statement</ShortDescription>
258      <MessagePattern>Empty statement\.</MessagePattern>
259      <DetailedDescription>
260<![CDATA[
261      <p class="body">
262      Detected empty statements (standalone ;).
263      </p>
264]]>
265      </DetailedDescription>
266   </FindingType>
267
268   <FindingType>
269      <Symbol>CS_EQUALS_HASH_CODE</Symbol>
270      <ShortDescription>EqualsHashCode</ShortDescription>
271      <MessagePattern>Definition of 'equals.*' without corresponding definition of 'hashCode.*'\.</MessagePattern>
272      <DetailedDescription>
273<![CDATA[
274<p>
275Rationale: The contract of equals() and hashCode() requires that equal objects
276have the same hashCode. Hence, whenever you override equals() you must override
277hashCode() to ensure that your class can be used in collections that are hash
278based.
279</p>
280]]>
281      </DetailedDescription>
282   </FindingType>
283
284   <FindingType>
285      <Symbol>CS_FINAL_LOCAL_VARIABLE</Symbol>
286      <ShortDescription>Local Variable should be declared final</ShortDescription>
287      <MessagePattern>Variable '.*' should be declared final\.</MessagePattern>
288      <DetailedDescription>
289<![CDATA[
290      <p class="body">
291      Checks that local variables that never have their values changed
292      are declared final.
293      </p>
294]]>
295      </DetailedDescription>
296   </FindingType>
297
298   <FindingType>
299      <Symbol>CS_HIDDEN_FIELD</Symbol>
300      <ShortDescription>HiddenField</ShortDescription>
301      <MessagePattern>TODO</MessagePattern>
302      <DetailedDescription>
303<![CDATA[
304      <p class="body">
305      Checks that a local variable or a parameter does not shadow a field that is
306      defined in the same class.
307      </p>
308]]>
309      </DetailedDescription>
310   </FindingType>
311
312   <FindingType>
313      <Symbol>CS_ILLEGAL_INSTANTIATION</Symbol>
314      <ShortDescription>Illegal Instantiation</ShortDescription>
315      <MessagePattern>Instantiation of .* should be avoided\.</MessagePattern>
316      <DetailedDescription>
317<![CDATA[
318      <p class="body">
319      Checks for illegal instantiations where a factory method is preferred.
320      </p>
321      <p class="body">
322      Rationale: Depending on the project, for some classes it might be preferable to
323      create instances through factory methods rather than calling the constructor.
324      </p>
325      <p class="body">
326      A simple example is the <span class="code">java.lang.Boolean</span> class. In
327      order to save memory and CPU cycles, it is preferable to use the predefined
328      constants <span class="code">
329      TRUE</span> and <span class="code">FALSE</span>. Constructor invocations should
330      be replaced by calls to <span class="code">Boolean.valueOf()</span>.
331      </p>
332      <p class="body">
333      Some extremely performance sensitive projects may require the use of factory
334      methods for other classes as well, to enforce the usage of number caches or
335      object pools.
336      </p>
337 <pre>   
338public class Foo
339{
340   private Boolean bar = new Boolean("true"); // just do a Boolean bar = Boolean.TRUE or Boolean.valueOf(true);
341}   
342</pre>     
343]]>
344      </DetailedDescription>
345   </FindingType>
346
347   <FindingType>
348      <Symbol>CS_ILLEGAL_TOKEN</Symbol>
349      <ShortDescription>IllegalToken</ShortDescription>
350      <MessagePattern>TODO</MessagePattern>
351      <DetailedDescription>
352<![CDATA[
353      <p class="body">
354      Checks for illegal tokens.
355      </p>
356      <p class="body">
357      Rational: Certain language features often lead to hard to
358      maintain code or are non-obvious to novice developers. Other
359      features may be discouraged in certain frameworks, such as not
360      having native methods in EJB components.
361      </p>
362      <table width="100%" border="1" cellpadding="5" class="body">
363        <tr class="header">
364          <th>name</th>
365          <th>description</th>
366          <th>type</th>
367          <th>default value</th>
368        </tr>
369        <tr>
370          <td>tokens</td>
371          <td>tokens to check</td>
372          <td>subset of <a
373          href="api/com/puppycrawl/tools/checkstyle/api/TokenTypes.html">TokenTypes</a>,
374          <a</td>
375          <td><a
376          href="api/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_SWITCH">LITERAL_SWITCH</a>,
377          <a
378          href="api/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#POST_INC">POST_INC</a>,
379          <a
380          href="api/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#POST_DEC">POST_DEC</a></td>
381        </tr>
382      </table>
383]]>
384      </DetailedDescription>
385   </FindingType>
386
387   <FindingType>
388      <Symbol>CS_ILLEGAL_TOKEN_TEXT</Symbol>
389      <ShortDescription>IllegalTokenText</ShortDescription>
390      <MessagePattern>TODO</MessagePattern>
391      <DetailedDescription>
392<![CDATA[
393      <p class="body">
394      Checks for illegal token text.
395      </p>
396      <table width="100%" border="1" cellpadding="5" class="body">
397        <tr class="header">
398          <th>name</th>
399          <th>description</th>
400          <th>type</th>
401          <th>default value</th>
402        </tr>
403        <tr>
404          <td>tokens</td>
405          <td>tokens to check</td>
406          <td>subset of <a
407          href="api/com/puppycrawl/tools/checkstyle/api/TokenTypes.html">TokenTypes</a>
408          </td>
409          <td>empty</td>
410        </tr>
411        <tr>
412          <td>format</td>
413          <td>illegal pattern</td>
414          <td><a href="property_types.html#regexp">regular expression</a></td>
415          <td><span class="default">^$</span> (empty)</td>
416        </tr>
417        <tr>
418          <td>ignoreCase</td>
419          <td>Controls whether to ignore case when matching.</td>
420          <td><a href="property_types.html#boolean">Boolean</a></td>
421          <td><span class="default">false</span></td>
422        </tr>
423        <tr>
424          <td>message</td>
425          <td>Message which is used to notify about violations;
426          if empty then the default message is used.</td>
427          <td><a href="property_types.html#String">String</a></td>
428          <td><span class="default">&quot;&quot;</span>(empty)</td>
429        </tr>
430      </table>
431]]>
432      </DetailedDescription>
433   </FindingType>
434
435   <FindingType>
436      <Symbol>CS_INNER_ASSIGNMENT</Symbol>
437      <ShortDescription>InnerAssignment</ShortDescription>
438      <MessagePattern>Inner assignments should be avoided\.</MessagePattern>
439      <DetailedDescription>
440<![CDATA[
441      <p class="body">
442      Checks for assignments in subexpressions, such as in <span class="code">String s
443      = Integer.toString(i = 2);</span>.
444      </p>
445      <p class="body">
446      Rationale: With the exception of <span class="code">for</span> iterators, all
447      assignments should occur in their own toplevel statement to increase readability.
448      With inner assignments like the above it is difficult to see all places where a
449      variable is set.
450      </p>
451]]>
452      </DetailedDescription>
453   </FindingType>
454
455   <FindingType>
456      <Symbol>CS_MAGIC_NUMBER</Symbol>
457      <ShortDescription>MagicNumber</ShortDescription>
458      <MessagePattern>'.*' is a magic number\.</MessagePattern>
459      <DetailedDescription>
460<![CDATA[
461      <p class="body">
462      Checks that there are no &quot;magic numbers&quot;, where a
463      magic number is a numeric literal that is not defined as a
464      constant. By default, -1, 0, 1, and 2 are not considered to
465      be magic numbers.
466      </p>
467]]>
468      </DetailedDescription>
469   </FindingType>
470
471   <FindingType>
472      <Symbol>CS_MISSING_SWITCH_DEFAULT</Symbol>
473      <ShortDescription>Missing Switch Default</ShortDescription>
474      <MessagePattern>switch without "default" clause\.</MessagePattern>
475      <DetailedDescription>
476<![CDATA[
477      <p class="body">
478      Checks that switch statement has &quot;default&quot; clause.
479      </p>
480      <p class="body">
481      Rationale: It's usually a good idea to introduce a default case
482      in every switch statement. Even if the developer is sure that
483      all currently possible cases are covered, this should be
484      expressed in the default branch, e.g. by using an
485      assertion. This way the code is protected aginst later changes,
486      e.g. introduction of new types in an enumeration type.
487      </p>
488]]>
489      </DetailedDescription>
490   </FindingType>
491
492   <FindingType>
493      <Symbol>CS_REDUNDANT_THROWS</Symbol>
494      <ShortDescription>RedundantThrows</ShortDescription>
495      <MessagePattern>TODO</MessagePattern>
496      <DetailedDescription>
497<![CDATA[
498      <p class="body">
499       Checks for redundant exceptions declared in throws clause
500        such as duplicates, unchecked exceptions or subclasses of
501        another declared exception.
502      </p>
503]]>
504      </DetailedDescription>
505   </FindingType>
506
507   <FindingType>
508      <Symbol>CS_SIMPLIFY_BOOLEAN_EXPRESSION</Symbol>
509      <ShortDescription>SimplifyBooleanExpression</ShortDescription>
510      <MessagePattern>Expression can be simplified.*</MessagePattern>
511      <DetailedDescription>
512<![CDATA[
513      <p class="body">
514      The expression ca be simplified. For example the following code
515      </p>
516      <pre class="body">
517if (isValid() == true)
518{
519   // code
520}
521      </pre>
522      <p class="body">
523      could be written as
524      </p>
525      <pre class="body">
526if (isValid())
527{
528   // code
529}
530      </pre>
531]]>
532      </DetailedDescription>
533   </FindingType>
534
535   <FindingType>
536      <Symbol>CS_SIMPLIFY_BOOLEAN_RETURN</Symbol>
537      <ShortDescription>SimplifyBooleanReturn</ShortDescription>
538      <MessagePattern>Conditional logic can be removed\.</MessagePattern>
539      <DetailedDescription>
540<![CDATA[
541      <p class="body">
542      Complicated boolean return statements. For example the following code
543      </p>
544      <pre class="body">
545if (valid())
546    return false;
547else
548    return true;
549      </pre>
550      <p class="body">
551      could be written as
552      </p>
553      <pre class="body">
554return !valid();
555      </pre>
556     
557Avoid unnecessary if..then..else statements when returning a boolean
558    <br></p><pre>
559
560public class Foo {
561  private int bar =2;
562  public boolean isBarEqualsTo(int x) {
563    // this bit of code
564    if (bar == x) {
565     return true;
566    } else {
567     return false;
568    }
569    // can be replaced with a simple
570    // return bar == x;
571  }
572}
573
574    </pre>     
575     
576]]>
577      </DetailedDescription>
578   </FindingType>
579
580   <FindingType>
581      <Symbol>CS_STRING_LITERAL_EQUALITY</Symbol>
582      <ShortDescription>StringLiteralEquality</ShortDescription>
583      <MessagePattern>TODO</MessagePattern>
584      <DetailedDescription>
585<![CDATA[
586]]>
587      </DetailedDescription>
588   </FindingType>
589
590   <FindingType>
591      <Symbol>CS_NESTED_IF_DEPTH</Symbol>
592      <ShortDescription>Nested If Depth Exceeded</ShortDescription>
593      <MessagePattern>Nested if-else depth is .* \(max allowed is .*\)\.</MessagePattern>
594      <DetailedDescription>
595<![CDATA[
596]]>
597      </DetailedDescription>
598   </FindingType>
599
600   <FindingType>
601      <Symbol>CS_NESTED_TRY_DEPTH</Symbol>
602      <ShortDescription>NestedTryDepth</ShortDescription>
603      <MessagePattern>TODO</MessagePattern>
604      <DetailedDescription>
605<![CDATA[
606]]>
607      </DetailedDescription>
608   </FindingType>
609
610   <FindingType>
611      <Symbol>CS_SUPER_CLONE</Symbol>
612      <ShortDescription>SuperClone</ShortDescription>
613      <MessagePattern>Method 'clone' should call 'super.clone'\.</MessagePattern>
614      <DetailedDescription>
615<![CDATA[
616      <p class="body">
617      An overriding <span class="code">clone()</span> method does not invoke <span class="code">super.clone()</span>.
618      </p>
619      <p class="body">
620      Reference: <a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#clone()">Object.clone()</a>.
621      </p>
622]]>
623      </DetailedDescription>
624   </FindingType>
625
626   <FindingType>
627      <Symbol>CS_SUPER_FINALIZE</Symbol>
628      <ShortDescription>SuperFinalize</ShortDescription>
629      <MessagePattern>Method 'finalize' should call 'super.finalize'\.</MessagePattern>
630      <DetailedDescription>
631<![CDATA[
632      <p class="body">
633      An overriding <span class="code">finalize()</span> method does not invoke <span class="code">super.finalize()</span>.
634      </p>
635      <p class="body">
636      Reference: <a href="http://java.sun.com/docs/books/tutorial/java/data/garbagecollection.html">Cleaning
637      Up Unused Objects</a>.
638      </p>
639]]>
640      </DetailedDescription>
641   </FindingType>
642
643   <FindingType>
644      <Symbol>CS_SUPER_CLONE</Symbol>
645      <ShortDescription>SuperClone</ShortDescription>
646      <MessagePattern>TODO</MessagePattern>
647      <DetailedDescription>
648<![CDATA[
649      <p class="body">
650      Checks that an overriding <span class="code">clone()</span> method invokes <span class="code">super.clone()</span>.
651      </p>
652      <p class="body">
653      Reference: <a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Object.html#clone()">Object.clone()</a>.
654      </p>
655]]>
656      </DetailedDescription>
657   </FindingType>
658
659   <FindingType>
660      <Symbol>CS_ILLEGAL_CATCH</Symbol>
661      <ShortDescription>IllegalCatch</ShortDescription>
662      <MessagePattern>Catching '.*' is not allowed\.</MessagePattern>
663      <DetailedDescription>
664<![CDATA[
665      <p class="body">
666      Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException
667      is almost never acceptable.
668      </p>
669      <p class="body">
670      Rationale: Junior developers often simply catch Exception in an
671      attempt to handle multiple exception classes. This unfortunately
672      leads to code that inadvertantly catchs NPE, OutOfMemoryErrors,
673      etc.
674      </p>
675           
676 <p>
677
678This is dangerous because if a java.lang.Error, for example OutOfMemmoryError,
679occurs then it will be caught. The container should handle java.lang.Error.
680If application code will catch them, try to log them (which will probably fail)
681and continue silently the situation will not be desirable.
682      <br></p>
683<pre>                
684SimpleDateFormat sdf = null;
685try {
686    sdf = new SimpleDateFormat("yyyy-MM-dd");
687} catch (Throwable th) {  //Should not catch throwable
688    th.printStackTrace();
689}
690</pre>     
691]]>
692      </DetailedDescription>
693   </FindingType>
694
695   <FindingType>
696      <Symbol>CS_PACKAGE_DECLARATION</Symbol>
697      <ShortDescription>PackageDeclaration</ShortDescription>
698      <MessagePattern>TODO</MessagePattern>
699      <DetailedDescription>
700<![CDATA[
701]]>
702      </DetailedDescription>
703   </FindingType>
704
705   <FindingType>
706      <Symbol>CS_J_UNIT_TEST_CASE_SETUP_PUBLIC</Symbol>
707      <ShortDescription>JUnitTestCaseSetupPublic</ShortDescription>
708      <MessagePattern>The method 'setUp' must be public or protected\.</MessagePattern>
709      <DetailedDescription>
710<![CDATA[
711<p>
712JUnit: The method setUp() must be either public or protected.
713</p>
714<p>
715Rationale: often times developers will misname one or more of these methods and not realise that the method is not being called.
716</p>
717]]>
718      </DetailedDescription>
719   </FindingType>
720
721   <FindingType>
722      <Symbol>CS_J_UNIT_TEST_CASE_SETUP_TYPO</Symbol>
723      <ShortDescription>JUnitTestCaseSetupTypo</ShortDescription>
724      <MessagePattern>The method '.*' should be named 'setUp'\.</MessagePattern>
725      <DetailedDescription>
726<![CDATA[
727<p>
728JUnit: The method must be named setUp(). Typo?
729</p>
730<p>
731Rationale: often times developers will misname one or more of these methods and not realise that the method is not being called.
732</p>
733]]>
734      </DetailedDescription>
735   </FindingType>
736
737   <FindingType>
738      <Symbol>CS_RETURN_COUNT</Symbol>
739      <ShortDescription>More than one return in method</ShortDescription>
740      <MessagePattern>Return count is .* \(max allowed is .*\)\.</MessagePattern>
741      <DetailedDescription>
742<![CDATA[
743      <p class="body">
744      Restrict the number of return statements. Default = 2.
745      </p>
746
747      <p class="body">
748      Rationale:
749      Too many return points can be indication that code is
750      attempting to do too much or may be difficult to understand.
751      </p>
752
753]]>
754      </DetailedDescription>
755   </FindingType>
756
757   <FindingType>
758      <Symbol>CS_ILLEGAL_TYPE</Symbol>
759      <ShortDescription>IllegalType</ShortDescription>
760      <MessagePattern>Declaring variables, return values or parameters of type '.*' is not allowed\.</MessagePattern>
761      <DetailedDescription>
762<![CDATA[
763    Avoid using implementation types (i.e., HashSet); use the interface (i.e, Set) instead
764    <br></p><pre>
765
766import java.util.*;
767public class Bar {
768
769 // should be "private List list"
770 private ArrayList list = new ArrayList();
771
772 // should be "public Set getFoo()"
773 public HashSet getFoo() {
774  return new HashSet();
775 }
776}
777</pre>
778
779      <p class="body">
780      Rationale:
781      Helps reduce coupling on concrete classes. In addition abstract
782      classes should be thought of a convenience base class implementations
783      of interfaces and as such are not types themsleves.
784      </p>
785     
786     
787
788]]>
789      </DetailedDescription>
790   </FindingType>
791
792   <FindingType>
793      <Symbol>CS_DECLARATION_ORDER</Symbol>
794      <ShortDescription>Declaration in wrong Order (public to private)</ShortDescription>
795      <MessagePattern>.* definition in wrong order\.</MessagePattern>
796      <DetailedDescription>
797<![CDATA[
798      <p class="body">
799      According to
800      <a
801      href="http://java.sun.com/docs/codeconv/html/CodeConventions.doc2.html#1852">
802      Code Conventions for the Java Programming Language</a>
803      , the parts of a class or interface declaration should appear in the
804      following order
805
806      <li> Class (static) variables. First the public class variables, then
807           the protected, then package level (no access modifier), and then
808           the private. </li>
809      <li> Instance variables. First the public class variables, then
810           the protected, then package level (no access modifier), and then
811           the private. </li>
812      <li> Constructors </li>
813      <li> Methods </li>
814      </p>
815
816]]>
817      </DetailedDescription>
818   </FindingType>
819
820   <FindingType>
821      <Symbol>CS_PARAMETER_ASSIGNMENT</Symbol>
822      <ShortDescription>Avoid Parameter Assignment</ShortDescription>
823      <MessagePattern>Assignment of parameter '.*' is not allowed\.</MessagePattern>
824      <DetailedDescription>
825<![CDATA[
826      <p class="body"> Disallow assignment of parameters.</p>
827      <p class="body">Rationale: Parameter assignment is often
828      considered poor programming practice. Forcing developers to
829      declare parameters as final is often onerous. Having a check
830      ensure that parameters are never assigned would give the best of
831      both worlds.</p>
832
833]]>
834      </DetailedDescription>
835   </FindingType>
836
837   <FindingType>
838      <Symbol>CS_EXPLICIT_INITIALIZATION</Symbol>
839      <ShortDescription>ExplicitInitialization</ShortDescription>
840      <MessagePattern>TODO</MessagePattern>
841      <DetailedDescription>
842<![CDATA[
843      <p class="body">Checks if any class or object member explicitly
844      initialized to default for its type value (<span
845      class="code">null</span> for object references, zero for numeric
846      types and <span class="code">char</span> and <span
847      class="code">false</span> for <span
848      class="code">booolean</span>.</p>
849      <p class="body">Rationale: each instance variable gets
850      initialized twice, to the same value.  Java
851      initializes each instance variable to its default
852      value (0 or null) before performing any
853      initialization specified in the code.  So in this case,
854      x gets initialized to 0 twice, and bar gets initialized
855      to null twice.  So there is a minor inefficiency.  This style of
856      coding is a hold-over from C/C++ style coding,
857      and it shows that the developer isn't really confident that
858      Java really initializes instance variables to default
859      values.</p>
860
861]]>
862      </DetailedDescription>
863   </FindingType>
864
865   <FindingType>
866      <Symbol>CS_VISIBILITY_MODIFIER</Symbol>
867      <ShortDescription>Fields must not be public</ShortDescription>
868      <MessagePattern>Variable '.*' must be private and have accessor methods\.</MessagePattern>
869      <DetailedDescription>
870<![CDATA[
871      <p class="body">
872      Checks visibility of class members. Only static final members
873      may be public; other class members must be private.
874      </p>
875
876      <p class="body">
877      Rationale: Enforce encapsulation.
878      </p>
879
880
881]]>
882      </DetailedDescription>
883   </FindingType>
884
885   <FindingType>
886      <Symbol>CS_FINAL_CLASS</Symbol>
887      <ShortDescription>Class should be final</ShortDescription>
888      <MessagePattern>Class .* should be declared as final\.</MessagePattern>
889      <DetailedDescription>
890<![CDATA[
891
892      <p class="body">
893      The class which has only private constructors should be declared as final.
894      </p>
895]]>
896      </DetailedDescription>
897   </FindingType>
898
899   <FindingType>
900      <Symbol>CS_INTERFACE_IS_TYPE</Symbol>
901      <ShortDescription>InterfaceIsType</ShortDescription>
902      <MessagePattern>TODO</MessagePattern>
903      <DetailedDescription>
904<![CDATA[
905      <p class="body">
906          Implements Bloch, Effective Java, Item 17 -
907      Use Interfaces only to define types.
908      </p>
909
910      <p class="body">
911      According to Bloch, an interface should describe a <em>type</em>.
912      It is therefore inappropriate to define an interface that does not
913      contain any methods but only constants. The Standard class
914      <a href="http://java.sun.com/j2se/1.4.1/docs/api/javax/swing/SwingConstants.html">javax.swing.SwingConstants</a>
915      is an example of a class that would be flagged by this check.
916      </p>
917
918      <p class="body">
919      The check can be configured to also disallow marker interfaces like
920      <code>java.io.Serializable</code>, that do not contain methods or
921      constants at all.
922      </p>
923
924]]>
925      </DetailedDescription>
926   </FindingType>
927
928   <FindingType>
929      <Symbol>CS_HIDE_UTILITY_CLASS_CONSTRUCTOR</Symbol>
930      <ShortDescription>Hide Utility Class Constructor</ShortDescription>
931      <MessagePattern>Utility classes should not have a public or default constructor\.</MessagePattern>
932      <DetailedDescription>
933<![CDATA[
934      <p class="body">
935      Make sure that utility classes (classes that contain only static methods)
936      do not have a public constructor.
937      </p>
938      <p class="body">
939      Rationale: Instantiating utility classes does not make sense.
940      Hence the constructors should either be private or (if you
941      want to allow subclassing) protected. A common mistake is forgetting
942      to hide the default constructor.
943      </p>
944      <p class="body">
945      If you make the constructor protected you may want to consider
946      the following constructor implementation technique to disallow
947      instantiating subclasses:
948      </p>
949      <pre class="body">
950public class StringUtils // not final to allow subclassing
951{
952    protected StringUtils() {
953        throw new UnsupportedOperationException(); // prevents calls from subclass
954    }
955
956    public static int count(char c, String s) {
957        // ...
958    }
959}
960      </pre>
961]]>
962      </DetailedDescription>
963   </FindingType>
964
965   <FindingType>
966      <Symbol>CS_DESIGN_FOR_EXTENSION</Symbol>
967      <ShortDescription>DesignForExtension</ShortDescription>
968      <MessagePattern>TODO</MessagePattern>
969      <DetailedDescription>
970<![CDATA[
971      <p class="body">
972      Checks that classes are designed for extension.
973      More specifically, it enforces a programming style
974      where superclasses provide empty "hooks" that can be
975      implemented by subclasses.
976      </p>
977
978      <p class="body">
979      The exact rule is that nonprivate, nonstatic methods of classes that
980      can be subclassed must either be
981      </p>
982      <ul class="body">
983      <li>abstract or</li>
984      <li>final or</li>
985      <li>have an empty implementation</li>
986      </ul>
987
988      <p class="body">
989      Rationale: This API design style protects superclasses against beeing broken by
990      subclasses. The downside is that subclasses are limited in their flexibility,
991      in particular they cannot prevent execution of code in the superclass, but that also
992      means that subclasses cannot corrupt the state of the superclass by forgetting to
993      call the super method.
994      </p>
995
996]]>
997      </DetailedDescription>
998   </FindingType>
999
1000   <FindingType>
1001      <Symbol>CS_MUTABLE_EXCEPTION</Symbol>
1002      <ShortDescription>MutableException</ShortDescription>
1003      <MessagePattern>TODO</MessagePattern>
1004      <DetailedDescription>
1005<![CDATA[
1006      <p class="body">
1007      Ensures that exceptions (defined as any class name conforming
1008      to some regular expression) are immutable. That is, have only
1009      final fields.
1010      </p>
1011
1012      <p class="body">
1013      The current algorithm is very simple it checks that all
1014      members of exception are final.  User can still mutates an
1015      exception's instance (e.g. Throwable has
1016      setStackTrace(StackTraceElement[] stackTrace) method which
1017      changes stack trace).  But, at least, all information provided
1018      by this exception type is unchangable.
1019      </p>
1020
1021      <p class="body">
1022      Rationale:
1023      Exception instances should represent an error
1024      condition. Having non final fields not only allows the
1025      state to be modified by accident and therefore mask the
1026      original condition but also allows developers to
1027      accidentally forget to initialise state thereby leading
1028      to code catching the exception to draw incorrect
1029      conclusions based on the state.
1030      </p>
1031
1032]]>
1033      </DetailedDescription>
1034   </FindingType>
1035
1036   <FindingType>
1037      <Symbol>CS_THROWS_COUNT</Symbol>
1038      <ShortDescription>ThrowsCount</ShortDescription>
1039      <MessagePattern>TODO</MessagePattern>
1040      <DetailedDescription>
1041<![CDATA[
1042      <p class="body">
1043      Restricts throws statements to a specified count (default = 1).
1044      </p>
1045
1046      <p class="body">
1047      Rationale:
1048      Exceptions form part of a methods interface. Declaring
1049      a method to throw too many differently rooted
1050      exceptions makes exception handling onerous and leads
1051      to poor programming practices such as catch
1052      (Exception). This check forces developers to put
1053      exceptions into a heirachy such that in the simplest
1054      case, only one type of exception need be checked for by
1055      a caller but allows any sub-classes to be caught
1056      specifically if necessary.
1057      </p>
1058
1059]]>
1060      </DetailedDescription>
1061   </FindingType>
1062
1063   <FindingType>
1064      <Symbol>CS_STRICT_DUPLICATE_CODE</Symbol>
1065      <ShortDescription>StrictDuplicateCode</ShortDescription>
1066      <MessagePattern>Found duplicate of .* lines in .*, starting from line .*</MessagePattern>
1067      <DetailedDescription>
1068<![CDATA[
1069      <p class="body">
1070      Performs a line-by-line comparison of all code lines and reports
1071      duplicate code, i.e. a sequence of lines that differ only in indentation.
1072      All import statements in Java code are ignored, any other line -
1073      including javadoc, whitespace lines between methods, etc. - is considered
1074      (which is why the check is called <em>strict</em>).
1075      </p>
1076
1077]]>
1078      </DetailedDescription>
1079   </FindingType>
1080
1081   <FindingType>
1082      <Symbol>CS_MISSING_HEADER</Symbol>
1083      <ShortDescription>Missing Copyright Header</ShortDescription>
1084      <MessagePattern>Missing a header - not enough lines in file\.</MessagePattern>
1085      <DetailedDescription>
1086<![CDATA[
1087   Please include the copyright header.
1088]]>
1089      </DetailedDescription>
1090   </FindingType>
1091
1092   <FindingType>
1093      <Symbol>CS_REGEXP_HEADER</Symbol>
1094      <ShortDescription>RegexpHeader</ShortDescription>
1095      <MessagePattern>Line does not match expected header line of '.*'\.</MessagePattern>
1096      <DetailedDescription>
1097<![CDATA[
1098      <p class="body">
1099      Checks the header of a source file against a header file that contains a <a href="http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html">regular
1100      expression</a> for each line of the source header.
1101      </p>
1102      <p class="body">
1103      Rationale: In some projects <a href="#Header">checking against a fixed header</a>
1104      is not sufficient, e.g. the header might require a copyright line where the year
1105      information is not static.
1106      </p>
1107      <p class="body">
1108      For example, consider the following header file:
1109      </p>
1110      <pre class="body">
1111line 1: /{71}
1112line 2: // checkstyle:
1113line 3: // Checks Java source code for adherence to a set of rules\.
1114line 4: // Copyright \(C\) \d\d\d\d  Oliver Burn
1115line 5: // Last modification by \$Author.*\$
1116line 6: /{71}
1117      </pre>
1118
1119      <p class="body">
1120      Lines 1 and 6 demonstrate a more compact notation for 71 '/' characters. Line 4
1121      enforces that the copyright notice includes a four digit year. Line 5 is an
1122      example how to enforce revision control keywords in a file header.
1123      </p>
1124]]>
1125      </DetailedDescription>
1126   </FindingType>
1127
1128   <FindingType>
1129      <Symbol>CS_AVOID_STAR_IMPORT</Symbol>
1130      <ShortDescription>Avoid import '*'</ShortDescription>
1131      <MessagePattern>Using the '\.\*' form of import should be avoided - .*\.</MessagePattern>
1132      <DetailedDescription>
1133<![CDATA[
1134       Using the '.*' form of import should be avoided.
1135]]>
1136      </DetailedDescription>
1137   </FindingType>
1138
1139   <FindingType>
1140      <Symbol>CS_ILLEGAL_IMPORT</Symbol>
1141      <ShortDescription>IllegalImport</ShortDescription>
1142      <MessagePattern>Import from illegal package - .*\.</MessagePattern>
1143      <DetailedDescription>
1144<![CDATA[
1145This package is not a public API. Do not used such classes.
1146]]>
1147      </DetailedDescription>
1148   </FindingType>
1149
1150   <FindingType>
1151      <Symbol>CS_DUPLICATE_IMPORT</Symbol>
1152      <ShortDescription>DuplicateImport</ShortDescription>
1153      <MessagePattern>Duplicate import .*</MessagePattern>
1154      <DetailedDescription>
1155<![CDATA[
1156      <p class="body">
1157      It is a duplicate of another import. This is, when a class
1158      is imported more than once.
1159      </p>
1160]]>
1161      </DetailedDescription>
1162   </FindingType>
1163
1164   <FindingType>
1165      <Symbol>CS_REDUNDANT_IMPORT</Symbol>
1166      <ShortDescription>Redundant Import</ShortDescription>
1167      <MessagePattern>Redundant import from the .* - .*\.</MessagePattern>
1168      <DetailedDescription>
1169<![CDATA[
1170      <p class="body">
1171      Checks for redundant import statements. An import statement is considered
1172      redundant if:
1173      </p>
1174      <ul class="body">
1175        <li>
1176          It is a duplicate of another import. This is, when a class is imported more than
1177          once.
1178        </li>
1179        <li>
1180          The class imported is from the <span class="code">java.lang</span> package, e.g.
1181          importing <span class="code">java.lang.String</span>.
1182        </li>
1183        <li>
1184          The class imported is from the same package.
1185        </li>
1186      </ul>
1187]]>
1188      </DetailedDescription>
1189   </FindingType>
1190
1191   <FindingType>
1192      <Symbol>CS_UNUSED_IMPORTS</Symbol>
1193      <ShortDescription>UnusedImports</ShortDescription>
1194      <MessagePattern>TODO</MessagePattern>
1195      <DetailedDescription>
1196<![CDATA[
1197      <p class="body">
1198      Checks for unused import statements. Checkstyle uses a simple but very reliable
1199      algorithm to report on unused import statements. An import statement is
1200      considered unused if:
1201      </p>
1202
1203      <ul  class="body">
1204        <li>
1205          It is not referenced in the file. The algorithm does not support wild-card
1206          imports like <span class="code">import java.io.*;</span>. Most IDE's provide
1207          very sophisticated checks for imports that handle wild-card imports.
1208        </li>
1209
1210        <li>
1211          It is a duplicate of another import. This is when a class is imported more than
1212          once.
1213        </li>
1214
1215        <li>
1216          The class imported is from the <span class="code">java.lang</span> package. For
1217          example importing <span class="code">java.lang.String</span>.
1218        </li>
1219
1220        <li>
1221          The class imported is from the same package.
1222        </li>
1223      </ul>
1224]]>
1225      </DetailedDescription>
1226   </FindingType>
1227
1228   <FindingType>
1229      <Symbol>CS_IMPORT_ORDER</Symbol>
1230      <ShortDescription>ImportOrder</ShortDescription>
1231      <MessagePattern>TODO</MessagePattern>
1232      <DetailedDescription>
1233<![CDATA[
1234      <p class="body">Checks the ordering/grouping of imports.
1235      Ensures that groups of imports come in a specific order (e.g.,
1236      java. comes first, javax. comes first, then everything else) and
1237      imports within each group are in lexicographic order.
1238      </p>
1239
1240]]>
1241      </DetailedDescription>
1242   </FindingType>
1243
1244   <FindingType>
1245      <Symbol>CS_ENTITY_BEAN</Symbol>
1246      <ShortDescription>EntityBean</ShortDescription>
1247      <MessagePattern>TODO</MessagePattern>
1248      <DetailedDescription>
1249<![CDATA[
1250      <p class="body">
1251      Checks that a direct entity bean, i.e. a class that directly implements
1252      <span class="code">javax.ejb.EntityBean</span>, satisfies these class requirements:
1253      </p>
1254      <ul>
1255        <li class="body">
1256          The class is defined as <span class="code">public</span>.
1257        </li>
1258        <li class="body">
1259          The class cannot be defined as <span class="code">final</span>.
1260        </li>
1261        <li class="body">
1262          It contains a <span class="code">public</span> constructor with no parameters.
1263        </li>
1264        <li class="body">
1265          It must not define the <span class="code">finalize</span> method.
1266        </li>
1267      </ul>
1268      <p class="body">
1269      Checks that methods of a direct entity bean satisfy these requirements:
1270      </p>
1271      <ul>
1272        <li class="body">
1273          All <span class="code">ejbCreate&lt;METHOD&gt;(...)</span> methods are
1274          <span class="code">public</span>, not <span class="code">final</span>, and not
1275          <span class="code">static</span>.
1276        </li>
1277        <li class="body">
1278          The return type of all <span class="code">ejbCreate&lt;METHOD&gt;(...)</span>
1279          methods is not <span class="code">void</span>, because the return type must be
1280          the entity bean's primary key type.
1281        </li>
1282        <li class="body">
1283          All <span class="code">ejbPostCreate&lt;METHOD&gt;(...)</span> methods are
1284          <span class="code">public</span>, not <span class="code">final</span>, and not
1285          <span class="code">static</span>.
1286        </li>
1287        <li class="body">
1288          The return type of all <span class="code">ejbPostCreate&lt;METHOD&gt;(...)</span>
1289          methods is <span class="code">void</span>.
1290        </li>
1291        <li class="body">
1292          For each <span class="code">ejbCreate&lt;METHOD&gt;(...)</span> method there is
1293          a matching <span class="code">ejbPostCreate&lt;METHOD&gt;(...)</span> method.
1294        </li>
1295        </li>
1296        <li class="body">
1297          All <span class="code">ejbHome&lt;METHOD&gt;(...)</span> methods are
1298          <span class="code">public</span>, and not <span class="code">static</span>.
1299        </li>
1300        <li class="body">
1301          The throws clause of all <span class="code">ejbHome&lt;METHOD&gt;(...)</span>
1302          methods does not define the <span class="code">java.rmi.RemoteException</span>.
1303        </li>
1304      </ul>
1305
1306      <p class="body">
1307      When the check is configured to check direct entity beans as having bean-managed
1308      persistence, checks that methods satisfy these additional requirements:
1309      </p>
1310      <ul>
1311        <li class="body">
1312          All <span class="code">ejbFind&lt;METHOD&gt;(...)</span> methods are
1313          <span class="code">public</span>, not <span class="code">final</span>, and not
1314          <span class="code">static</span>.
1315        </li>
1316        <li class="body">
1317          The return type of all <span class="code">ejbFind&lt;METHOD&gt;(...)</span>
1318          methods is not <span class="code">void</span>, because the return type must be
1319          the entity bean's primary key type, or a collection of primary keys.
1320        </li>
1321        <li class="body">
1322          There is a <span class="code">ejbFindByPrimaryKey</span> method with one parameter.
1323        </li>
1324      </ul>
1325      <p class="body">
1326      When the check is configured to check direct entity beans as having container-managed
1327      persistence, checks that methods satisfy these additional requirements:
1328      </p>
1329      <ul>
1330        <li class="body">
1331          The throws clause of all <span class="code">ejbCreate&lt;METHOD&gt;(...)</span>
1332          methods defines the <span class="code">javax.ejb.CreateException</span>.
1333        </li>
1334        <li class="body">
1335          All <span class="code">ejbSelect&lt;METHOD&gt;(...)</span> methods are
1336          <span class="code">public</span> and <span class="code">abstract</span>.
1337        </li>
1338        <li class="body">
1339          The throws clause of all <span class="code">ejbSelect&lt;METHOD&gt;(...)</span>
1340          methods defines the <span class="code">javax.ejb.FinderException</span>.
1341        </li>
1342      </ul>
1343
1344
1345]]>
1346      </DetailedDescription>
1347   </FindingType>
1348
1349   <FindingType>
1350      <Symbol>CS_FINAL_STATIC</Symbol>
1351      <ShortDescription>FinalStatic</ShortDescription>
1352      <MessagePattern>TODO</MessagePattern>
1353      <DetailedDescription>
1354<![CDATA[
1355      <p class="body">
1356      Checks that all static fields are declared final.
1357      </p>
1358      <p class="body">
1359      Rational: This check ensures consistent runtime semantics so that EJB containers have
1360      the flexibility to distribute instances across multiple JVMs.
1361      </p>
1362       <p class="body">
1363       Reference: <a href="http://www.javaworld.com/javaworld/jw-08-2000/jw-0825-ejbrestrict.html">Programming restrictions on EJB</a>.
1364     </p>
1365]]>
1366      </DetailedDescription>
1367   </FindingType>
1368
1369   <FindingType>
1370      <Symbol>CS_LOCAL_HOME_INTERFACE</Symbol>
1371      <ShortDescription>LocalHomeInterface</ShortDescription>
1372      <MessagePattern>TODO</MessagePattern>
1373      <DetailedDescription>
1374<![CDATA[
1375      <p class="body">
1376      Checks that a direct local home interface, i.e. an interface that directly extends
1377      <span class="code">javax.ejb.EJBLocalHome</span>, satisfies these requirements:
1378      </p>
1379      <ul>
1380        <li class="body">
1381          The return type of all <span class="code">create&lt;METHOD&gt;(...)</span>
1382          methods is not <span class="code">void</span>, because the return type must be
1383          the bean's local interface.
1384        </li>
1385        <li class="body">
1386          The throws clause of all <span class="code">create&lt;METHOD&gt;(...)</span>
1387          methods defines the <span class="code">javax.ejb.CreateException</span>.
1388        </li>
1389      <li class="body">The throws clause of all methods does not define the <span class="code">java.rmi.RemoteException</span>.</li>
1390      </ul>
1391 <p class="body">
1392 Reference: Enterprise JavaBeansTM Specification,Version 2.0, sections 6.4 and 9.6.
1393 </p>
1394]]>
1395      </DetailedDescription>
1396   </FindingType>
1397
1398   <FindingType>
1399      <Symbol>CS_LOCAL_INTERFACE</Symbol>
1400      <ShortDescription>LocalInterface</ShortDescription>
1401      <MessagePattern>TODO</MessagePattern>
1402      <DetailedDescription>
1403<![CDATA[
1404      <p class="body">
1405      Checks that a direct local interface, i.e. an interface that directly extends
1406      <span class="code">javax.ejb.EJBLocalObject</span>, satisfies these requirements:
1407      </p>
1408      <ul>
1409      <li class="body">The throws clause of all methods does not define the <span class="code">java.rmi.RemoteException</span>.</li>
1410      </ul>
1411 <p class="body">
1412 Reference: Enterprise JavaBeansTM Specification,Version 2.0, section 9.10.
1413 </p>
1414]]>
1415      </DetailedDescription>
1416   </FindingType>
1417
1418   <FindingType>
1419      <Symbol>CS_MESSAGE_BEAN</Symbol>
1420      <ShortDescription>MessageBean</ShortDescription>
1421      <MessagePattern>TODO</MessagePattern>
1422      <DetailedDescription>
1423<![CDATA[
1424      <p class="body">
1425      Checks that a direct message bean, i.e. a class that directly implements
1426      <span class="code">javax.ejb.MessageDrivenBean</span> and
1427      <span class="code">javax.jms.MessageListener</span>, satisfies these class requirements:
1428      </p>
1429      <ul>
1430        <li class="body">
1431          The class is defined as <span class="code">public</span>.
1432        </li>
1433        <li class="body">
1434          The class cannot be defined as <span class="code">final</span>.
1435        </li>
1436        <li class="body">
1437          The class cannot be defined as <span class="code">abstract</span>.
1438        </li>
1439        <li class="body">
1440          It contains a <span class="code">public</span> constructor with no parameters.
1441        </li>
1442        <li class="body">
1443          It must not define the <span class="code">finalize</span> method.
1444        </li>
1445        <li class="body">
1446          It defines an <span class="code">ejbCreate()</span> method this is
1447          <span class="code">public</span>, not <span class="code">final</span>,
1448          not <span class="code">static</span>, has no parameters, and has
1449          return type <span class="code">void</span>.
1450        </li>
1451      </ul>
1452
1453      <p class="body">
1454      Reference: Enterprise JavaBeans&trade; Specification,Version 2.0, section 15.7.
1455      </p>
1456]]>
1457      </DetailedDescription>
1458   </FindingType>
1459
1460   <FindingType>
1461      <Symbol>CS_REMOTE_HOME_INTERFACE</Symbol>
1462      <ShortDescription>RemoteHomeInterface</ShortDescription>
1463      <MessagePattern>TODO</MessagePattern>
1464      <DetailedDescription>
1465<![CDATA[
1466      <p class="body">
1467      Checks that a direct remote home interface, i.e. an interface that directly extends
1468      <span class="code">javax.ejb.EJBHome</span>, satisfies these requirements:
1469      </p>
1470      <ul>
1471        <li class="body">
1472          The return type of all <span class="code">create&lt;METHOD&gt;(...)</span>
1473          methods is not <span class="code">void</span>, because the return type must be
1474          the bean's remote interface.
1475        </li>
1476        <li class="body">
1477          The throws clause of all <span class="code">create&lt;METHOD&gt;(...)</span>
1478          methods defines the <span class="code">javax.ejb.CreateException</span>.
1479        </li>
1480      <li class="body">The throws clause of all methods defines the <span class="code">java.rmi.RemoteException</span>.</li>
1481      </ul>
1482 <p class="body">
1483 Reference: Enterprise JavaBeansTM Specification,Version 2.0, sections 6.3 and 9.5.
1484 </p>
1485]]>
1486      </DetailedDescription>
1487   </FindingType>
1488
1489   <FindingType>
1490      <Symbol>CS_REMOTE_INTERFACE</Symbol>
1491      <ShortDescription>RemoteInterface</ShortDescription>
1492      <MessagePattern>TODO</MessagePattern>
1493      <DetailedDescription>
1494<![CDATA[
1495      <p class="body">
1496      Checks that a direct remote interface, i.e. an interface that directly extends
1497      <span class="code">javax.ejb.EJBObject</span>, satisfies these requirements:
1498      </p>
1499      <ul>
1500      <li class="body">The throws clause of all methods defines the <span class="code">java.rmi.RemoteException</span>.</li>
1501      </ul>
1502 <p class="body">
1503 Reference: Enterprise JavaBeansTM Specification,Version 2.0, section 9.9.
1504 </p>
1505]]>
1506      </DetailedDescription>
1507   </FindingType>
1508
1509   <FindingType>
1510      <Symbol>CS_SESSION_BEAN</Symbol>
1511      <ShortDescription>SessionBean</ShortDescription>
1512      <MessagePattern>TODO</MessagePattern>
1513      <DetailedDescription>
1514<![CDATA[
1515      <p class="body">
1516      Checks that a direct session bean, i.e. a class that directly implements
1517      <span class="code">javax.ejb.SessionBean</span>, satisfies these class requirements:
1518      </p>
1519      <ul>
1520        <li class="body">
1521          The class is defined as <span class="code">public</span>.
1522        </li>
1523        <li class="body">
1524          The class cannot be defined as <span class="code">final</span>.
1525        </li>
1526        <li class="body">
1527          The class cannot be defined as <span class="code">abstract</span>.
1528        </li>
1529        <li class="body">
1530          It contains a <span class="code">public</span> constructor with no parameters.
1531        </li>
1532        <li class="body">
1533          It must not define the <span class="code">finalize</span> method.
1534        </li>
1535        <li class="body">
1536          It defines an <span class="code">ejbCreate&lt;METHOD&gt;()</span> method this is
1537          <span class="code">public</span>, not <span class="code">final</span>,
1538          not <span class="code">static</span>, and has
1539          return type <span class="code">void</span>.
1540        </li>
1541      </ul>
1542
1543      <p class="body">
1544      Reference: Enterprise JavaBeans&trade; Specification,Version 2.0, section 7.10.
1545      </p>
1546]]>
1547      </DetailedDescription>
1548   </FindingType>
1549
1550   <FindingType>
1551      <Symbol>CS_THIS_PARAMETER</Symbol>
1552      <ShortDescription>ThisParameter</ShortDescription>
1553      <MessagePattern>TODO</MessagePattern>
1554      <DetailedDescription>
1555<![CDATA[
1556      <p class="body">
1557      Checks that <span class="code">this</span> is not a parameter of any method calls or constructors for a bean.
1558      Instead, you must use the result of the <span class="code">getEJBObject()</span> available in
1559      <span class="code">SessionContext</span> or <span class="code">EntityContext</span>.
1560      </p>
1561       <p class="body">
1562       Reference: <a href="http://www.javaworld.com/javaworld/jw-08-2000/jw-0825-ejbrestrict.html">Programming restrictions on EJB</a>.
1563     </p>
1564]]>
1565      </DetailedDescription>
1566   </FindingType>
1567
1568   <FindingType>
1569      <Symbol>CS_THIS_RETURN</Symbol>
1570      <ShortDescription>ThisReturn</ShortDescription>
1571      <MessagePattern>TODO</MessagePattern>
1572      <DetailedDescription>
1573<![CDATA[
1574      <p class="body">
1575      Checks that <span class="code">this</span> is not returned by a bean method.
1576      Instead, you must use the result of the <span class="code">getEJBObject()</span> available in
1577      <span class="code">SessionContext</span> or <span class="code">EntityContext</span>.
1578      </p>
1579       <p class="body">
1580       Reference: <a href="http://www.javaworld.com/javaworld/jw-08-2000/jw-0825-ejbrestrict.html">Programming restrictions on EJB</a>.
1581     </p>
1582]]>
1583      </DetailedDescription>
1584   </FindingType>
1585
1586   <FindingType>
1587      <Symbol>CS_PACKAGE_HTML</Symbol>
1588      <ShortDescription>PackageHtml</ShortDescription>
1589      <MessagePattern>TODO</MessagePattern>
1590      <DetailedDescription>
1591<![CDATA[
1592        <p class="body">
1593        Checks that a <span class="code">package.html</span> file exists for each
1594        package. More specifically, checks that each java file has a package.html sibling.
1595        </p>
1596
1597      <h4 class="body">Properties</h4>
1598      <table width="100%" border="1" cellpadding="5" class="body">
1599        <tr class="header">
1600          <th>name</th>
1601          <th>description</th>
1602          <th>type</th>
1603          <th>default value</th>
1604        </tr>
1605        <tr>
1606          <td>fileExtensions</td>
1607          <td>file type extension to identify java files. Setting this property is
1608              typically only required if your java source files are preprocessed
1609              and the original files do not have the extension
1610              <span class="code">.java</span></td>
1611          <td><a href="property_types.html#stringSet">String Set</a></td>
1612          <td><span class="default">java</span></td>
1613        </tr>
1614      </table>
1615
1616]]>
1617      </DetailedDescription>
1618   </FindingType>
1619
1620   <FindingType>
1621      <Symbol>CS_JAVADOC_OVERVIEW</Symbol>
1622      <ShortDescription>Javadoc 1st sentence.</ShortDescription>
1623      <MessagePattern>First sentence should end with a period\.</MessagePattern>
1624      <DetailedDescription>
1625<![CDATA[
1626        <p>
1627        Javadoc automatically places the first sentence in the method summary
1628        table and index. With out proper punctuation the Javadoc may be
1629        malformed.
1630        </p>
1631]]>
1632      </DetailedDescription>
1633   </FindingType>
1634
1635   <FindingType>
1636      <Symbol>CS_JAVADOC_TYPE</Symbol>
1637      <ShortDescription>JavadocType</ShortDescription>
1638      <MessagePattern>TODO</MessagePattern>
1639      <DetailedDescription>
1640<![CDATA[
1641        <p class="body">
1642        Checks Javadoc comments for class and interface definitions.
1643        </p>
1644
1645]]>
1646      </DetailedDescription>
1647   </FindingType>
1648
1649   <FindingType>
1650      <Symbol>CS_JAVADOC_METHOD</Symbol>
1651      <ShortDescription>JavadocMethod</ShortDescription>
1652      <MessagePattern>TODO</MessagePattern>
1653      <DetailedDescription>
1654<![CDATA[
1655        <p class="body">
1656        Checks to ensure that the following tags exist (if required):
1657        </p>
1658        <ul class="body">
1659          <li>
1660            <span class="code">@return</span>
1661          </li>
1662          <li>
1663            <span class="code">@param</span>
1664          </li>
1665          <li>
1666            <span class="code">@throws</span> or <span class="code">@exception</span>
1667          </li>
1668          <li>
1669            <span class="code">@see</span> or <span class="code">{@inheritDoc}</span>
1670          </li>
1671        </ul>
1672
1673        <p class="body">
1674        For example, the following is valid:
1675        </p>
1676        <a name="checkReturnTag"></a>
1677        <pre class="body">
1678    /**
1679     * Checks for a return tag.
1680     * @return the index of the next unchecked tag
1681     * @param aTagIndex the index to start in the tags
1682     * @param aTags the tags to check
1683     * @param aLineNo the line number of the expected tag
1684     **/
1685    public int checkReturnTag(final int aTagIndex,
1686                              JavadocTag[] aTags,
1687                              int aLineNo)
1688        </pre>
1689
1690        <p class="body">
1691        This supports the convention in the <a href="http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#throwstag">Sun
1692        Javadoc Guidelines</a> and the "Effective Java" book.
1693        </p>
1694
1695]]>
1696      </DetailedDescription>
1697   </FindingType>
1698
1699   <FindingType>
1700      <Symbol>CS_MISSING_JAVADOC</Symbol>
1701      <ShortDescription>JavadocMissing</ShortDescription>
1702      <MessagePattern>Missing a Javadoc comment\.</MessagePattern>
1703      <DetailedDescription>Missing a Javadoc comment.</DetailedDescription>
1704   </FindingType>
1705
1706   <FindingType>
1707      <Symbol>CS_UNCLOSED_HTML_TAG</Symbol>
1708      <ShortDescription>UnclosedHtmlTag</ShortDescription>
1709      <MessagePattern>Unclosed HTML tag found: .*</MessagePattern>
1710      <DetailedDescription>Missing HTML closing tag in Javadoc comment.</DetailedDescription>
1711   </FindingType>
1712
1713   <FindingType>
1714      <Symbol>CS_EXTRA_HTML_TAG</Symbol>
1715      <ShortDescription>ExtraHtmlTag</ShortDescription>
1716      <MessagePattern>Extra HTML tag found: .*</MessagePattern>
1717      <DetailedDescription>The specified HTML tag is not valid here.</DetailedDescription>
1718   </FindingType>
1719
1720   <FindingType>
1721      <Symbol>CS_JAVADOC_STYLE</Symbol>
1722      <ShortDescription>JavadocStyle</ShortDescription>
1723      <MessagePattern>TODO</MessagePattern>
1724      <DetailedDescription>
1725<![CDATA[
1726        <h2>JavadocStyle</h2>
1727]]>
1728      </DetailedDescription>
1729   </FindingType>
1730
1731   <FindingType>
1732      <Symbol>CS_CYCLOMATIC_COMPLEXITY</Symbol>
1733      <ShortDescription>Cyclomatic Complexity</ShortDescription>
1734      <MessagePattern>Cyclomatic Complexity is .* \(max allowed is .*\)\.</MessagePattern>
1735      <DetailedDescription>
1736<![CDATA[
1737The complexity is measured by the number of if, while, do, for, ?:, catch,
1738switch, case statements, and operators &amp;&amp; and || (plus one) in the body of a
1739constructor, method, static initializer, or instance initializer. It is a
1740measure of the minimum number of possible paths through the source and
1741therefore the number of required tests. Generally 1-4 is considered good, 5-7
1742ok, 8-10 consider re-factoring, and 11+ re-factor now!
1743]]>
1744      </DetailedDescription>
1745   </FindingType>
1746
1747   <FindingType>
1748      <Symbol>CS_GENERIC_ILLEGAL_REGEXP</Symbol>
1749      <ShortDescription>GenericIllegalRegexp</ShortDescription>
1750      <MessagePattern>TODO</MessagePattern>
1751      <DetailedDescription>
1752<![CDATA[
1753      <p class="body">
1754      A generic check for code problems - the user can search for any pattern. This is
1755      similar to a recursive grep, only that it's integrated in checkstyle.
1756      </p>
1757      <p class="body">
1758      Rationale: This check can be used to prototype checks and to find common bad
1759      practice such as calling <span class="code">ex.printStacktrace()</span>, <span class="code">
1760      System.out.println()</span>, <span class="code">System.exit()</span>, etc.
1761      </p>
1762]]>
1763      </DetailedDescription>
1764   </FindingType>
1765
1766   <FindingType>
1767      <Symbol>CS_NEWLINE_AT_END_OF_FILE</Symbol>
1768      <ShortDescription>NewlineAtEndOfFile</ShortDescription>
1769      <MessagePattern>TODO</MessagePattern>
1770      <DetailedDescription>
1771<![CDATA[
1772      <p class="body">
1773      Checks whether files end with a new line.
1774      </p>
1775      <p class="body">
1776      Rationale: Any source files and text files in general should end with a newline
1777      character, especially when using SCM systems such as CVS. CVS will even
1778      print a warning when it encounters a file that doesn't end with a newline.
1779      </p>
1780]]>
1781      </DetailedDescription>
1782   </FindingType>
1783
1784   <FindingType>
1785      <Symbol>CS_TODO_COMMENT</Symbol>
1786      <ShortDescription>TodoComment</ShortDescription>
1787      <MessagePattern>TODO</MessagePattern>
1788      <DetailedDescription>
1789<![CDATA[
1790      <p class="body">
1791      A check for <span class="code">TODO:</span> comments. Actually it is a generic <a href="http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html">regular
1792      expression</a> matcher on Java comments. To check for other patterns in Java
1793      comments, set property format.
1794      </p>
1795]]>
1796      </DetailedDescription>
1797   </FindingType>
1798
1799   <FindingType>
1800      <Symbol>CS_TRANSLATION</Symbol>
1801      <ShortDescription>Translation</ShortDescription>
1802      <MessagePattern>TODO</MessagePattern>
1803      <DetailedDescription>
1804<![CDATA[
1805      <p class="body">
1806      A <a href="config.html#overview">FileSetCheck</a> that ensures the correct
1807      translation of code by checking property files for consistency regarding their
1808      keys. Two property files describing one and the same context are consistent if
1809      they contain the same keys.
1810      </p>
1811      <p class="body">
1812      Consider the following properties file in the same directory:
1813      </p>
1814      <pre>
1815      #messages.properties
1816      hello=Hello
1817      cancel=Cancel
1818
1819      #messages_de.properties
1820      hell=Hallo
1821      ok=OK
1822      </pre>
1823      <p class="body">
1824      The Translation check will find the typo in the german hello key, the
1825      missing ok key in the default resource file and the missing cancel key
1826      in the german resource file:
1827      </p>
1828      <pre>
1829      messages_de.properties: Key 'hello' missing.
1830      messages_de.properties: Key 'cancel' missing.
1831      messages.properties: Key 'hell' missing.
1832      messages.properties: Key 'ok' missing.
1833      </pre>
1834]]>
1835      </DetailedDescription>
1836   </FindingType>
1837
1838   <FindingType>
1839      <Symbol>CS_UNCOMMENTED_MAIN</Symbol>
1840      <ShortDescription>UncommentedMain</ShortDescription>
1841      <MessagePattern>TODO</MessagePattern>
1842      <DetailedDescription>
1843<![CDATA[
1844      <p class="body">
1845      Checks for uncommented main() methods (debugging leftovers).
1846      </p>
1847      <p class="body"> Rationale: main() method can be often used for
1848      debug puposes.  Thus most of main() method should be
1849      removed/commented out of the sources.
1850      </p>
1851]]>
1852      </DetailedDescription>
1853   </FindingType>
1854
1855   <FindingType>
1856      <Symbol>CS_UPPER_ELL</Symbol>
1857      <ShortDescription>UpperEll</ShortDescription>
1858      <MessagePattern>TODO</MessagePattern>
1859      <DetailedDescription>
1860<![CDATA[
1861      <p class="body">
1862      Checks that long constants are defined with an upper ell. That is <span class="code">'
1863      L'</span> and
1864not <span class="code">'l'</span>. This is in accordance to the Java Language
1865Specification, <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">
1866Section
1867      3.10.1</a>.
1868</p>
1869<p class="body"> Rationale: The letter <span class="code">l</span> looks a lot
1870like <span class="code">1</span>.
1871      </p>
1872]]>
1873      </DetailedDescription>
1874   </FindingType>
1875
1876   <FindingType>
1877      <Symbol>CS_ARRAY_TYPE_STYLE</Symbol>
1878      <ShortDescription>ArrayTypeStyle</ShortDescription>
1879      <MessagePattern>Array brackets at illegal position\.</MessagePattern>
1880      <DetailedDescription>
1881<![CDATA[
1882      <p class="body">
1883      Use Java-style: <code>public static void main(String[] args)</code>
1884      instead of C-style: public static void main(String args[])
1885      </p>
1886
1887]]>
1888      </DetailedDescription>
1889   </FindingType>
1890
1891   <FindingType>
1892      <Symbol>CS_FINAL_PARAMETERS</Symbol>
1893      <ShortDescription>FinalParameters</ShortDescription>
1894      <MessagePattern>TODO</MessagePattern>
1895      <DetailedDescription>
1896<![CDATA[
1897      <p class="body">
1898      Check that method/constructor parameters are final. Interface methods are not checked -
1899      the final keyword does not make sense for interface method parameters as there is no code
1900      that could modify the parameter.
1901      </p>
1902      <p class="body">
1903      Rationale: Changing the value of parameters during the execution of the
1904      method's algorithm can be confusing and should be avoided. A great way to
1905      let the Java compiler prevent this coding style is to declare parameters
1906      final.
1907      </p>
1908
1909]]>
1910      </DetailedDescription>
1911   </FindingType>
1912
1913   <FindingType>
1914      <Symbol>CS_DESCENDANT_TOKEN</Symbol>
1915      <ShortDescription>DescendantToken</ShortDescription>
1916      <MessagePattern>TODO</MessagePattern>
1917      <DetailedDescription>
1918<![CDATA[
1919      <p class="body">
1920      Checks for restricted tokens beneath other tokens.
1921      </p>
1922      <p class="body">
1923      WARNING: This is a very powerful and flexible check, but, at the
1924      same time, it is low level and very implementation dependent
1925      because its results depend on the grammar we use to build abstract
1926      syntax trees. Thus we recomend using other checks when
1927      they provide the desired funcionality. All in all, this check just
1928      works on the level of an abstract tree and knows nothing about language
1929      structures.
1930      </p>
1931
1932]]>
1933      </DetailedDescription>
1934   </FindingType>
1935
1936   <FindingType>
1937      <Symbol>CS_INDENTATION</Symbol>
1938      <ShortDescription>Wrong indentation</ShortDescription>
1939      <MessagePattern>.* at indentation level [0-9]* not at correct indentation, .*</MessagePattern>
1940      <DetailedDescription>
1941<![CDATA[
1942      <p>Indention of line is wrong.</p>
1943]]>
1944      </DetailedDescription>
1945   </FindingType>
1946
1947   <FindingType>
1948      <Symbol>CS_MODIFIER_ORDER</Symbol>
1949      <ShortDescription>Wrong order of Modifier</ShortDescription>
1950      <MessagePattern>'.*' modifier out of order with the JLS suggestions\.</MessagePattern>
1951      <DetailedDescription>
1952<![CDATA[
1953      <p>
1954      Checks that the order of modifiers conforms to the suggestions in the <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html">Java
1955      Language specification, sections 8.1.1, 8.3.1 and 8.4.3</a>. The correct order
1956      is:
1957      </p>
1958
1959      <ol class="body">
1960
1961        <li>
1962          <span class="code">public</span>
1963        </li>
1964        <li>
1965          <span class="code">protected</span>
1966        </li>
1967        <li>
1968          <span class="code">private</span>
1969
1970        </li>
1971        <li>
1972          <span class="code">abstract</span>
1973        </li>
1974        <li>
1975          <span class="code">static</span>
1976        </li>
1977        <li>
1978
1979          <span class="code">final</span>
1980        </li>
1981        <li>
1982          <span class="code">transient</span>
1983        </li>
1984        <li>
1985          <span class="code">volatile</span>
1986
1987        </li>
1988        <li>
1989          <span class="code">synchronized</span>
1990        </li>
1991        <li>
1992          <span class="code">native</span>
1993        </li>
1994        <li>
1995
1996          <span class="code">strictfp</span>
1997        </li>
1998      </ol>
1999      ]]>
2000      </DetailedDescription>
2001   </FindingType>
2002
2003   <FindingType>
2004      <Symbol>CS_REDUNDANT_MODIFIER</Symbol>
2005      <ShortDescription>RedundantModifier</ShortDescription>
2006      <MessagePattern>TODO</MessagePattern>
2007      <DetailedDescription>
2008<![CDATA[
2009
2010      <p class="body">
2011      Checks that
2012      <ul class="body">
2013        <li>method declarations in interfaces include neither the <span class="code">
2014      public</span> modifier nor the <span class="code">abstract</span> modifier (see
2015      the <a
2016href="http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html">Java
2017Language specification, section 9.4</a>).
2018      </li>
2019      <li>all <span class="code">private</span> method declarations and all method declarations in a
2020        <span class="code">final</span> class do not include modifier
2021        <span class="code">final</span> (see the <a
2022href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#11246">Java
2023Language specification, section 8.4.3.3</a>).</li>
2024      <li>
2025      variable declarations in interfaces include none of the following
2026      modifiers: <span class="code">public</span>, <span class="code">static</span>,
2027      <span class="code">final</span> (variables in interface definitions are constants
2028      and have these modifiers implicitly, see the <a
2029href="http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html">Java
2030Language specification, section 9.3</a>).
2031      </li>
2032      </ul>
2033
2034]]>
2035      </DetailedDescription>
2036   </FindingType>
2037
2038   <FindingType>
2039      <Symbol>CS_EXECUTABLE_STATEMENT_COUNT</Symbol>
2040      <ShortDescription>ExecutableStatementCount</ShortDescription>
2041      <MessagePattern>TODO</MessagePattern>
2042      <DetailedDescription>
2043<![CDATA[
2044]]>
2045      </DetailedDescription>
2046   </FindingType>
2047
2048   <FindingType>
2049      <Symbol>CS_FILE_LENGTH</Symbol>
2050      <ShortDescription>FileLength</ShortDescription>
2051      <MessagePattern>File length is .* lines \(max allowed is .*\)\.</MessagePattern>
2052      <DetailedDescription>
2053<![CDATA[
2054      <p class="body">
2055      Checks for long source files.
2056      </p>
2057      <p class="body">
2058      Rationale: If a source file becomes very long it is hard to understand.
2059      Therefore long classes should usually be refactored into several individual
2060      classes that focus on a specific task.
2061      </p>
2062
2063]]>
2064      </DetailedDescription>
2065   </FindingType>
2066
2067   <FindingType>
2068      <Symbol>CS_LINE_LENGTH</Symbol>
2069      <ShortDescription>LineLength</ShortDescription>
2070      <MessagePattern>Line is longer than [0-9]+ characters\.</MessagePattern>
2071      <DetailedDescription>
2072<![CDATA[
2073      <p class="body">
2074      Checks for long lines.
2075      </p>
2076      <p class="body">
2077      Rationale: Long lines are hard to read in printouts or if developers have
2078      limited screen space for the source code, e.g. if the IDE displays additional
2079      information like project tree, class hierarchy, etc.
2080      </p>
2081
2082]]>
2083      </DetailedDescription>
2084   </FindingType>
2085
2086   <FindingType>
2087      <Symbol>CS_METHOD_LENGTH</Symbol>
2088      <ShortDescription>MethodLength</ShortDescription>
2089      <MessagePattern>TODO</MessagePattern>
2090      <DetailedDescription>
2091<![CDATA[
2092      <p class="body">
2093      Checks for long methods and constructors.
2094      </p>
2095      <p class="body">
2096      Rationale: If a method becomes very long it is hard to understand. Therefore
2097      long methods should usually be refactored into several individual methods that
2098      focus on a specific task.
2099      </p>
2100
2101]]>
2102      </DetailedDescription>
2103   </FindingType>
2104
2105   <FindingType>
2106      <Symbol>CS_ANON_INNER_LENGTH</Symbol>
2107      <ShortDescription>AnonInnerLength</ShortDescription>
2108      <MessagePattern>Anonymous inner class length is .* lines (max allowed is .*)\.</MessagePattern>
2109      <DetailedDescription>
2110<![CDATA[
2111      <p class="body">
2112      Rationale: If an anonymous inner class becomes very long
2113      it is hard to understand and to see the flow of the method
2114      where the class is defined. Therefore long anonymous inner
2115      classes should usually be refactored into a named inner class.
2116      See also Bloch, Effective Java, p. 93.
2117      </p>
2118]]>
2119      </DetailedDescription>
2120   </FindingType>
2121
2122   <FindingType>
2123      <Symbol>CS_PARAMETER_NUMBER</Symbol>
2124      <ShortDescription>ParameterNumber</ShortDescription>
2125      <MessagePattern>TODO</MessagePattern>
2126      <DetailedDescription>
2127<![CDATA[
2128      <p class="body">
2129      Checks the number of parameters of a method or constructor.
2130      </p>
2131
2132]]>
2133      </DetailedDescription>
2134   </FindingType>
2135
2136   <FindingType>
2137      <Symbol>CS_ONE_METHOD_PRIVATE_FIELD</Symbol>
2138      <ShortDescription>OneMethodPrivateField</ShortDescription>
2139      <MessagePattern>TODO</MessagePattern>
2140      <DetailedDescription>
2141<![CDATA[
2142
2143      <p class="body">
2144      Checks that a private field is used in more than one method, constructor, or initializer.
2145      </p>
2146      <p class="body">
2147      Rationale: a private field used in only one method, constructor, or
2148      initializer should be replaced by a local variable.
2149      </p>
2150]]>
2151      </DetailedDescription>
2152   </FindingType>
2153
2154   <FindingType>
2155      <Symbol>CS_UNUSED_LOCAL_VARIABLE</Symbol>
2156      <ShortDescription>Unused Local Variable</ShortDescription>
2157      <MessagePattern>Unread local variable '.*'\.</MessagePattern>
2158      <DetailedDescription>
2159<![CDATA[
2160
2161      <p class="body">
2162      Checks that a local variable is used after its declaration.
2163      </p>
2164      </p>
2165]]>
2166      </DetailedDescription>
2167   </FindingType>
2168
2169   <FindingType>
2170      <Symbol>CS_UNUSED_PARAMETER</Symbol>
2171      <ShortDescription>UnusedParameter</ShortDescription>
2172      <MessagePattern>TODO</MessagePattern>
2173      <DetailedDescription>
2174<![CDATA[
2175
2176      <p class="body">
2177      Checks that a parameter is used.
2178      </p>
2179      </p>
2180]]>
2181      </DetailedDescription>
2182   </FindingType>
2183
2184   <FindingType>
2185      <Symbol>CS_UNUSED_PRIVATE_FIELD</Symbol>
2186      <ShortDescription>Unused Private Field</ShortDescription>
2187      <MessagePattern>Unused field '.*'\.</MessagePattern>
2188      <DetailedDescription>
2189<![CDATA[
2190The private field (member variable) is never read/used in this class.
2191<pre>
2192public class Foo
2193{
2194   private int mNeverUsed = 1;
2195   
2196   public void foo ()
2197   { 
2198   }
2199}
2200</pre>
2201
2202]]>
2203      </DetailedDescription>
2204   </FindingType>
2205
2206   <FindingType>
2207      <Symbol>CS_UNUSED_PRIVATE_METHOD</Symbol>
2208      <ShortDescription>Unused Private Method</ShortDescription>
2209      <MessagePattern>Unused method '.*'\.</MessagePattern>
2210      <DetailedDescription>
2211<![CDATA[
2212
2213      <p class="body">
2214      The private method is never used. Remove it?
2215      </p>
2216]]>
2217      </DetailedDescription>
2218   </FindingType>
2219
2220   <FindingType>
2221      <Symbol>CS_EMPTY_FOR_ITERATOR_PAD</Symbol>
2222      <ShortDescription>EmptyForIteratorPad</ShortDescription>
2223      <MessagePattern>TODO</MessagePattern>
2224      <DetailedDescription>
2225<![CDATA[
2226
2227      <p class="body">
2228      Checks the padding of an empty for iterator; that is whether white
2229      space is required at an empty for iterator, or such white space is
2230     forbidden.
2231     No check occurs if there is a line wrap at the iterator, as in
2232      </p>
2233      <pre class="body">
2234for (Iterator foo = very.long.line.iterator();
2235      foo.hasNext();
2236     )     
2237      </pre>
2238]]>
2239      </DetailedDescription>
2240   </FindingType>
2241
2242   <FindingType>
2243      <Symbol>CS_NO_WHITESPACE_AFTER</Symbol>
2244      <ShortDescription>NoWhitespaceAfter</ShortDescription>
2245      <MessagePattern>TODO</MessagePattern>
2246      <DetailedDescription>
2247<![CDATA[
2248]]>
2249      </DetailedDescription>
2250   </FindingType>
2251
2252   <FindingType>
2253      <Symbol>CS_NO_WHITESPACE_BEFORE</Symbol>
2254      <ShortDescription>No Whitespace Before</ShortDescription>
2255      <MessagePattern>.* is preceded with whitespace\.</MessagePattern>
2256      <DetailedDescription>
2257<![CDATA[
2258
2259      <p class="body">
2260      Checks that there is no whitespace before a token. More specifically, it checks
2261      that it is not preceded with whitespace, or (if linebreaks are allowed) all
2262      characters on the line before are whitespace. To allow linebreaks before a token,
2263      set property <span class="code">allowLineBreaks</span> to <span class="code">
2264      true</span>.
2265      </p>
2266]]>
2267      </DetailedDescription>
2268   </FindingType>
2269
2270   <FindingType>
2271      <Symbol>CS_OPERATOR_WRAP</Symbol>
2272      <ShortDescription>OperatorWrap</ShortDescription>
2273      <MessagePattern>TODO</MessagePattern>
2274      <DetailedDescription>
2275<![CDATA[
2276
2277      <p class="body">
2278      Checks the policy on how to wrap lines on operators.
2279      </p>
2280]]>
2281      </DetailedDescription>
2282   </FindingType>
2283
2284   <FindingType>
2285      <Symbol>CS_PAREN_PAD</Symbol>
2286      <ShortDescription>ParenPad</ShortDescription>
2287      <MessagePattern>TODO</MessagePattern>
2288      <DetailedDescription>
2289<![CDATA[
2290
2291      <p class="body">
2292      Checks the policy on the padding of parentheses; i.e. whether a space is
2293      required after a left parenthesis and before a right parenthesis, or such spaces
2294      are forbidden.
2295      </p>
2296]]>
2297      </DetailedDescription>
2298   </FindingType>
2299
2300   <FindingType>
2301      <Symbol>CS_TYPECAST_PAREN_PAD</Symbol>
2302      <ShortDescription>TypecastParenPad</ShortDescription>
2303      <MessagePattern>TODO</MessagePattern>
2304      <DetailedDescription>
2305<![CDATA[
2306      <h2>TypecastParenPad</h2>
2307
2308]]>
2309      </DetailedDescription>
2310   </FindingType>
2311
2312   <FindingType>
2313      <Symbol>CS_TAB_CHARACTER</Symbol>
2314      <ShortDescription>TabCharacter</ShortDescription>
2315      <MessagePattern>TODO</MessagePattern>
2316      <DetailedDescription>
2317<![CDATA[
2318
2319      <p class="body">
2320      Checks that there are no tab characters (<span class="code">'\t'</span>) in the
2321      source code.
2322      </p>
2323      <p class="body">
2324      Rationale:
2325      </p>
2326      <ul class="body">
2327        <li>
2328          Developers should not need to configure the tab width of their text editors in
2329          order to be able to read source code.
2330        </li>
2331        <li>
2332          From the Apache jakarta coding standards: In a distributed development
2333          environment, when the cvs commit messages get sent to a mailing list, they are
2334          almost impossible to read if you use tabs.
2335        </li>
2336      </ul>
2337
2338]]>
2339      </DetailedDescription>
2340   </FindingType>
2341
2342   <FindingType>
2343      <Symbol>CS_WHITESPACE_AFTER</Symbol>
2344      <ShortDescription>WhitespaceAfter</ShortDescription>
2345      <MessagePattern>TODO</MessagePattern>
2346      <DetailedDescription>
2347<![CDATA[
2348
2349      <p class="body">
2350      Checks that a token is followed by whitespace.
2351      </p>
2352]]>
2353      </DetailedDescription>
2354   </FindingType>
2355
2356   <FindingType>
2357      <Symbol>CS_WHITESPACE_AROUND</Symbol>
2358      <ShortDescription>WhitespaceAround</ShortDescription>
2359      <MessagePattern>TODO</MessagePattern>
2360      <DetailedDescription>
2361<![CDATA[
2362
2363      <p class="body">
2364      Checks that a token is surrounded by whitespace.
2365      </p>
2366]]>
2367      </DetailedDescription>
2368   </FindingType>
2369
2370   <FindingType>
2371      <Symbol>CS_MISSING_WHITESPACE_BEFORE</Symbol>
2372      <ShortDescription>Missing Whitespace Before</ShortDescription>
2373      <MessagePattern>'.*' is not preceded with whitespace\.</MessagePattern>
2374      <DetailedDescription>
2375<![CDATA[
2376      <p>This token must be preceded with a whitespace.</p>
2377]]>
2378      </DetailedDescription>
2379   </FindingType>
2380
2381
2382   <FindingType>
2383      <Symbol>CS_NO_WHITESPACE_AFTER_MSG_DECL</Symbol>
2384      <ShortDescription>Missing whitespace.</ShortDescription>
2385      <MessagePattern>No whitespace \( \(\) after method declaration\.</MessagePattern>
2386      <DetailedDescription>After the method declaration there should be a single ' '.</DetailedDescription>
2387   </FindingType>
2388
2389   <FindingType>
2390      <Symbol>CS_JAVADOC_UNUSED_TAG</Symbol>
2391      <ShortDescription>Unused Javadoc tag.</ShortDescription>
2392      <MessagePattern>Unused .* tag.*\.</MessagePattern>
2393      <DetailedDescription>Unused Javadoc tag.</DetailedDescription>
2394   </FindingType>
2395
2396   <FindingType>
2397      <Symbol>CS_NO_LOG_LEVEL_INFO</Symbol>
2398      <ShortDescription>Trace log with invalid log level.</ShortDescription>
2399      <MessagePattern>
2400         Maximum allowed log level for trace log is .* but was .*\.
2401      </MessagePattern>
2402      <DetailedDescription>For trace logs there is a maximum log level. If the
2403         message requires a log level as found, a predefined log message must
2404         be used.
2405      </DetailedDescription>
2406   </FindingType>
2407
2408
2409</CheckstyleMessages>
Note: See TracBrowser for help on using the browser.