Clover Coverage Report - Checkstyle
Coverage timestamp: Fri May 9 2008 10:48:13 EST
../../../../img/srcFileCovDistChart9.png 55% of files have more coverage
141   536   66   5.88
60   317   0.47   24
24     2.75  
1    
 
  Checker       Line # 50 84.9% 0.8488889
81.03 141 66 66 0.47
 
  ( 10 of 461)
 
1    ////////////////////////////////////////////////////////////////////////////////
2    // checkstyle: Checks Java source code for adherence to a set of rules.
3    // Copyright (C) 2001-2005 Oliver Burn
4    //
5    // This library is free software; you can redistribute it and/or
6    // modify it under the terms of the GNU Lesser General Public
7    // License as published by the Free Software Foundation; either
8    // version 2.1 of the License, or (at your option) any later version.
9    //
10    // This library is distributed in the hope that it will be useful,
11    // but WITHOUT ANY WARRANTY; without even the implied warranty of
12    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    // Lesser General Public License for more details.
14    //
15    // You should have received a copy of the GNU Lesser General Public
16    // License along with this library; if not, write to the Free Software
17    // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18    ////////////////////////////////////////////////////////////////////////////////
19    package com.puppycrawl.tools.checkstyle;
20   
21    import java.io.File;
22   
23    import java.util.ArrayList;
24    import java.util.Iterator;
25    import java.util.Locale;
26    import java.util.Stack;
27    import java.util.StringTokenizer;
28   
29    import com.puppycrawl.tools.checkstyle.api.SeverityLevelCounter;
30    import com.puppycrawl.tools.checkstyle.api.AutomaticBean;
31    import com.puppycrawl.tools.checkstyle.api.MessageDispatcher;
32    import com.puppycrawl.tools.checkstyle.api.SeverityLevel;
33    import com.puppycrawl.tools.checkstyle.api.Context;
34    import com.puppycrawl.tools.checkstyle.api.FilterSet;
35    import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
36    import com.puppycrawl.tools.checkstyle.api.LocalizedMessage;
37    import com.puppycrawl.tools.checkstyle.api.Configuration;
38    import com.puppycrawl.tools.checkstyle.api.FileSetCheck;
39    import com.puppycrawl.tools.checkstyle.api.Filter;
40    import com.puppycrawl.tools.checkstyle.api.AuditListener;
41    import com.puppycrawl.tools.checkstyle.api.Utils;
42    import com.puppycrawl.tools.checkstyle.api.AuditEvent;
43   
44    /**
45    * This class provides the functionality to check a set of files.
46    * @author Oliver Burn
47    * @author <a href="mailto:stephane.bailliez@wanadoo.fr">Stephane Bailliez</a>
48    * @author lkuehne
49    */
 
50    public class Checker extends AutomaticBean
51    implements MessageDispatcher
52    {
53    /** maintains error count */
54    private final SeverityLevelCounter mCounter =
55    new SeverityLevelCounter(SeverityLevel.ERROR);
56   
57    /** vector of listeners */
58    private final ArrayList mListeners = new ArrayList();
59   
60    /** vector of fileset checks */
61    private final ArrayList mFileSetChecks = new ArrayList();
62   
63    /** class loader to resolve classes with. **/
64    private ClassLoader mLoader =
65    Thread.currentThread().getContextClassLoader();
66   
67    /** the basedir to strip off in filenames */
68    private String mBasedir;
69   
70    /** locale country to report messages **/
71    private String mLocaleCountry = Locale.getDefault().getCountry();
72    /** locale language to report messages **/
73    private String mLocaleLanguage = Locale.getDefault().getLanguage();
74   
75    /** The factory for instantiating submodules */
76    private ModuleFactory mModuleFactory;
77   
78    /** the context of all child components */
79    private Context mChildContext;
80   
81    /** The audit event filters */
82    private final FilterSet mFilters = new FilterSet();
83   
84    /**
85    * The severity level of any violations found by submodules.
86    * The value of this property is passed to submodules via
87    * contextualize().
88    *
89    * Note: Since the Checker is merely a container for modules
90    * it does not make sense to implement logging functionality
91    * here. Consequently Checker does not extend AbstractViolationReporter,
92    * leading to a bit of duplicated code for severity level setting.
93    */
94    private SeverityLevel mSeverityLevel = SeverityLevel.ERROR;
95   
96    /**
97    * Creates a new <code>Checker</code> instance.
98    * The instance needs to be contextualized and configured.
99    *
100    * @throws CheckstyleException if an error occurs
101    */
 
102  466 toggle public Checker()
103    throws CheckstyleException
104    {
105  466 addListener(mCounter);
106    }
107   
108