blob: 073fdbf64e299f83e0ae8ca375655c47189e0500 [file] [log] [blame]
Alexander Afanasyevcbc41012016-02-19 20:10:57 -08001<?xml version="1.0"?>
Alexander Afanasyevcbc41012016-02-19 20:10:57 -08002<!DOCTYPE module PUBLIC
Davide Pesavento8cda2f92020-11-01 23:08:09 -05003 "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4 "https://checkstyle.org/dtds/configuration_1_3.dtd">
Alexander Afanasyevcbc41012016-02-19 20:10:57 -08005
6<!--
7
Alexander Afanasyevcbc41012016-02-19 20:10:57 -08008 Checkstyle configuration that checks the sun coding conventions from:
9
10 - the Java Language Specification at
Davide Pesavento8cda2f92020-11-01 23:08:09 -050011 https://docs.oracle.com/javase/specs/jls/se11/html/index.html
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080012
Davide Pesavento8cda2f92020-11-01 23:08:09 -050013 - the Sun Code Conventions at https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080014
15 - the Javadoc guidelines at
Davide Pesavento8cda2f92020-11-01 23:08:09 -050016 https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080017
Davide Pesavento8cda2f92020-11-01 23:08:09 -050018 - the JDK Api documentation https://docs.oracle.com/en/java/javase/11/
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080019
20 - some best practices
21
22 Checkstyle is very configurable. Be sure to read the documentation at
Davide Pesavento8cda2f92020-11-01 23:08:09 -050023 https://checkstyle.org (or in your downloaded distribution).
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080024
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.
Davide Pesavento8cda2f92020-11-01 23:08:09 -050028 To suppress certain violations please review suppression filters.
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080029
30 Finally, it is worth reading the documentation.
31
32-->
33
34<module name="Checker">
Davide Pesavento8cda2f92020-11-01 23:08:09 -050035 <!--
36 If you set the basedir property below, then all reported file
37 names will be relative to the specified directory. See
38 https://checkstyle.org/config.html#Checker
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080039
Davide Pesavento8cda2f92020-11-01 23:08:09 -050040 <property name="basedir" value="${basedir}"/>
41 -->
42 <property name="severity" value="error"/>
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080043
Davide Pesavento8cda2f92020-11-01 23:08:09 -050044 <property name="fileExtensions" value="java, properties, xml"/>
45
46 <!-- Excludes all 'module-info.java' files -->
47 <!-- See https://checkstyle.org/config_filefilters.html -->
48 <module name="BeforeExecutionExclusionFileFilter">
49 <property name="fileNamePattern" value="module\-info\.java$"/>
50 </module>
51
52 <!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
53 <module name="SuppressionFilter">
54 <property name="file" value="${org.checkstyle.sun.suppressionfilter.config}"
55 default="checkstyle-suppressions.xml" />
56 <property name="optional" value="true"/>
57 </module>
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080058
59 <!-- Checks that a package-info.java file exists for each package. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -050060 <!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage -->
61 <!-- <module name="JavadocPackage"/> -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080062
63 <!-- Checks whether files end with a new line. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -050064 <!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080065 <module name="NewlineAtEndOfFile"/>
66
67 <!-- Checks that property files contain the same keys. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -050068 <!-- See https://checkstyle.org/config_misc.html#Translation -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080069 <module name="Translation"/>
70
71 <!-- Checks for Size Violations. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -050072 <!-- See https://checkstyle.org/config_sizes.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080073 <module name="FileLength"/>
74
75 <!-- Checks for whitespace -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -050076 <!-- See https://checkstyle.org/config_whitespace.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080077 <module name="FileTabCharacter"/>
78
79 <!-- Miscellaneous other checks. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -050080 <!-- See https://checkstyle.org/config_misc.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080081 <module name="RegexpSingleline">
82 <property name="format" value="\s+$"/>
83 <property name="minimum" value="0"/>
84 <property name="maximum" value="0"/>
85 <property name="message" value="Line has trailing spaces."/>
86 </module>
87
88 <!-- Checks for Headers -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -050089 <!-- See https://checkstyle.org/config_header.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -080090 <!-- <module name="Header"> -->
91 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
92 <!-- <property name="fileExtensions" value="java"/> -->
93 <!-- </module> -->
94
95 <module name="TreeWalker">
96
97 <!-- Checks for Javadoc comments. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -050098 <!-- See https://checkstyle.org/config_javadoc.html -->
99 <module name="InvalidJavadocPosition"/>
100 <module name="JavadocMethod"/>
101 <module name="JavadocType"/>
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800102 <module name="JavadocVariable">
103 <property name="excludeScope" value="private"/>
104 </module>
105 <module name="JavadocStyle"/>
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500106 <!-- <module name="MissingJavadocMethod"/> -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800107
108 <!-- Checks for Naming Conventions. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500109 <!-- See https://checkstyle.org/config_naming.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800110 <module name="ConstantName"/>
111 <module name="LocalFinalVariableName"/>
112 <module name="LocalVariableName"/>
113 <module name="MemberName"/>
114 <module name="MethodName"/>
115 <module name="PackageName"/>
116 <module name="ParameterName"/>
117 <module name="StaticVariableName"/>
118 <module name="TypeName"/>
119
120 <!-- Checks for imports -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500121 <!-- See https://checkstyle.org/config_imports.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800122 <module name="AvoidStarImport"/>
123 <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
124 <module name="RedundantImport"/>
125 <module name="UnusedImports">
126 <property name="processJavadoc" value="false"/>
127 </module>
128
129 <!-- Checks for Size Violations. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500130 <!-- See https://checkstyle.org/config_sizes.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800131 <module name="LineLength">
132 <property name="max" value="120"/>
133 </module>
134 <module name="MethodLength"/>
135 <module name="ParameterNumber"/>
136
137 <!-- Checks for whitespace -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500138 <!-- See https://checkstyle.org/config_whitespace.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800139 <module name="EmptyForIteratorPad"/>
140 <module name="GenericWhitespace"/>
141 <module name="MethodParamPad"/>
142 <module name="NoWhitespaceAfter"/>
143 <module name="NoWhitespaceBefore"/>
144 <module name="OperatorWrap">
145 <property name="option" value="eol"/>
146 </module>
147 <module name="ParenPad"/>
148 <module name="TypecastParenPad"/>
149 <module name="WhitespaceAfter"/>
150 <module name="WhitespaceAround"/>
151
152 <!-- Modifier Checks -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500153 <!-- See https://checkstyle.org/config_modifiers.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800154 <module name="ModifierOrder"/>
155 <module name="RedundantModifier"/>
156
157 <!-- Checks for blocks. You know, those {}'s -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500158 <!-- See https://checkstyle.org/config_blocks.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800159 <module name="AvoidNestedBlocks"/>
160 <module name="EmptyBlock"/>
161 <module name="LeftCurly"/>
162 <module name="NeedBraces"/>
163 <module name="RightCurly"/>
164
165 <!-- Checks for common coding problems -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500166 <!-- See https://checkstyle.org/config_coding.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800167 <module name="AvoidInlineConditionals"/>
168 <module name="EmptyStatement"/>
169 <module name="EqualsHashCode"/>
170 <!-- <module name="HiddenField"/> -->
171 <module name="IllegalInstantiation"/>
172 <module name="InnerAssignment"/>
173 <module name="MagicNumber"/>
174 <module name="MissingSwitchDefault"/>
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500175 <module name="MultipleVariableDeclarations"/>
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800176 <module name="SimplifyBooleanExpression"/>
177 <module name="SimplifyBooleanReturn"/>
178
179 <!-- Checks for class design -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500180 <!-- See https://checkstyle.org/config_design.html -->
181 <!-- <module name="DesignForExtension"/> -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800182 <module name="FinalClass"/>
183 <module name="HideUtilityClassConstructor"/>
184 <module name="InterfaceIsType"/>
185 <module name="VisibilityModifier">
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500186 <property name="allowPublicFinalFields" value="true"/>
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800187 </module>
188
189 <!-- Miscellaneous other checks. -->
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500190 <!-- See https://checkstyle.org/config_misc.html -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800191 <module name="ArrayTypeStyle"/>
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500192 <!-- <module name="FinalParameters"/> -->
193 <!-- <module name="TodoComment"/> -->
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800194 <module name="UpperEll"/>
195
Davide Pesavento8cda2f92020-11-01 23:08:09 -0500196 <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
197 <module name="SuppressionXpathFilter">
198 <property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}"
199 default="checkstyle-xpath-suppressions.xml" />
200 <property name="optional" value="true"/>
201 </module>
202
Alexander Afanasyevcbc41012016-02-19 20:10:57 -0800203 </module>
204
205</module>