Revision 40465

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.buildtools/src/main/resources/gvsig/checkstyle.xml
1
<?xml version="1.0"?>
2
<!DOCTYPE module PUBLIC
3
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
4
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
5

  
6
<!--
7

  
8
  Checkstyle configuration that checks the sun coding conventions from:
9

  
10
    - the Java Language Specification at
11
      http://java.sun.com/docs/books/jls/second_edition/html/index.html
12

  
13
    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
14

  
15
    - the Javadoc guidelines at
16
      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
17

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

  
20
    - some best practices
21

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

  
25
  Most Checks are configurable, be sure to consult the documentation.
26

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

  
29
  Finally, it is worth reading the documentation.
30

  
31
-->
32

  
33
<module name="Checker">
34
    <!--
35
        If you set the basedir property below, then all reported file
36
        names will be relative to the specified directory. See
37
        http://checkstyle.sourceforge.net/5.x/config.html#Checker
38

  
39
        <property name="basedir" value="${basedir}"/>
40
    -->
41
    <!-- gvSIG: All project files have the ISO-8859-1 charset -->
42
	<property name="charset" value="ISO-8859-1" />
43

  
44
    <!-- Checks that a package-info.java file exists for each package.     -->
45
    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
46
	<module name="JavadocPackage">
47
		<property name="allowLegacy" value="true" />
48
	</module>
49

  
50
    <!-- Checks whether files end with a new line.                        -->
51
    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
52
    <module name="NewlineAtEndOfFile"/>
53

  
54
    <!-- Checks that property files contain the same keys.         -->
55
    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
56
    <module name="Translation"/>
57
    
58
    <!-- Checks for Size Violations.                    -->
59
    <!-- See http://checkstyle.sf.net/config_sizes.html -->
60
    <module name="FileLength"/>
61
    
62
    <!-- Checks for whitespace                               -->
63
    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
64
    <module name="FileTabCharacter"/>
65

  
66

  
67
    <module name="TreeWalker">
68

  
69
	    <!-- Miscellaneous other checks.                   -->
70
	    <!-- See http://checkstyle.sf.net/config_misc.html -->
71
	    <!-- gvSIG: apply only to java files -->
72
	    <module name="RegexpSinglelineJava">
73
	       <property name="format" value="\s+$"/>
74
	       <property name="minimum" value="0"/>
75
	       <property name="maximum" value="0"/>
76
	       <property name="message" value="Line has trailing spaces."/>
77
	       <property name="ignoreComments" value="true"/>
78
	    </module>
79
	    
80
        <!-- Checks for Javadoc comments.                     -->
81
        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
82
		<!--
83
			gvSIG rule 3: All protected or public classes must have a Javadoc comments,
84
			except getters and setters
85
		-->
86
		<module name="JavadocMethod">
87
			<property name="scope" value="protected" />
88
			<property name="allowMissingPropertyJavadoc" value="true" />
89
		</module>
90
		<!--
91
			gvSIG rule 9: All classes must have a Javadoc comment
92
			with the "@author tag" and the "@version $Id$" tag included 
93
		-->
94
		<module name="JavadocType">
95
			<property name="scope" value="private" />
96
			<property name="authorFormat" value="\S" />
97
			<property name="versionFormat" value="\$Id.*\$"/>
98
		</module>
99
        <module name="JavadocVariable">
100
			<property name="scope" value="protected" />
101
		</module>
102
		<!-- gvSIG rule 3: Check correctly formatted Javadoc -->
103
		<module name="JavadocStyle">
104
			<property name="scope" value="protected" />
105
		</module>
106

  
107

  
108
        <!-- Checks for Naming Conventions.                  -->
109
        <!-- See http://checkstyle.sf.net/config_naming.html -->
110
        <module name="ConstantName"/>
111
        <module name="LocalFinalVariableName"/>
112
        <module name="LocalVariableName"/>
113
        <module name="MemberName"/>
114
        <module name="MethodName"/>
115
		<!-- gvSIG rule 15: All packages must begin with org.gvsig.  -->
116
		<module name="PackageName">
117
			<property name="format" value="^org\.gvsig(\.[a-z][a-z0-9]*)+$" />
118
		</module>
119
		<!-- gvSIG advised rule 1: Abstract class names must begin with Abstract. -->
120
		<!-- module name="AbstractClassName" /-->
121
        <module name="ParameterName"/>
122
        <module name="StaticVariableName"/>
123
        <module name="TypeName"/>
124

  
125
        <!-- Checks for imports                              -->
126
        <!-- See http://checkstyle.sf.net/config_import.html -->
127
        <module name="AvoidStarImport"/>
128
        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
129
        <module name="RedundantImport"/>
130
        <module name="UnusedImports"/>
131

  
132

  
133
        <!-- Checks for Size Violations.                    -->
134
        <!-- See http://checkstyle.sf.net/config_sizes.html -->
135
        <module name="LineLength"/>
136
        <module name="MethodLength"/>
137
        <module name="ParameterNumber"/>
