/ _checkstyle / checks.xml
checks.xml
1 <?xml version="1.0"?> 2 <!DOCTYPE module PUBLIC 3 "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" 4 "https://checkstyle.org/dtds/configuration_1_3.dtd"> 5 6 <!-- 7 8 Checkstyle configuration that checks the sun coding conventions from: 9 10 - the Java Language Specification at 11 https://docs.oracle.com/javase/specs/jls/se11/html/index.html 12 13 - the Sun Code Conventions at https://www.oracle.com/java/technologies/javase/codeconventions-contents.html 14 15 - the Javadoc guidelines at 16 https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html 17 18 - the JDK Api documentation https://docs.oracle.com/en/java/javase/11/ 19 20 - some best practices 21 22 Checkstyle is very configurable. Be sure to read the documentation at 23 https://checkstyle.org (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 To suppress certain violations please review suppression filters. 29 30 Finally, it is worth reading the documentation. 31 32 --> 33 34 <module name="Checker"> 35 <!-- 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 39 40 <property name="basedir" value="${basedir}"/> 41 --> 42 <property name="severity" value="error"/> 43 44 <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> 58 59 <!-- Checks that a package-info.java file exists for each package. --> 60 <!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage --> 61 <!--<module name="JavadocPackage"/>--> 62 63 <!-- Checks whether files end with a new line. --> 64 <!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile --> 65 <module name="NewlineAtEndOfFile"/> 66 67 <!-- Checks that property files contain the same keys. --> 68 <!-- See https://checkstyle.org/config_misc.html#Translation --> 69 <module name="Translation"/> 70 71 <!-- Checks for Size Violations. --> 72 <!-- See https://checkstyle.org/config_sizes.html --> 73 <module name="FileLength"/> 74 <module name="LineLength"> 75 <property name="fileExtensions" value="java"/> 76 <property name="ignorePattern" value="SPDX-|https?://"/> 77 <property name="max" value="73"/> 78 </module> 79 80 <!-- Checks for whitespace --> 81 <!-- See https://checkstyle.org/config_whitespace.html --> 82 <!--<module name="FileTabCharacter"/>--> 83 84 <!-- Miscellaneous other checks. --> 85 <!-- See https://checkstyle.org/config_misc.html --> 86 <module name="RegexpSingleline"> 87 <property name="format" value="\s+$"/> 88 <property name="minimum" value="0"/> 89 <property name="maximum" value="0"/> 90 <property name="message" value="Line has trailing spaces."/> 91 </module> 92 93 <!-- Checks for Headers --> 94 <!-- See https://checkstyle.org/config_header.html --> 95 <!-- <module name="Header"> --> 96 <!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> 97 <!-- <property name="fileExtensions" value="java"/> --> 98 <!-- </module> --> 99 100 <module name="TreeWalker"> 101 102 <!-- Checks for Javadoc comments. --> 103 <!-- See https://checkstyle.org/config_javadoc.html --> 104 <module name="InvalidJavadocPosition"/> 105 <!--<module name="JavadocMethod"/>--> 106 <module name="JavadocType"/> 107 <!--<module name="JavadocVariable"/>--> 108 <module name="JavadocStyle"/> 109 <!--<module name="MissingJavadocMethod"/>--> 110 111 <!-- Checks for Naming Conventions. --> 112 <!-- See https://checkstyle.org/config_naming.html --> 113 <module name="ConstantName"/> 114 <module name="LocalFinalVariableName"/> 115 <module name="LocalVariableName"/> 116 <module name="MemberName"/> 117 <module name="MethodName"/> 118 <module name="PackageName"/> 119 <module name="ParameterName"/> 120 <module name="StaticVariableName"/> 121 <module name="TypeName"/> 122 123 <!-- Checks for imports --> 124 <!-- See https://checkstyle.org/config_imports.html --> 125 <module name="AvoidStarImport"/> 126 <module name="IllegalImport"/> <!-- defaults to sun.* packages --> 127 <module name="RedundantImport"/> 128 <module name="UnusedImports"> 129 <property name="processJavadoc" value="false"/> 130 </module> 131 132 <!-- Checks for Size Violations. --> 133 <!-- See https://checkstyle.org/config_sizes.html --> 134 <module name="MethodLength"/> 135 <module name="ParameterNumber"/> 136 137 <!-- Checks for whitespace --> 138 <!-- See https://checkstyle.org/config_whitespace.html --> 139 <module name="EmptyForIteratorPad"/> 140 <module name="GenericWhitespace"/> 141 <module name="MethodParamPad"/> 142 <module name="NoWhitespaceAfter"/> 143 <module name="NoWhitespaceBefore"/> 144 <module name="OperatorWrap"/> 145 <module name="ParenPad"/> 146 <module name="TypecastParenPad"/> 147 <module name="WhitespaceAfter"/> 148 <module name="WhitespaceAround"/> 149 150 <!-- Modifier Checks --> 151 <!-- See https://checkstyle.org/config_modifiers.html --> 152 <module name="ModifierOrder"/> 153 <module name="RedundantModifier"/> 154 155 <!-- Checks for blocks. You know, those {}'s --> 156 <!-- See https://checkstyle.org/config_blocks.html --> 157 <module name="AvoidNestedBlocks"/> 158 <module name="EmptyBlock"/> 159 <module name="LeftCurly"/> 160 <module name="NeedBraces"/> 161 <module name="RightCurly"/> 162 163 <!-- Checks for common coding problems --> 164 <!-- See https://checkstyle.org/config_coding.html --> 165 <module name="EmptyStatement"/> 166 <module name="EqualsHashCode"/> 167 <!--<module name="HiddenField"/>--> 168 <module name="IllegalInstantiation"/> 169 <module name="InnerAssignment"/> 170 <module name="MagicNumber"/> 171 <module name="MissingSwitchDefault"/> 172 <module name="MultipleVariableDeclarations"/> 173 <module name="SimplifyBooleanExpression"/> 174 <module name="SimplifyBooleanReturn"/> 175 176 <!-- Checks for class design --> 177 <!-- See https://checkstyle.org/config_design.html --> 178 <module name="DesignForExtension"/> 179 <module name="FinalClass"/> 180 <module name="HideUtilityClassConstructor"/> 181 <module name="InterfaceIsType"/> 182 <module name="VisibilityModifier"/> 183 184 <!-- Miscellaneous other checks. --> 185 <!-- See https://checkstyle.org/config_misc.html --> 186 <module name="ArrayTypeStyle"/> 187 <module name="FinalParameters"/> 188 <module name="TodoComment"/> 189 <module name="UpperEll"/> 190 191 <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter --> 192 <module name="SuppressionXpathFilter"> 193 <property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}" 194 default="checkstyle-xpath-suppressions.xml" /> 195 <property name="optional" value="true"/> 196 </module> 197 198 </module> 199 200 </module>