Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.buildtools / src / main / resources / gvsig / checkstyle.xml @ 40559

History | View | Annotate | Download (10.3 KB)

1
<?xml version="1.0"?>
2
<!--
3

4
    gvSIG. Desktop Geographic Information System.
5

6
    Copyright (C) 2007-2013 gvSIG Association.
7

8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 3
11
    of the License, or (at your option) any later version.
12

13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

26
-->
27
<!DOCTYPE module PUBLIC
28
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
29
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
30

    
31
<!--
32

33
  Checkstyle configuration that checks the sun coding conventions from:
34

35
    - the Java Language Specification at
36
      http://java.sun.com/docs/books/jls/second_edition/html/index.html
37

38
    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
39

40
    - the Javadoc guidelines at
41
      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
42

43
    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
44

45
    - some best practices
46

47
  Checkstyle is very configurable. Be sure to read the documentation at
48
  http://checkstyle.sf.net (or in your downloaded distribution).
49

50
  Most Checks are configurable, be sure to consult the documentation.
51

52
  To completely disable a check, just comment it out or delete it from the file.
53

54
  Finally, it is worth reading the documentation.
55

56
-->
57

    
58
<module name="Checker">
59
    <!--
60
        If you set the basedir property below, then all reported file
61
        names will be relative to the specified directory. See
62
        http://checkstyle.sourceforge.net/5.x/config.html#Checker
63

64
        <property name="basedir" value="${basedir}"/>
65
    -->
66
    <!-- gvSIG: All project files have the ISO-8859-1 charset -->
67
        <property name="charset" value="ISO-8859-1" />
68

    
69
    <!-- Checks that a package-info.java file exists for each package.     -->
70
    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
71
        <module name="JavadocPackage">
72
                <property name="allowLegacy" value="true" />
73
        </module>
74

    
75
    <!-- Checks whether files end with a new line.                        -->
76
    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
77
    <module name="NewlineAtEndOfFile"/>
78

    
79
    <!-- Checks that property files contain the same keys.         -->
80
    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
81
    <module name="Translation"/>
82
    
83
    <!-- Checks for Size Violations.                    -->
84
    <!-- See http://checkstyle.sf.net/config_sizes.html -->
85
    <module name="FileLength"/>
86
    
87
    <!-- Checks for whitespace                               -->
88
    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
89
    <module name="FileTabCharacter"/>
90

    
91

    
92
    <module name="TreeWalker">
93

    
94
            <!-- Miscellaneous other checks.                   -->
95
            <!-- See http://checkstyle.sf.net/config_misc.html -->
96
            <!-- gvSIG: apply only to java files -->
97
            <module name="RegexpSinglelineJava">
98
               <property name="format" value="\s+$"/>
99
               <property name="minimum" value="0"/>
100
               <property name="maximum" value="0"/>
101
               <property name="message" value="Line has trailing spaces."/>
102
               <property name="ignoreComments" value="true"/>
103
            </module>
104
            
105
        <!-- Checks for Javadoc comments.                     -->
106
        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
107
                <!--
108
                        gvSIG rule 3: All protected or public classes must have a Javadoc comments,
109
                        except getters and setters
110
                -->
111
                <module name="JavadocMethod">
112
                        <property name="scope" value="protected" />
113
                        <property name="allowMissingPropertyJavadoc" value="true" />
114
                </module>
115
                <!--
116
                        gvSIG rule 9: All classes must have a Javadoc comment
117
                        with the "@author tag" and the "@version $Id$" tag included 
118
                -->
119
                <module name="JavadocType">
120
                        <property name="scope" value="private" />
121
                        <property name="authorFormat" value="\S" />
122
                        <property name="versionFormat" value="\$Id.*\$"/>
123
                </module>
124
        <module name="JavadocVariable">
125
                        <property name="scope" value="protected" />
126
                </module>
127
                <!-- gvSIG rule 3: Check correctly formatted Javadoc -->
128
                <module name="JavadocStyle">
129
                        <property name="scope" value="protected" />
130
                </module>
131

    
132

    
133
        <!-- Checks for Naming Conventions.                  -->
134
        <!-- See http://checkstyle.sf.net/config_naming.html -->
135
        <module name="ConstantName"/>
136
        <module name="LocalFinalVariableName"/>
137
        <module name="LocalVariableName"/>
138
        <module name="MemberName"/>
139
        <module name="MethodName"/>
140
                <!-- gvSIG rule 15: All packages must begin with org.gvsig.  -->
141
                <module name="PackageName">
142
                        <property name="format" value="^org\.gvsig(\.[a-z][a-z0-9]*)+$" />
143
                </module>
144
                <!-- gvSIG advised rule 1: Abstract class names must begin with Abstract. -->
145
                <!-- module name="AbstractClassName" /-->
146
        <module name="ParameterName"/>
147
        <module name="StaticVariableName"/>
148
        <module name="TypeName"/>
149

    
150
        <!-- Checks for imports                              -->
151
        <!-- See http://checkstyle.sf.net/config_import.html -->
152
        <module name="AvoidStarImport"/>
153
        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
154
        <module name="RedundantImport"/>
155
        <module name="UnusedImports"/>
