candidate checkstyle.xml
This commit is contained in:
parent
7dec1dedb5
commit
bceb413241
1 changed files with 86 additions and 8 deletions
|
|
@ -1,13 +1,91 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
<!-- CheckStyle settings -->
|
||||
|
||||
<module name = "Checker">
|
||||
<module name="TreeWalker">
|
||||
<module name="UnusedImports" />
|
||||
</module>
|
||||
<!-- 1. camelCase for identifiers -->
|
||||
<module name="TreeWalker">
|
||||
<module name="LocalVariableName">
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
<module name="ParameterName">
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
<module name="ClassTypeParameterName">
|
||||
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
|
||||
</module>
|
||||
|
||||
<!-- 2. Avoid "bulk" aka. star imports in form of `import package.*` -->
|
||||
<module name="AvoidStarImport">
|
||||
<!-- We permit static member imports in the case of
|
||||
JUnit tests such that unit tests aren't too verbose
|
||||
-->
|
||||
<property name="allowStaticMemberImports" value="true" />
|
||||
</module>
|
||||
|
||||
<!-- 3. One class per file -->
|
||||
<module name="OneTopLevelClass"/>
|
||||
|
||||
<!-- 4. Max 60 lines per method -->
|
||||
<module name="MethodLength">
|
||||
<property name="max" value="60"/>
|
||||
</module>
|
||||
|
||||
<!-- 5. Indentation 4 spaces -->
|
||||
<module name="Indentation">
|
||||
<property name="basicOffset" value="4"/>
|
||||
<property name="braceAdjustment" value="0"/>
|
||||
<property name="caseIndent" value="4"/>
|
||||
<property name="lineWrappingIndentation" value="8"/>
|
||||
</module>
|
||||
|
||||
<!-- 6. No “fall-through” in switch cases -->
|
||||
<!-- info: https://checkstyle.sourceforge.io/checks/coding/fallthrough.html -->
|
||||
<module name="FallThrough" />
|
||||
|
||||
<!-- 7. Left curly brace on same line (EOL) as method name -->
|
||||
<module name="LeftCurly">
|
||||
<property name="option" value="eol"/>
|
||||
<property name="tokens"
|
||||
value="METHOD_DEF, CTOR_DEF, CLASS_DEF, LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
|
||||
</module>
|
||||
|
||||
<!-- 8. Magic numbers: disallow literal numbers (except allowed ones) -->
|
||||
<module name="MagicNumber">
|
||||
<!-- We allow -1, 0, 1 to make length checks mildly easier -->
|
||||
<property name="ignoreNumbers"
|
||||
value="-1,0,1"/>
|
||||
<property name="ignoreHashCodeMethod" value="false"/>
|
||||
<property name="ignoreAnnotation" value="true"/>
|
||||
<property name="ignoreFieldDeclaration" value="false"/>
|
||||
</module>
|
||||
|
||||
<!-- 9: Check parameter number at most 6 -->
|
||||
<module name="ParameterNumber">
|
||||
<property name="max" value="6"/>
|
||||
</module>
|
||||
|
||||
<!-- 10. Unused imports -->
|
||||
<module name="UnusedImports">
|
||||
<!-- also check Javadoc references refer to things that exist,
|
||||
where applicable. -->
|
||||
<property name="processJavadoc" value="true"/>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
<!-- 11. File tabs/spaces: require no raw tabs etc -->
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<!-- TODO: decide in your team with other checkers to add! -->
|
||||
|
||||
</module>
|
||||
Loading…
Add table
Add a link
Reference in a new issue