Project Report: fawkez

Packagesummary org.jcoderz.phoenix.report

org.jcoderz.phoenix.report.CheckstyleFindingType

LineHitsNoteSource
1  /*
2   * $Id: CheckstyleFindingType.java 1173 2008-09-22 10:04:44Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33  package org.jcoderz.phoenix.report;
34  
35  import java.util.ArrayList;
36  import java.util.List;
37  
38  import javax.xml.bind.JAXBContext;
39  import javax.xml.bind.Unmarshaller;
40  
41  import org.jcoderz.phoenix.checkstyle.message.jaxb.CheckstyleMessages;
42  import org.jcoderz.phoenix.checkstyle.message.jaxb.FindingData;
43  
44  /**
45   * Enumeration type for checkstyle findings.
46   * It also holds a method to get the finding type from the message
47   * received. This is needed due to the fact that there is no reliable
48   * enumeration of checkstyle findings delivered with checkstyle.
49   * <p>New patterns might be needed with each checkstyle update.</p>
50   * <p>Once assigned the symbols should not be changed without a urgent
51   * need. The symbols are used to generate wiki page link.</p>
52   *
53   * @author Andreas Mandel
54   */
55  public final class CheckstyleFindingType
56        extends FindingType
57  {
58     private static final List<CheckstyleFindingType> CHECKSTYLE_FINDING_TYPES;
59  
60     private static final String CHECKSTYLE_MESSAGE_JAXB_CONTEXT
61        = "org.jcoderz.phoenix.checkstyle.message.jaxb";
62  
63     private static final String CHECKSTYLE_MESSAGE_FILE
64        = "org/jcoderz/phoenix/checkstyle/checkstyle-messages.xml";
65  
66     private final String mMessagePattern;
67     private final Severity mSeverity;
68  
69     static
70     {
710       CHECKSTYLE_FINDING_TYPES = new ArrayList<CheckstyleFindingType>();
72     }
73  
74     /**
75      * Checkstyle finding type that relates to:
76      * <i>Interfaces should describe a type and hence have methods</i>.
77      */
780    public static final CheckstyleFindingType CS_INTERFACE_TYPE =
79        new CheckstyleFindingType("CS_INTERFACE_TYPE", "Interface type.",
80           "Interfaces should describe a type and hence have methods.",
81           "interfaces should describe a type and hence have methods.",
82           Severity.DESIGN);
83  
84     /**
85      * Checkstyle finding type that relates to:
86      * <i>Line is longer than the allowed number of characters</i>.
87      */
880    public static final CheckstyleFindingType CS_LINE_TO_LONG =
89        new CheckstyleFindingType("CS_LINE_TO_LONG", "Line too long.",
90           "Line is longer than the allowed number of characters.",
91           "Line is longer than [0-9]+ characters.");
92  
93     /**
94      * Checkstyle finding type that relates to:
95      * <i>Line does not match expected header line</i>.
96      */
970    public static final CheckstyleFindingType CS_HEADER_MISMATCH =
98        new CheckstyleFindingType("CS_HEADER_MISMATCH", "Header does not match.",
99           "Line does not match expected header line. "
100           + "Please use the global header.",
101           "Line does not match expected header line of .*\\.");
102  
103     /**
104      * Checkstyle finding type that relates to:
105      * <i>Missing a Javadoc comment</i>.
106      */
1070    public static final CheckstyleFindingType CS_JAVADOC_MISSING =
108        new CheckstyleFindingType("CS_JAVADOC_MISSING",
109           "Missing a Javadoc comment.",
110           "Missing a Javadoc comment.",
111           "Missing a Javadoc comment\\.");
112  
113     /**
114      * Checkstyle finding type that relates to:
115      * <i>Missing a Javadoc comment</i>.
116      */
1170    public static final CheckstyleFindingType CS_JAVADOC_EMPTY_DESC =
118        new CheckstyleFindingType("CS_JAVADOC_EMPTY_DESC",
119           "Javadoc has empty description section.",
120           "Javadoc has empty description section.",
121           "Javadoc has empty description section\\.");
122  
123     /**
124      * Checkstyle finding type that relates to:
125      * <i>Unused Javadoc tag</i>.
126      */
1270    public static final CheckstyleFindingType CS_JAVADOC_UNUSED_TAG =
128        new CheckstyleFindingType("CS_JAVADOC_UNUSED_TAG",
129           "Unused Javadoc tag.",
130           "Unused Javadoc tag.",
131           "Unused .* tag for '.*'\\.");
132  
133     /**
134      * Checkstyle finding type that relates to:
135      * <i>Expected an @return tag</i>.
136      */
1370    public static final CheckstyleFindingType CS_JAVADOC_RETURN_EXPECTED =
138        new CheckstyleFindingType("CS_JAVADOC_RETURN_EXPECTED",
139           "Expected an @return tag.",
140           "Expected an @return tag.",
141           "Expected an @return tag.");
142  
143     /**
144      * Checkstyle finding type that relates to:
145      * <i>Missing Javadoc tag</i>.
146      */
1470    public static final CheckstyleFindingType CS_JAVADOC_EXPECTED_TAG =
148        new CheckstyleFindingType("CS_JAVADOC_EXPECTED_TAG",
149           "Missing Javadoc tag.",
150           "Missing Javadoc tag.",
151           "Expected .* tag for '.*'\\.");
152  
153     /**
154      * Checkstyle finding type that relates to:
155      * <i>Unable to get class information for something</i>.
156      */
1570    public static final CheckstyleFindingType CS_JAVADOC_CLASS_INFO =
158        new CheckstyleFindingType("CS_JAVADOC_CLASS_INFO",
159           "Unable to get class information for something.",
160           "Unable to get class information for something.",
161           "Unable to get class information for .* tag '.*'\\.");
162  
163     /**
164      * Checkstyle finding type that relates to:
165      * <i>Incomplete/Unclosed HTML tag</i>.
166      */
1670    public static final CheckstyleFindingType CS_JAVADOC_HTML_UNCLOSED =
168        new CheckstyleFindingType("CS_JAVADOC_HTML_UNCLOSED",
169           "Incomplete HTML tag.",
170           "Incomplete/Unclosed HTML tag.",
171           "Incomplete HTML tag found: .*");
172  
173     /**
174      * Checkstyle finding type that relates to:
175      * <i>Name does not match given pattern</i>.
176 (1)    */
1770    public static final CheckstyleFindingType CS_INVALID_PATTERN =
178        new CheckstyleFindingType("CS_INVALID_PATTERN",
179           "Name does not match given pattern.",
180           "Name does not match given pattern.",
181           "Name '.*' must match pattern '.*'\\.");
182  
183     /**
184      * Checkstyle finding type that relates to:
185      * <i>After the method declaration there should be a ' '</i>.
186      */
1870    public static final CheckstyleFindingType CS_NO_WHITESPACE_AFTER_MSG_DECL =
188        new CheckstyleFindingType("CS_NO_WHITESPACE_AFTER_MSG_DECL",
189           "Missing whitespace.",
190           "After the method declaration there should be a ' '.",
191           "No whitespace \\( \\(\\) after method declaration\\.");
192  
193     /**
194      * Checkstyle finding type that relates to:
195      * <i>Comment matches to-do format</i>.
196      */
1970    public static final CheckstyleFindingType CS_TODO =
198        new CheckstyleFindingType("CS_TODO",
199           "Comment matches to-do format.",
200           "Comment matches to-do format.",
201           "Comment matches to-do format '.*'\\.",
202           Severity.INFO);
203  
204     /**
205      * Checkstyle finding type that relates to:
206      * <i>Dont use magics in the code</i>.
207      */
2080    public static final CheckstyleFindingType CS_MAGIC =
209        new CheckstyleFindingType("CS_MAGIC",
210           "Dont use magics in the code.",
211           "Magics make the code hard to maintain and understand. "
212           + " Define appropriate constant instead.",
213           "Dont use magic .* in the code\\.");
214  
215     /**
216      * Checkstyle finding type that relates to:
217      * <i>Whitespace not allowed</i>.
218      */
2190    public static final CheckstyleFindingType CS_WHITESPACE_AFTER =
220        new CheckstyleFindingType("CS_WHITESPACE_AFTER",
221           "Whitespace not allowed.",
222           "Whitespace not allowed.",
223           "'.*' is followed by whitespace\\.");
224  
225     /**
226      * Checkstyle finding type that relates to:
227      * <i>Whitespace expected</i>.
228      */
2290    public static final CheckstyleFindingType CS_NO_WHITESPACE_AFTER =
230        new CheckstyleFindingType("CS_NO_WHITESPACE_AFTER",
231           "Whitespace expected.",
232           "Whitespace expected.",
233           "'.*' is not followed by whitespace\\.");
234  
235     /**
236      * Checkstyle finding type that relates to:
237      * <i>Whitespace not allowed</i>.
238      */
2390    public static final CheckstyleFindingType CS_WHITESPACE_BEFORE =
240        new CheckstyleFindingType("CS_WHITESPACE_BEFORE",
241           "Whitespace not allowed.",
242           "Whitespace not allowed.",
243           "'.*' is preceeded with whitespace\\.");
244  
245     /**
246      * Checkstyle finding type that relates to:
247      * <i>Whitespace expected</i>.
248      */
2490    public static final CheckstyleFindingType CS_NO_WHITESPACE_BEFORE =
250        new CheckstyleFindingType("CS_NO_WHITESPACE_AFTER",
251           "Whitespace expected.",
252           "Whitespace expected.",
253           "'.*' is not preceeded with whitespace\\.");
254  
255     /**
256      * Checkstyle finding type that relates to:
257      * <i>A required javadoc tag is missing</i>.
258      */
2590    public static final CheckstyleFindingType CS_MISSING_TAG =
260        new CheckstyleFindingType("CS_MISSING_TAG",
261           "A required javadoc tag is missing.",
262           "A required javadoc tag is missing.",
263           "Type Javadoc comment is missing an .* tag\\.");
264  
265     /**
266      * Checkstyle finding type that relates to:
267      * <i>A field is hidden</i>.
268      */
2690    public static final CheckstyleFindingType CS_HIDDEN_FIELD =
270        new CheckstyleFindingType("CS_HIDDEN_FIELD",
271           "A field is hidden.",
272           "A field is hidden.",
273           "'.*' hides a field\\.", Severity.DESIGN);
274  
275     /**
276      * Checkstyle finding type that relates to:
277      * <i>Line contains a tab character</i>.
278      */
2790    public static final CheckstyleFindingType CS_CONTAINS_TAB =
280        new CheckstyleFindingType("CS_CONTAINS_TAB",
281           "Line contains a tab character.",
282           "Line contains a tab character. You should use spaces for "
283           + "indentation.",
284           "Line contains a tab character\\.");
285  
286     /**
287      * Checkstyle finding type that relates to:
288      * <i>File does not end with a newline</i>.
289      */
2900    public static final CheckstyleFindingType CS_NO_NEWLINE =
291        new CheckstyleFindingType("CS_NO_NEWLINE",
292           "File does not end with a newline.",
293           "File does not end with a newline.",
294           "File does not end with a newline\\.");
295  
296     /**
297      * Checkstyle finding type that relates to:
298      * <i>Method length exceeds the maximum allowed length</i>.
299      */
3000    public static final CheckstyleFindingType CS_MAX_LEN_METHOD =
301        new CheckstyleFindingType("CS_MAX_LEN_METHOD",
302           "Method length exceeds the maximum allowed length.",
303           "A Method should have a moderate length...",
304           "Method length is [\\.,0-9]+ lines \\(max allowed is [\\.,0-9]+\\)\\.",
305           Severity.DESIGN);
306  
307     /**
308      * Checkstyle finding type that relates to:
309      * <i>Length of anonymous inner class exceeds the maximum allowed length</i>.
310      */
3110    public static final CheckstyleFindingType CS_MAX_LEN_ANON_CLASS =
312        new CheckstyleFindingType("CS_MAX_LEN_ANON_CLASS",
313           "Length of anonymous inner class exceeds the maximum allowed length.",
314           "A anonymous inner class should have a moderate length...",
315           "Anonymous inner class length is [0-9]+ lines "
316           + "\\(max allowed is [0-9]+\\)\\.",
317           Severity.DESIGN);
318  
319     /**
320      * Checkstyle finding type that relates to:
321      * <i>Empty block detected</i>.
322      */
3230    public static final CheckstyleFindingType CS_EMPTY_BLOCK =
324        new CheckstyleFindingType("CS_EMPTY_BLOCK",
325           "Empty block detected.",
326           "If you think this is ok you must at least put a comment inside "
327           + "this block, describing why it is ok.",
328           "Empty .* block\\.");
329  
330     /**
331      * Checkstyle finding type that relates to:
332      * <i>Unused import</i>.
333      */
3340    public static final CheckstyleFindingType CS_IMPORT_UNUSED =
335        new CheckstyleFindingType("CS_IMPORT_UNUSED",
336           "Unused import.",
337           "Unused import.",
338           "Unused import - .*\\.");
339  
340     /**
341      * Checkstyle finding type that relates to:
342      * <i>Indentation violation</i>.
343      */
3440    public static final CheckstyleFindingType CS_SPECIAL_INDENT =
345        new CheckstyleFindingType("CS_SPECIAL_INDENT",
346           "Indentation violation.",
347           "Several keywords require a special indentation.",
348           "Expected indentation for '.*' is '.*' but was at '.*'\\.");
349  
350     /**
351      * Checkstyle finding type that relates to:
352      * <i>Deeply nested tries</i>.
353      */
3540    public static final CheckstyleFindingType CS_NESTED_TRY_DEPTH =
355        new CheckstyleFindingType("CS_NESTED_TRY_DEPTH",
356           "Deeply nested tries.",
357           "The nesting level for the try/catches is to deep.",
358           "Nested try depth is [0-9]+ \\(max allowed is [0-9]+\\)\\.",
359           Severity.DESIGN);
360  
361     /**
362      * Checkstyle finding type that relates to:
363      * <i>Too many parameters</i>.
364      */
3650    public static final CheckstyleFindingType CS_NUMBER_OF_PARAMETERS =
366        new CheckstyleFindingType("CS_NUMBER_OF_PARAMETERS",
367           "Too many parameters.",
368           "Too many parameters.",
369           "More than [0-9]+ parameters\\.",
370           Severity.DESIGN);
371  
372     /**
373      * Checkstyle finding type that relates to:
374      * <i>Method unused</i>.
375      */
3760    public static final CheckstyleFindingType CS_METHOD_UNUSED =
377        new CheckstyleFindingType("CS_METHOD_UNUSED",
378           "Method unused.",
379           "Method is never used.",
380           "Unused private method '.*'\\.");
381  
382     /**
383      * Checkstyle finding type that relates to:
384      * <i>Local variable unused</i>.
385      */
3860    public static final CheckstyleFindingType CS_LOCAL_VARIABLE_UNUSED =
387        new CheckstyleFindingType("CS_LOCAL_VARIABLE_UNUSED",
388           "Local variable unused.",
389           "Local variable is never used.",
390           "Unused local variable '.*'\\.");
391  
392     /**
393      * Checkstyle finding type that relates to:
394      * <i>Indentation must be a multiple of 4</i>.
395      */
3960    public static final CheckstyleFindingType CS_ILLEGAL_INDENTATION =
397        new CheckstyleFindingType("CS_ILLEGAL_INDENTATION",
398           "Indentation must be a multiple of 4.",
399           "Indentation must be a multiple of 4.",
400           "Indentation must be a multiple of 4\\.");
401  
402     /**
403      * Checkstyle finding type that relates to:
404      * <i>Field is never used</i>.
405      */
4060   public static final CheckstyleFindingType CS_FIELD_UNUSED =
407        new CheckstyleFindingType("CS_FIELD_UNUSED",
408           "Field unused.",
409           "Field is never used.",
410           "Unused private field '.*'\\.");
411  
412    /**
413     * Checkstyle finding type that relates to:
414     * <i>The equals operator should be on a new line</i>.
415     */
4160    public static final CheckstyleFindingType CS_EQUALS_NEWLINE =
417        new CheckstyleFindingType("CS_EQUALS_NEWLINE",
418           "The equals operator should be on a new line.",
419           "The equals operator should be on a new line.",
420           "The equals operator should be on a new line\\.");
421  
422     /**
423      * Checkstyle finding type that relates to:
424      * <i>Line matches a illegal pattern</i>.
425      */
4260    public static final CheckstyleFindingType CS_ILLEGAL_LINE =
427        new CheckstyleFindingType("CS_ILLEGAL_PATTERN",
428           "Line matches a illegal pattern.",
429           "Line matches a illegal pattern.",
430           "Line matches the illegal pattern '.*'\\.");
431  
432     /**
433      * Checkstyle finding type that relates to:
434      * <i>Long constants should use a uppercase L</i>.
435      */
4360    public static final CheckstyleFindingType CS_UPPER_CASE_L =
437        new CheckstyleFindingType("CS_UPPER_CASE_L", "Use uppercase L.",
438           "Long constants should use a uppercase L the lower case L looks "
439              + "a lot like 1. 123L vs. 123l.",
440           "Should use uppercase 'L'\\.");
441  
442     /**
443      * Checkstyle finding type that relates to:
444      * <i>Invalid log level for trace log</i>.
445      */
4460    public static final CheckstyleFindingType CS_NO_LOG_LEVEL_INFO =
447        new CheckstyleFindingType("CS_NO_LOG_LEVEL_INFO",
448           "Invalid log level for trace log.",
449           "Trace log messages should have log level smaller than info, for "
450              + "higher severity use predefined log messages.",
451           "Maximum allowed log level for trace log is '.*' but was '.*'\\.",
452           Severity.DESIGN);
453  
454     /**
455      * Checkstyle finding type that relates to:
456      * <i>The brace should not be on a new line</i>.
457      */
4580    public static final CheckstyleFindingType CS_BRACE_ON_NEW_LINE =
459         new CheckstyleFindingType("CS_BRACE_ON_NEW_LINE",
460            "The brace should not be on a new line.",
461            "The brace should not be on a new line.",
462            "'[\\{\\}\\(\\)]' should be on the (previous|same) line\\.");
463  
464     /**
465      * Checkstyle finding type that relates to:
466      * <i>Avoid inline conditionals</i>.
467      */
4680    public static final CheckstyleFindingType CS_INLINE_CONDITIONAL =
469         new CheckstyleFindingType("CS_INLINE_CONDITIONAL",
470            "Avoid inline conditionals.",
471            "Avoid inline conditionals.",
472            "Avoid inline conditionals\\.");
473  
474     /**
475      * Checkstyle finding type that relates to:
476      * <i>Avoid redundant code</i>.
477      */
4780   public static final CheckstyleFindingType CS_REDUNDANT_MODIFIER =
479         new CheckstyleFindingType("CS_REDUNDANT_MODIFIER",
480            "Avoid redundant code.",
481            "Avoid redundant code.",
482            "Redundant '.*' modifier\\.");
483  
484    /**
485     * Checkstyle finding type that relates to:
486     * <i>Javadoc Pattern</i>.
487     */
4880   public static final CheckstyleFindingType CS_JAVADOC_PATTERN =
489        new CheckstyleFindingType("CS_JAVADOC_PATTERN",
490           "Javadoc pattern violation.",
491           "The javadoc tag does not comply to the required pattern.",
492           "Type Javadoc tag .* must match pattern '.*'\\.");
493  
494    /**
495     * Checkstyle finding type that relates to:
496     * <i>Redundant throws with subclass.</i>.
497     */
4980   public static final CheckstyleFindingType CS_REDUNDANT_THROWS_SUBCLASS =
499        new CheckstyleFindingType("CS_REDUNDANT_THROWS_SUBCLASS",
500           "Redundant throws declaration of a subclass.",
501           "The throws statement already contains the superclass and so"
502           + "declaring a subclass is redundant.",
503           "Redundant throws: '.*' is subclass of '.*'\\.");
504  
505    /**
506     * Checkstyle finding type that relates to:
507     * <i>Redundant throws with unchecked exception.</i>.
508     */
5090   public static final CheckstyleFindingType CS_REDUNDANT_THROWS_UNCHECKED =
510        new CheckstyleFindingType("CS_REDUNDANT_THROWS_UNCHECKED",
511           "Throws declaration of a unchecked exception is not needed.",
512           "Throws declaration of a unchecked exception is not needed.",
513           "Redundant throws: '.*' is unchecked exception\\.");
514  
515    /**
516     * Checkstyle finding type that relates to:
517     * <i>Boolean expression complexity is ... (max allowed is ...).</i>.
518     */
5190   public static final CheckstyleFindingType CS_BOOLEAN_EXPRESSION_COMPLEXITY =
520        new CheckstyleFindingType("CS_BOOLEAN_EXPRESSION_COMPLEXITY",
521            "Boolean expression is too complex.",
522            "Boolean expression is too complex. "
523            + "Too many conditions leads to code that is difficult to "
524            + "read and hence debug and maintain.",
525            "Boolean expression complexity is .* \\(max allowed is .*\\)\\.");
526  
527    /**
528     * Checkstyle finding type that relates to:
529     * <i>String comparison with ==.</i>.
530     */
5310   public static final CheckstyleFindingType CS_STRING_EQUALS_COMPARISON =
532        new CheckstyleFindingType("CS_STRING_EQUALS_COMPARISON",
533            "String comparison with ==.",
534            "String comparison with ==.",
535            "Literal Strings should be compared using equals\\(\\), not '=='\\.");
536  
537    /**
538     * Checkstyle finding type that relates to:
539     * <i>Missing package documentation file.</i>.
540     */
5410   public static final CheckstyleFindingType CS_MISSING_PACKAGE_DOCUMENTATION =
542        new CheckstyleFindingType("CS_MISSING_PACKAGE_DOCUMENTATION",
543            "Missing package documentation file.",
544            "Package content should be documentet using a package.html or"
545            + " package.xml file.",
546            "Missing package documentation file\\.");
547  
548    /**
549     * Checkstyle finding type that relates to:
550     * <i>Unable to get class information for .....</i>.
551     */
5520   public static final CheckstyleFindingType CS_EXCEPTION_CLASS_NOT_FOUND =
553        new CheckstyleFindingType("CS_EXCEPTION_CLASS_NOT_FOUND",
554            "Unable to get class information for certain class.",
555            "Mostly this is caused by a checkstyle internal issue or a finder"
556            + "class path setting.",
557            "Unable to get class information for .*\\.");
558  
559    /**
560     * Checkstyle finding type that relates to:
561     * <i>Using '.*' is not allowed.</i>.
562     */
5630   public static final CheckstyleFindingType CS_TYPE_NOT_ALLOWED =
564        new CheckstyleFindingType("CS_TYPE_NOT_ALLOWED",
565            "Use of a type that is not permited.",
566            "The type noted in the message should not be used.",
567            "Using '.*' is not allowed\\.");
568  
569    /**
570     * A internal checkstyle exception was triggered we shoulds also
571     * report this!
572     */
5730   public static final CheckstyleFindingType CS_EXCEPTION =
574        new CheckstyleFindingType("CS_EXCEPTION",
575           "Checkstyle analysis exception.",
576           "Exception during checkstyle analysis. There seems to be "
577           + "something strange here. One often problem is a reference to a "
578           + "Unknown or not visible class in Javadoc.",
579           "Got an exception - .*\\.");
580  
581     private CheckstyleFindingType (String symbol, String shortText,
582           String description, String messagePattern, Severity severity)
583     {
5840       super(symbol, shortText, description);
5850       mMessagePattern = messagePattern;
5860       mSeverity = severity;
5870       CHECKSTYLE_FINDING_TYPES.add(this);
5880    }
589  
590  
591  
592      private CheckstyleFindingType (String symbol, String shortText,
593          String description, String messagePattern)
594      {
5950         this(symbol, shortText, description, messagePattern,
596              Severity.CODE_STYLE);
5970     }
598  
599     /**
600      * Reads the given message and tries to find a matching finding type.
601      * @param message the message to read.
602      * @return the finding type matching to the message, or null if no such
603      *   type was found.
604      */
605     public static FindingType detectFindingTypeForMessage (String message)
606     {
6070(2)      new FindingType.LazyInit();
6080       FindingType result = null;
609  
6100       for (final CheckstyleFindingType type : CHECKSTYLE_FINDING_TYPES)
611        {
6120          if (message.matches(type.getMessagePattern()))
613           {
6140             result = type;
6150             break;
616           }
617        }
6180       return result;
619     }
620  
621     /** @return the severity assigned to findings of this type by default. */
622     public Severity getSeverity ()
623     {
6240        return mSeverity;
625     }
626  
627     /**
628      * @return Returns the messagePattern.
629      */
630     private String getMessagePattern ()
631     {
6320       return mMessagePattern;
633     }
634  
635     /**
636      * Init of the enum.
637      */
638     public static void initialize ()
639     {
640        try
641        {
6420          final JAXBContext jaxbContext
643              = JAXBContext.newInstance(CHECKSTYLE_MESSAGE_JAXB_CONTEXT,
644                 CheckstyleFindingType.class.getClassLoader());
6450          final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
6460          final CheckstyleMessages messageCollection
647              = (CheckstyleMessages) unmarshaller.unmarshal(
648                    CheckstyleFindingType.class.getClassLoader().
649                        getResourceAsStream(CHECKSTYLE_MESSAGE_FILE));
650           for (final FindingData e
6510(3)             : (List<FindingData>) messageCollection.getFindingType())
652           {
6530             new CheckstyleFindingType(e.getSymbol(), e.getShortDescription(),
654                    e.getDetailedDescription(), e.getMessagePattern());
655  
656           }
657        }
6580       catch (Exception e)
659        {
6600          throw new RuntimeException(
661                   "Cannot initialize CheckstyleFindingTypes", e);
6620       }
6630    }
664  }