156

    
157

    
158
        <!-- Checks for Size Violations.                    -->
159
        <!-- See http://checkstyle.sf.net/config_sizes.html -->
160
        <module name="LineLength"/>
161
        <module name="MethodLength"/>
162
        <module name="ParameterNumber"/>
163

    
164

    
165
        <!-- Checks for whitespace                               -->
166
        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
167
        <module name="EmptyForIteratorPad"/>
168
        <module name="GenericWhitespace"/>
169
        <module name="MethodParamPad"/>
170
        <module name="NoWhitespaceAfter"/>
171
        <module name="NoWhitespaceBefore"/>
172
        <module name="OperatorWrap"/>
173
        <module name="ParenPad"/>
174
        <module name="TypecastParenPad"/>
175
        <module name="WhitespaceAfter"/>
176
        <module name="WhitespaceAround"/>
177

    
178

    
179
        <!-- Modifier Checks                                    -->
180
        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
181
        <module name="ModifierOrder"/>
182
        <module name="RedundantModifier"/>
183

    
184

    
185
        <!-- Checks for blocks. You know, those {}'s         -->
186
        <!-- See http://checkstyle.sf.net/config_blocks.html -->
187
        <module name="AvoidNestedBlocks"/>
188
        <module name="EmptyBlock"/>
189
        <module name="LeftCurly"/>
190
        <module name="NeedBraces"/>
191
        <module name="RightCurly"/>
192

    
193

    
194
        <!-- Checks for common coding problems               -->
195
        <!-- See http://checkstyle.sf.net/config_coding.html -->
196
        <module name="AvoidInlineConditionals"/>
197
        <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
198
        <module name="EmptyStatement"/>
199
        <module name="EqualsHashCode"/>
200
        <module name="HiddenField"/>
201
        <module name="IllegalInstantiation"/>
202
        <module name="InnerAssignment"/>
203
        <module name="MagicNumber"/>
204
        <module name="MissingSwitchDefault"/>
205
        <module name="RedundantThrows"/>
206
        <module name="SimplifyBooleanExpression"/>
207
        <module name="SimplifyBooleanReturn"/>
208

    
209
                <!-- gvSIG: Check for some common programming errors -->
210
                <module name="CovariantEquals" />
211
                <module name="StringLiteralEquality" />
212

    
213
        <!-- Checks for class design                         -->
214
        <!-- See http://checkstyle.sf.net/config_design.html -->
215
        <module name="DesignForExtension"/>
216
        <module name="FinalClass"/>
217
        <module name="HideUtilityClassConstructor"/>
218
        <module name="InterfaceIsType"/>
219
        <module name="VisibilityModifier"/>
220

    
221

    
222
        <!-- Miscellaneous other checks.                   -->
223
        <!-- See http://checkstyle.sf.net/config_misc.html -->
224
        <module name="ArrayTypeStyle"/>
225
        <!-- gvSIG: removed -->
226
        <!-- module name="FinalParameters"/-->
227
        <module name="TodoComment"/>
228
        <module name="UpperEll"/>
229
                                
230
            <!-- gvSIG rule 2: Sun style with 4 spaces -->
231
            <module name="Indentation">
232
                    <property name="basicOffset" value="4"/>
233
                    <property name="caseIndent" value="0"/>
234
                </module>
235
        
236
        <!-- gvSIG rule 10: Do not use System.out/err to log -->
237
                <module name="Regexp">
238
                    <!-- . matches any character, so we need to escape it and use \. 
239
                    to match dots.-->
240
                    <property name="format" value="System\.[out|err]\.println"/>
241
                    <property name="illegalPattern" value="true"/>
242
                </module>
243
                
244
                <!-- gvSIG rule 11: Try to avoid catching Throwable or 
245
                Exception and catch specific exceptions instead. -->
246
                <module name="IllegalCatch"/>
247
                
248
                <!-- gvSIG rule 13: Use interfaces in the declaration of 
249
                methods and variables.
250
        By default only avoids usage of Classes:
251
                        "java.util.GregorianCalendar, java.util.Hashtable, 
252
                          java.util.HashSet, java.util.HashMap, java.util.ArrayList, 
253
                          java.util.LinkedList, java.util.LinkedHashMap, 
254
                          java.util.LinkedHashSet, java.util.TreeSet, 
255
                          java.util.TreeMap, java.util.Vector" -->
256
                <module name="IllegalType">
257
                    <property name="ignoredMethodNames" value="getInstance"/>
258
                </module>
259
                
260
    </module>
261

    
262
        <!--  gvSIG rule 1: check for the gvSIG header -->
263
    <!-- Uneeded, use the maven-license-plugin instead
264
        <module name="RegexpHeader"> -->
265
                <!-- The follow property value demonstrates the ability     -->
266
                <!-- to have access to ANT properties. In this case it uses -->
267
                <!-- the ${basedir} property to allow Checkstyle to be run  -->
268
                <!-- from any directory within a project. See property      -->
269
                <!-- expansion,                                             -->
270
                <!-- http://checkstyle.sf.net/config.html#properties        -->
271
    <!--
272
                <property name="headerFile" value="${checkstyle.header.file}" />
273
        </module>
274
    -->
275

    
276
</module>