|
| 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 | + Checkstyle configuration that checks the sun coding conventions from: |
| 8 | + - the Java Language Specification at |
| 9 | + https://docs.oracle.com/javase/specs/jls/se11/html/index.html |
| 10 | + - the Sun Code Conventions at https://www.oracle.com/java/technologies/javase/codeconventions-contents.html |
| 11 | + - the Javadoc guidelines at |
| 12 | + https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html |
| 13 | + - the JDK Api documentation https://docs.oracle.com/en/java/javase/11/ |
| 14 | + - some best practices |
| 15 | + Checkstyle is very configurable. Be sure to read the documentation at |
| 16 | + https://checkstyle.org (or in your downloaded distribution). |
| 17 | + Most Checks are configurable, be sure to consult the documentation. |
| 18 | + To completely disable a check, just comment it out or delete it from the file. |
| 19 | + To suppress certain violations please review suppression filters. |
| 20 | + Finally, it is worth reading the documentation. |
| 21 | +--> |
| 22 | +<!-- exSUN codestyle check with the additional check for System.out.ptintln --> |
| 23 | +<module name="Checker"> |
| 24 | + <!-- |
| 25 | + If you set the basedir property below, then all reported file |
| 26 | + names will be relative to the specified directory. See |
| 27 | + https://checkstyle.org/config.html#Checker |
| 28 | + <property name="basedir" value="${basedir}"/> |
| 29 | + --> |
| 30 | + <property name="severity" value="ignore"/> |
| 31 | + |
| 32 | + <property name="fileExtensions" value="java, properties, xml"/> |
| 33 | + |
| 34 | + <!-- Excludes all 'module-info.java' files --> |
| 35 | + <!-- See https://checkstyle.org/config_filefilters.html --> |
| 36 | + <module name="BeforeExecutionExclusionFileFilter"> |
| 37 | + <property name="fileNamePattern" value="module\-info\.java$"/> |
| 38 | + </module> |
| 39 | + <!-- System.out.ptintln --> |
| 40 | + <module name="BeforeExecutionExclusionFileFilter"> |
| 41 | + <property name="fileNamePattern" value="src/main/java/org/opensearch/security/tools/*"/> |
| 42 | + </module> |
| 43 | + <module name="BeforeExecutionExclusionFileFilter"> |
| 44 | + <property name="fileNamePattern" value="src/main/java/com/amazon/dlic/auth/http/kerberos/HTTPSpnegoAuthenticator.java"/> |
| 45 | + </module> |
| 46 | + |
| 47 | + <!-- https://checkstyle.org/config_filters.html#SuppressionFilter --> |
| 48 | + <module name="SuppressionFilter"> |
| 49 | + <property name="file" value="${org.checkstyle.sun.suppressionfilter.config}" |
| 50 | + default="checkstyle-suppressions.xml" /> |
| 51 | + <property name="optional" value="true"/> |
| 52 | + </module> |
| 53 | + |
| 54 | + <!-- Checks that a package-info.java file exists for each package. --> |
| 55 | + <!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage --> |
| 56 | + <module name="JavadocPackage"/> |
| 57 | + |
| 58 | + <!-- Checks whether files end with a new line. --> |
| 59 | + <!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile --> |
| 60 | + <module name="NewlineAtEndOfFile"/> |
| 61 | + |
| 62 | + <!-- Checks that property files contain the same keys. --> |
| 63 | + <!-- See https://checkstyle.org/config_misc.html#Translation --> |
| 64 | + <module name="Translation"/> |
| 65 | + |
| 66 | + <!-- Checks for Size Violations. --> |
| 67 | + <!-- See https://checkstyle.org/config_sizes.html --> |
| 68 | + <module name="FileLength"/> |
| 69 | + <module name="LineLength"> |
| 70 | + <property name="fileExtensions" value="java"/> |
| 71 | + </module> |
| 72 | + |
| 73 | + <!-- Checks for whitespace --> |
| 74 | + <!-- See https://checkstyle.org/config_whitespace.html --> |
| 75 | + <module name="FileTabCharacter"/> |
| 76 | + |
| 77 | + <!-- Miscellaneous other checks. --> |
| 78 | + <!-- See https://checkstyle.org/config_misc.html --> |
| 79 | + <module name="RegexpSingleline"> |
| 80 | + <property name="format" value="\s+$"/> |
| 81 | + <property name="minimum" value="0"/> |
| 82 | + <property name="maximum" value="0"/> |
| 83 | + <property name="message" value="Line has trailing spaces."/> |
| 84 | + </module> |
| 85 | + |
| 86 | + <!-- Checks for Headers --> |
| 87 | + <!-- See https://checkstyle.org/config_header.html --> |
| 88 | + <!-- <module name="Header"> --> |
| 89 | + <!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> |
| 90 | + <!-- <property name="fileExtensions" value="java"/> --> |
| 91 | + <!-- </module> --> |
| 92 | + |
| 93 | + <module name="TreeWalker"> |
| 94 | + |
| 95 | + <!-- Checks for Javadoc comments. --> |
| 96 | + <!-- See https://checkstyle.org/config_javadoc.html --> |
| 97 | + <module name="InvalidJavadocPosition"/> |
| 98 | + <module name="JavadocMethod"/> |
| 99 | + <module name="JavadocType"/> |
| 100 | + <module name="JavadocVariable"/> |
| 101 | + <module name="JavadocStyle"/> |
| 102 | + <module name="MissingJavadocMethod"/> |
| 103 | + |
| 104 | + <!-- Checks for Naming Conventions. --> |
| 105 | + <!-- See https://checkstyle.org/config_naming.html --> |
| 106 | + <module name="ConstantName"/> |
| 107 | + <module name="LocalFinalVariableName"/> |
| 108 | + <module name="LocalVariableName"/> |
| 109 | + <module name="MemberName"/> |
| 110 | + <module name="MethodName"/> |
| 111 | + <module name="PackageName"/> |
| 112 | + <module name="ParameterName"/> |
| 113 | + <module name="StaticVariableName"/> |
| 114 | + <module name="TypeName"/> |
| 115 | + |
| 116 | + <!-- Checks for imports --> |
| 117 | + <!-- See https://checkstyle.org/config_imports.html --> |
| 118 | + <module name="AvoidStarImport"> |
| 119 | + <property name="severity" value="error"/> |
| 120 | + </module> |
| 121 | + <module name="IllegalImport"> <!-- defaults to sun.* packages --> |
| 122 | + <property name="severity" value="error"/> |
| 123 | + <property name="illegalPkgs" value="org.apache.cxf.rs.security.jose"/> |
| 124 | + <property name="illegalClasses" value="org.apache.hc.core5.http.HttpStatus"/> |
| 125 | + </module> |
| 126 | + <module name="RedundantImport"> |
| 127 | + <property name="severity" value="error"/> |
| 128 | + </module> |
| 129 | + <module name="UnusedImports"> |
| 130 | + <property name="severity" value="error"/> |
| 131 | + <property name="processJavadoc" value="true"/> |
| 132 | + </module> |
| 133 | + |
| 134 | + <!-- Checks for Size Violations. --> |
| 135 | + <!-- See https://checkstyle.org/config_sizes.html --> |
| 136 | + <module name="MethodLength"/> |
| 137 | + <module name="ParameterNumber"/> |
| 138 | + |
| 139 | + <!-- Checks for whitespace --> |
| 140 | + <!-- See https://checkstyle.org/config_whitespace.html --> |
| 141 | + <module name="EmptyForIteratorPad"/> |
| 142 | + <module name="GenericWhitespace"/> |
| 143 | + <module name="MethodParamPad"/> |
| 144 | + <module name="NoWhitespaceAfter"/> |
| 145 | + <module name="NoWhitespaceBefore"/> |
| 146 | + <module name="OperatorWrap"/> |
| 147 | + <module name="ParenPad"/> |
| 148 | + <module name="TypecastParenPad"/> |
| 149 | + <module name="WhitespaceAfter"/> |
| 150 | + <module name="WhitespaceAround"/> |
| 151 | + |
| 152 | + <!-- Modifier Checks --> |
| 153 | + <!-- See https://checkstyle.org/config_modifier.html --> |
| 154 | + <module name="ModifierOrder"/> |
| 155 | + <module name="RedundantModifier"/> |
| 156 | + |
| 157 | + <!-- Checks for blocks. You know, those {}'s --> |
| 158 | + <!-- See https://checkstyle.org/config_blocks.html --> |
| 159 | + <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 --> |
| 166 | + <!-- See https://checkstyle.org/config_coding.html --> |
| 167 | + <module name="EmptyStatement"/> |
| 168 | + <module name="EqualsHashCode"/> |
| 169 | + <module name="HiddenField"/> |
| 170 | + <module name="IllegalInstantiation"/> |
| 171 | + <module name="InnerAssignment"/> |
| 172 | + <module name="MagicNumber"/> |
| 173 | + <module name="MissingSwitchDefault"/> |
| 174 | + <module name="MultipleVariableDeclarations"/> |
| 175 | + <module name="SimplifyBooleanExpression"/> |
| 176 | + <module name="SimplifyBooleanReturn"/> |
| 177 | + |
| 178 | + <!-- Checks for class design --> |
| 179 | + <!-- See https://checkstyle.org/config_design.html --> |
| 180 | + <module name="DesignForExtension"/> |
| 181 | + <module name="FinalClass"/> |
| 182 | + <module name="HideUtilityClassConstructor"/> |
| 183 | + <module name="InterfaceIsType"/> |
| 184 | + <module name="VisibilityModifier"/> |
| 185 | + |
| 186 | + <!-- Miscellaneous other checks. --> |
| 187 | + <!-- See https://checkstyle.org/config_misc.html --> |
| 188 | + <module name="ArrayTypeStyle"/> |
| 189 | + <module name="FinalParameters"/> |
| 190 | + <module name="TodoComment"/> |
| 191 | + <module name="UpperEll"/> |
| 192 | + |
| 193 | + <!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter --> |
| 194 | + <module name="SuppressionXpathFilter"> |
| 195 | + <property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}" |
| 196 | + default="checkstyle-xpath-suppressions.xml" /> |
| 197 | + <property name="optional" value="true"/> |
| 198 | + </module> |
| 199 | + |
| 200 | + <!-- System.out.println --> |
| 201 | + <module name="RegexpSinglelineJava"> |
| 202 | + <property name="format" value="System.out.println"/> |
| 203 | + <property name="ignoreCase" value="true"/> |
| 204 | + <property name="message" value="Do not use System.out.println" /> |
| 205 | + <property name="severity" value="error"/> |
| 206 | + </module> |
| 207 | + |
| 208 | + </module> |
| 209 | + |
| 210 | + <module name="RegexpSingleline"> |
| 211 | + <property name="format" value="whitelist"/> |
| 212 | + <property name="ignoreCase" value="true"/> |
| 213 | + <property name="message" value="Usage should be switched to an allow* based pattern" /> |
| 214 | + <property name="severity" value="ignore"/> |
| 215 | + </module> |
| 216 | + |
| 217 | + <module name="RegexpSingleline"> |
| 218 | + <property name="format" value="master"/> |
| 219 | + <property name="ignoreCase" value="true"/> |
| 220 | + <property name="message" value="Usage should be switched to cluster manager" /> |
| 221 | + <property name="severity" value="error"/> |
| 222 | + </module> |
| 223 | + |
| 224 | + <module name="RegexpSingleline"> |
| 225 | + <property name="format" value="extension"/> |
| 226 | + <property name="ignoreCase" value="true"/> |
| 227 | + <property name="message" value="Extension should only be used sparingly to keep implementations as generic as possible" /> |
| 228 | + <property name="severity" value="error"/> |
| 229 | + </module> |
| 230 | + |
| 231 | + <module name="SuppressWithPlainTextCommentFilter"> |
| 232 | + <property name="offCommentFormat" value="CS-SUPPRESS-ALL: .+"/> <!-- Require an explaination after surpressing --> |
| 233 | + <property name="onCommentFormat" value="CS-ENFORCE-ALL"/> |
| 234 | + </module> |
| 235 | + |
| 236 | + <module name="SuppressWithPlainTextCommentFilter"> |
| 237 | + <property name="offCommentFormat" value="CS-SUPPRESS-SINGLE\: ([\w\|]+) .+"/> <!-- Require an explaination after surpressing --> |
| 238 | + <property name="onCommentFormat" value="CS-ENFORCE-SINGLE()"/> |
| 239 | + <property name="checkFormat" value="$1"/> |
| 240 | + </module> |
| 241 | + |
| 242 | +</module> |
0 commit comments