Findings in this File

f (4) Static variable definition in wrong order. Ok.
f (5) Variable access definition in wrong order. Ok.
f (6) Static variable definition in wrong order. Ok.
f (7) Variable access definition in wrong order. Ok.
f (8) Static variable definition in wrong order. Ok.
f (9) Variable access definition in wrong order. Ok.
f (10) Static variable definition in wrong order. Ok.
f (11) Variable access definition in wrong order. Ok.
f (12) Static variable definition in wrong order. Ok.
f (13) Variable access definition in wrong order. Ok.
f (14) Static variable definition in wrong order. Ok.
f (15) Variable access definition in wrong order. Ok.
f (16) Static variable definition in wrong order. Ok.
f (17) Variable access definition in wrong order. Ok.
f (18) Static variable definition in wrong order. Ok.
f (19) Variable access definition in wrong order. Ok.
f (20) Static variable definition in wrong order. Ok.
f (21) Variable access definition in wrong order. Ok.
f (22) Static variable definition in wrong order. Ok.
f (23) Variable access definition in wrong order. Ok.
f (24) Static variable definition in wrong order. Ok.
f (25) Variable access definition in wrong order. Ok.
f (26) Static variable definition in wrong order. Ok.
f (27) Variable access definition in wrong order. Ok.
f (28) Static variable definition in wrong order. Ok.
f (29) Variable access definition in wrong order. Ok.
f (30) Static variable definition in wrong order. Ok.
f (31) Variable access definition in wrong order. Ok.
f (32) Static variable definition in wrong order. Ok.
f (33) Variable access definition in wrong order. Ok.
f (34) Static variable definition in wrong order. Ok.
f (35) Variable access definition in wrong order. Ok.
f (36) Static variable definition in wrong order. Ok.
f (37) Variable access definition in wrong order. Ok.
f (38) Static variable definition in wrong order. Ok.
f (39) Variable access definition in wrong order. Ok.
f (40) Static variable definition in wrong order. Ok.
f (41) Variable access definition in wrong order. Ok.
f (42) Static variable definition in wrong order. Ok.
f (43) Variable access definition in wrong order. Ok.
f (44) Static variable definition in wrong order. Ok.
f (45) Variable access definition in wrong order. Ok.
f (46) Static variable definition in wrong order. Ok.
f (47) Variable access definition in wrong order. Ok.
f (48) Static variable definition in wrong order. Ok.
f (49) Variable access definition in wrong order. Ok.
f (50) Static variable definition in wrong order. Ok.
f (51) Variable access definition in wrong order. Ok.
f (52) Static variable definition in wrong order. Ok.
f (53) Variable access definition in wrong order. Ok.
f (54) Static variable definition in wrong order. Ok.
f (55) Variable access definition in wrong order. Ok.
f (56) Static variable definition in wrong order. Ok.
f (57) Variable access definition in wrong order. Ok.
f (58) Static variable definition in wrong order. Ok.
f (59) Variable access definition in wrong order. Ok.
f (60) Static variable definition in wrong order. Ok.
f (61) Variable access definition in wrong order. Ok.
f (62) Static variable definition in wrong order. Ok.
f (63) Variable access definition in wrong order. Ok.
f (64) Static variable definition in wrong order. Ok.
f (65) Variable access definition in wrong order. Ok.
f (66) Static variable definition in wrong order. Ok.
f (67) Variable access definition in wrong order. Ok.
f (68) Static variable definition in wrong order. Ok.
f (69) Variable access definition in wrong order. Ok.
f (70) Static variable definition in wrong order. Ok.
f (71) Variable access definition in wrong order. Ok.
f (72) Static variable definition in wrong order. Ok.
f (73) Variable access definition in wrong order. Ok.
f (74) Static variable definition in wrong order. Ok.
f (75) Variable access definition in wrong order. Ok.
f (76) Static variable definition in wrong order. Ok.
f (77) Variable access definition in wrong order. Ok.
f (78) Static variable definition in wrong order. Ok.
f (79) Variable access definition in wrong order. Ok.
f (80) Static variable definition in wrong order. Ok.
f (81) Variable access definition in wrong order. Ok.
f (82) Static variable definition in wrong order. Ok.
f (83) Variable access definition in wrong order. Ok.
f (84) Static variable definition in wrong order. Ok.
f (85) Variable access definition in wrong order. Ok.
f (86) Static variable definition in wrong order. Ok.
f (87) Variable access definition in wrong order. Ok.
f (88) Static variable definition in wrong order. Ok.
f (89) Variable access definition in wrong order. Ok.
f (90) Static variable definition in wrong order. Ok.
f (91) Variable access definition in wrong order. Ok.
f (92) Static variable definition in wrong order. Ok.
f (93) Variable access definition in wrong order. Ok.
f (94) Static variable definition in wrong order. Ok.
f (95) Variable access definition in wrong order. Ok.
f (96) Static variable definition in wrong order. Ok.
f (97) Variable access definition in wrong order. Ok.
f (98) Static variable definition in wrong order. Ok.
f (99) Variable access definition in wrong order. Ok.
f (100) Static variable definition in wrong order. Ok.
f (101) Variable access definition in wrong order. Ok.
w (1) 176 : 0 org.jcoderz.phoenix.report.CheckstyleFindingType doesn't override FindingType.equals(Object)
i (2) 607 : 0 Method org.jcoderz.phoenix.report.CheckstyleFindingType.detectFindingTypeForMessage(String) needlessly instantiates a class that only supplies static methods
c (3) 651 : 68 [unchecked] unchecked cast found : java.util.List required: java.util.List<org.jcoderz.phoenix.checkstyle.message.jaxb.FindingData>