138

  
139

  
140
        <!-- Checks for whitespace                               -->
141
        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
142
        <module name="EmptyForIteratorPad"/>
143
        <module name="GenericWhitespace"/>
144
        <module name="MethodParamPad"/>
145
        <module name="NoWhitespaceAfter"/>
146
        <module name="NoWhitespaceBefore"/>
147
        <module name="OperatorWrap"/>
148
        <module name="ParenPad"/>
149
        <module name="TypecastParenPad"/>
150
        <module name="WhitespaceAfter"/>
151
        <module name="WhitespaceAround"/>
152

  
153

  
154
        <!-- Modifier Checks                                    -->
155
        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
156
        <module name="ModifierOrder"/>
157
        <module name="RedundantModifier"/>
158

  
159

  
160
        <!-- Checks for blocks. You know, those {}'s         -->
161
        <!-- See http://checkstyle.sf.net/config_blocks.html -->
162
        <module name="AvoidNestedBlocks"/>
163
        <module name="EmptyBlock"/>
164
        <module name="LeftCurly"/>
165
        <module name="NeedBraces"/>
166
        <module name="RightCurly"/>
167

  
168

  
169
        <!-- Checks for common coding problems               -->
170
        <!-- See http://checkstyle.sf.net/config_coding.html -->
171
        <module name="AvoidInlineConditionals"/>
172
        <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
173
        <module name="EmptyStatement"/>
174
        <module name="EqualsHashCode"/>
175
        <module name="HiddenField"/>
176
        <module name="IllegalInstantiation"/>
177
        <module name="InnerAssignment"/>
178
        <module name="MagicNumber"/>
179
        <module name="MissingSwitchDefault"/>
180
        <module name="RedundantThrows"/>
181
        <module name="SimplifyBooleanExpression"/>
182
        <module name="SimplifyBooleanReturn"/>
183

  
184
		<!-- gvSIG: Check for some common programming errors -->
185
		<module name="CovariantEquals" />
186
		<module name="StringLiteralEquality" />
187

  
188
        <!-- Checks for class design                         -->
189
        <!-- See http://checkstyle.sf.net/config_design.html -->
190
        <module name="DesignForExtension"/>
191
        <module name="FinalClass"/>
192
        <module name="HideUtilityClassConstructor"/>
193
        <module name="InterfaceIsType"/>
194
        <module name="VisibilityModifier"/>
195

  
196

  
197
        <!-- Miscellaneous other checks.                   -->
198
        <!-- See http://checkstyle.sf.net/config_misc.html -->
199
        <module name="ArrayTypeStyle"/>
200
        <!-- gvSIG: removed -->
201
        <!-- module name="FinalParameters"/-->
202
        <module name="TodoComment"/>
203
        <module name="UpperEll"/>
204
				
205
	    <!-- gvSIG rule 2: Sun style with 4 spaces -->
206
	    <module name="Indentation">
207
	    	<property name="basicOffset" value="4"/>
208
		    <property name="caseIndent" value="0"/>
209
		</module>
210
        
211
        <!-- gvSIG rule 10: Do not use System.out/err to log -->
212
		<module name="Regexp">
213
		    <!-- . matches any character, so we need to escape it and use \. 
214
		    to match dots.-->
215
		    <property name="format" value="System\.[out|err]\.println"/>
216
		    <property name="illegalPattern" value="true"/>
217
		</module>
218
		
219
		<!-- gvSIG rule 11: Try to avoid catching Throwable or 
220
		Exception and catch specific exceptions instead. -->
221
		<module name="IllegalCatch"/>
222
		
223
		<!-- gvSIG rule 13: Use interfaces in the declaration of 
224
		methods and variables.
225
        By default only avoids usage of Classes:
226
			"java.util.GregorianCalendar, java.util.Hashtable, 
227
		  	java.util.HashSet, java.util.HashMap, java.util.ArrayList, 
228
		  	java.util.LinkedList, java.util.LinkedHashMap, 
229
		  	java.util.LinkedHashSet, java.util.TreeSet, 
230
		  	java.util.TreeMap, java.util.Vector" -->
231
		<module name="IllegalType">
232
		    <property name="ignoredMethodNames" value="getInstance"/>
233
		</module>
234
		
235
    </module>
236

  
237
	<!--  gvSIG rule 1: check for the gvSIG header -->
238
    <!-- Uneeded, use the maven-license-plugin instead
239
	<module name="RegexpHeader"> -->
240
		<!-- The follow property value demonstrates the ability     -->
241
		<!-- to have access to ANT properties. In this case it uses -->
242
		<!-- the ${basedir} property to allow Checkstyle to be run  -->
243
		<!-- from any directory within a project. See property      -->
244
		<!-- expansion,                                             -->
245
		<!-- http://checkstyle.sf.net/config.html#properties        -->
246
    <!--
247
		<property name="headerFile" value="${checkstyle.header.file}" />
248
	</module>
249
    -->
250

  
251
</module>
0 252

  

Also available in: Unified diff