Add checkstyle

This commit is contained in:
Arne Keller 2020-02-28 15:25:10 +01:00
parent f274b25ae2
commit 98ee0975a3
2 changed files with 404 additions and 0 deletions

View File

@ -3,10 +3,12 @@
<component name="CheckStyle-IDEA"> <component name="CheckStyle-IDEA">
<option name="configuration"> <option name="configuration">
<map> <map>
<entry key="active-configuration" value="PROJECT_RELATIVE:$PROJECT_DIR$/requiredCheckstyleRules_Final_829.xml:Required" />
<entry key="checkstyle-version" value="8.29" /> <entry key="checkstyle-version" value="8.29" />
<entry key="copy-libs" value="false" /> <entry key="copy-libs" value="false" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" /> <entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" /> <entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="location-2" value="PROJECT_RELATIVE:$PROJECT_DIR$/requiredCheckstyleRules_Final_829.xml:Required" />
<entry key="scan-before-checkin" value="false" /> <entry key="scan-before-checkin" value="false" />
<entry key="scanscope" value="JavaOnly" /> <entry key="scanscope" value="JavaOnly" />
<entry key="suppress-errors" value="false" /> <entry key="suppress-errors" value="false" />

View File

@ -0,0 +1,402 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
<module name="Checker">
<property name="severity" value="warning" />
<!-- ######## TEMPLATE/CHECKSTYLE/SIZE.XML ######## !-->
<!-- See http://yle.sourceforge.net/config_sizes.html#FileLength !-->
<!-- Checks for long files. !-->
<module name="FileLength">
<property name="max" value="500"/>
<property name="fileExtensions" value=""/>
</module>
<!-- See http://yle.sf.net/config_sizes.html !-->
<!-- Checks for long lines. !-->
<module name="LineLength">
<property name="ignorePattern" value="^$" />
<property name="max" value="120" />
</module>
<module name="TreeWalker">
<!-- Checks the number of methods declared in each type. This includes the number of each scope !-->
<!-- (private, package, protected and public) as well as an overall total. !-->
<!-- See http://yle.sourceforge.net/config_sizes.html#MethodCount !-->
<module name="MethodCount">
<property name="maxTotal" value="100"/>
<property name="maxPrivate" value="100"/>
<property name="maxPackage" value="100"/>
<property name="maxProtected" value="100"/>
<property name="maxPublic" value="100"/>
</module>
<!-- Checks for long methods and constructors. !-->
<!-- See http://yle.sf.net/config_sizes.html !-->
<module name="MethodLength">
<property name="max" value="80"/>
<property name="countEmpty" value="true"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
</module>
<!-- Checks for the number of types declared at the outer (or root) level in a file. !-->
<!-- See http://yle.sourceforge.net/config_sizes.html#OuterTypeNumber !-->
<module name="OuterTypeNumber">
<property name="max" value="1"/>
</module>
<!-- Checks the number of parameters of a method or constructor. !-->
<!-- See http://yle.sf.net/config_sizes.html !-->
<module name="ParameterNumber">
<property name="max" value="7"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
</module>
</module>
<!-- ######## END OF TEMPLATE/CHECKSTYLE/SIZE.XML ######## !-->
<!-- ######## TEMPLATE/CHECKSTYLE/WHITESPACE.XML ######## !-->
<module name="TreeWalker">
<!-- Checks the padding of an empty for initializer. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="EmptyForInitializerPad">
<property name="option" value="nospace"/>
</module>
<!-- Checks the padding of an empty for iterator. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="EmptyForIteratorPad">
<property name="option" value="nospace"/>
</module>
<!-- Checks that the whitespace around the Generic tokens < and > is correct to the typical convention. !-->
<!-- See http://yle.sourceforge.net/config_whitespace.html#GenericWhitespace !-->
<module name="GenericWhitespace"/>
<!-- Checks the padding between the identifier of a method definition, !-->
<!-- constructor definition, method call, or constructor invocation; and the left parenthesis of the parameter list. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="MethodParamPad">
<property name="allowLineBreaks" value="false"/>
<property name="option" value="nospace"/>
<property name="tokens" value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL "/>
</module>
<!-- Checks that there is no whitespace after a token. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="NoWhitespaceAfter">
<property name="allowLineBreaks" value="true"/>
<property name="tokens" value="ARRAY_INIT, BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<!-- Checks that there is no whitespace before a token. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="NoWhitespaceBefore">
<property name="allowLineBreaks" value="false"/>
<property name="tokens" value="SEMI, POST_DEC, POST_INC"/>
</module>
<!-- Checks the policy on how to wrap lines on operators. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="OperatorWrap">
<property name="option" value="nl"/>
<property name="tokens" value="ASSIGN, BAND, BOR, BSR, BXOR, COLON, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR"/>
</module>
<!-- Checks the policy on the padding of parentheses. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="ParenPad">
<property name="option" value="nospace"/>
<property name="tokens" value="CTOR_CALL, METHOD_CALL, SUPER_CTOR_CALL"/>
</module>
<!-- Checks the policy on the padding of parentheses for typecasts. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="TypecastParenPad">
<property name="option" value="nospace"/>
<property name="tokens" value="TYPECAST, RPAREN"/>
</module>
<!-- Checks that a token is followed by whitespace. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="WhitespaceAfter">
<property name="tokens" value="COMMA, SEMI, TYPECAST"/>
</module>
<!-- Checks that a token is surrounded by whitespace. !-->
<!-- See http://yle.sf.net/config_whitespace.html !-->
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
<property name="allowEmptyConstructors" value="false"/>
<property name="allowEmptyMethods" value="false"/>
</module>
<!-- Checks that there are empty lines between methods etc. !-->
<!-- http://yle.sourceforge.net/config_whitespace.html#EmptyLineSeparator !-->
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<!-- The following are actually not whitespace but still fit here quite well. !-->
<!-- Checks that there is only one statement per line. !-->
<!-- See http://yle.sourceforge.net/config_coding.html#OneStatementPerLine !-->
<module name="OneStatementPerLine"/>
<!-- Checks that each variable declaration is in its own statement and on its own line. !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="MultipleVariableDeclarations"/>
<!-- Checks for correct indentation -->
<!-- http://yle.sourceforge.net/config_misc.html#Indentation -->
<module name="Indentation"/>
</module>
<!-- Checks that there are no tabs in the source file !-->
<!-- http://yle.sourceforge.net/config_whitespace.html#FileTabCharacter !-->
<module name="FileTabCharacter"/>
<!-- ######## END OF TEMPLATE/CHECKSTYLE/WHITESPACE.XML ######## !-->
<!-- ######## TEMPLATE/CHECKSTYLE/NAMING.XML ######## !-->
<module name="TreeWalker">
<!-- Checks that the outer type name and the file name match. !-->
<!-- See http://yle.sourceforge.net/config_misc.html#OuterTypeFilename !-->
<module name="OuterTypeFilename"/>
<!-- Checks for class type parameter name naming conventions. !-->
<!-- See http://yle.sourceforge.net/config_naming.html#ClassTypeParameterName !-->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z]$"/>
</module>
<!-- Checks for constant name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="ConstantName">
<property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
<property name="applyToPublic" value="true"/>
<property name="applyToProtected" value="true"/>
<property name="applyToPackage" value="true"/>
<property name="applyToPrivate" value="true"/>
</module>
<!-- Checks for local final variable name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="LocalFinalVariableName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
<property name="tokens" value="VARIABLE_DEF, PARAMETER_DEF"/>
</module>
<!-- Checks for local variable name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="LocalVariableName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
<!--<property name="tokens" value="VARIABLE_DEF, PARAMETER_DEF"/>-->
</module>
<!-- Checks for member variable name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="MemberName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
<property name="applyToPublic" value="true"/>
<property name="applyToProtected" value="true"/>
<property name="applyToPackage" value="true"/>
<property name="applyToPrivate" value="true"/>
</module>
<!-- Checks for method name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="MethodName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<!-- Checks for method type parameter name naming conventions. !-->
<!-- See http://yle.sourceforge.net/config_naming.html#MethodTypeParameterName !-->
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z]$"/>
</module>
<!-- Checks for package name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$"/>
</module>
<!-- Checks for parameter name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="ParameterName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<!-- Checks for static variable name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="StaticVariableName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
<property name="applyToPublic" value="true"/>
<property name="applyToProtected" value="true"/>
<property name="applyToPackage" value="true"/>
<property name="applyToPrivate" value="true"/>
</module>
<!-- Checks for type name naming conventions. !-->
<!-- See http://yle.sf.net/config_naming.html !-->
<module name="TypeName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF"/>
<property name="applyToPublic" value="true"/>
<property name="applyToProtected" value="true"/>
<property name="applyToPackage" value="true"/>
<property name="applyToPrivate" value="true"/>
</module>
</module>
<!-- ######## END OF TEMPLATE/CHECKSTYLE/NAMING.XML ######## !-->
<!-- ######## TEMPLATE/CHECKSTYLE/JAVADOC.XML ######## !-->
<module name="TreeWalker">
<!-- Validates Javadoc comments to help ensure they are well formed. !-->
<!-- See http://yle.sf.net/config_html#JavadocStyle !-->
<module name="JavadocStyle">
<property name="scope" value="private"/>
<!--
<property name="excludeScope" value=""/>
!-->
<property name="checkFirstSentence" value="false"/>
<property name="endOfSentenceFormat" value="([.?!][ \t\n\r\f&lt;])|([.?!]$)"/>
<property name="checkEmptyJavadoc" value="false"/>
<property name="checkHtml" value="true"/>
<property name="tokens" value="INTERFACE_DEF, CLASS_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<!-- Checks to ensure that the tags exist (if required) !-->
<!-- See http://yle.sf.net/config_html#JavadocMethod !-->
<module name="JavadocMethod">
<property name="scope" value="package"/>
<!--
<property name="excludeScope" value=""/>
!-->
<property name="allowMissingParamTags" value="false"/>
<property name="allowMissingReturnTag" value="false"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
</module>
<!-- Checks that variables have Javadoc comments. !-->
<!-- See http://yle.sf.net/config_html#JavadocVariable !-->
<module name="JavadocVariable">
<property name="scope" value="package"/>
<!--
<property name="excludeScope" value=""/>
!-->
</module>
<!-- Checks Javadoc comments for class and interface definitions. !-->
<!-- See http://yle.sf.net/config_html#JavadocType !-->
<module name="JavadocType">
<property name="scope" value="private"/>
<!--
<property name="excludeScope" value=""/>
!-->
<property name="authorFormat" value=""/>
<property name="versionFormat" value=""/>
<property name="allowMissingParamTags" value="false"/>
<property name="allowUnknownTags" value="false"/>
<property name="tokens" value="INTERFACE_DEF, CLASS_DEF"/>
</module>
</module>
<!-- ######## END OF TEMPLATE/CHECKSTYLE/JAVADOC.XML ######## !-->
<!-- ######## TEMPLATE/CHECKSTYLE/OTHERS.XML ######## !-->
<module name="TreeWalker">
<!-- Checks that the order of conforms to the suggestions in the Java Language specification, !-->
<!-- sections 8.1.1, 8.3.1 and 8.4.3. !-->
<!-- See http://yle.sf.net/config_.html !-->
<module name="ModifierOrder"/>
<!-- Checks that there are no redundant . !-->
<!-- See http://yle.sf.net/config_.html !-->
<module name="RedundantModifier">
<property name="tokens" value="METHOD_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF"/>
</module>
<!-- Checks that a class which has only private constructors is declared as final. !-->
<!-- See http://yle.sf.net/config_html !-->
<module name="FinalClass"/>
<!-- Check nested (internal) classes/interfaces are declared at the bottom of the class after all method and field declarations. !-->
<!-- See http://yle.sourceforge.net/config_html#InnerTypeLast !-->
<module name="InnerTypeLast"/>
<!-- Implements Bloch, Effective Java, Item 17 - Use Interfaces only to define types. !-->
<!-- See http://yle.sf.net/config_html !-->
<module name="InterfaceIsType">
<property name="allowMarkerInterfaces" value="false"/>
</module>
<!-- Restricts throws statements to a specified count. !-->
<!-- See http://yle.sf.net/config_html !-->
<module name="ThrowsCount">
<property name="max" value="2"/>
</module>
<!-- Checks that classes that define a covariant equals() method also override method equals(java.lang.Object). !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="CovariantEquals"/>
<!-- Checks declaration order according to Code Conventions for the Java Programming Language. !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="DeclarationOrder">
<property name="ignoreConstructors" value="false"/>
<property name="ignoreModifiers" value="false"/>
</module>
<!-- Check that the default is after all the cases in a switch statement. !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="DefaultComesLast"/>
<!-- Detects empty statements (standalone ;). !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="EmptyStatement"/>
<!-- Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException is almost never acceptable. !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="IllegalCatch">
<property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException"/>
</module>
<!-- This check can be used to ensure that types are not declared to be thrown. !-->
<!-- Declaring to throw java.lang.Error or java.lang.RuntimeException is almost never acceptable. !-->
<!-- See http://yle.sourceforge.net/config_coding.html#IllegalThrows !-->
<module name="IllegalThrows">
<property name="illegalClassNames" value="java.lang.Throwable, java.lang.Error, java.lang.RuntimeException"/>
</module>
<!-- Checks for assignments in subexpressions, such as in String s = Integer.toString(i = 2);. !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="InnerAssignment">
<property name="tokens" value="ASSIGN, BAND_ASSIGN, BOR_ASSIGN, BSR_ASSIGN, BXOR_ASSIGN, DIV_ASSIGN, MINUS_ASSIGN, MOD_ASSIGN, PLUS_ASSIGN, SL_ASSIGN, SR_ASSIGN, STAR_ASSIGN"/>
</module>
<!-- Checks that switch statement has "default" clause. !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="MissingSwitchDefault"/>
<!-- Check for ensuring that for loop control variables are not modified inside the for block. !-->
<!-- See http://yle.sourceforge.net/config_coding.html#ModifiedControlVariable !-->
<module name="ModifiedControlVariable"/>
<!-- Disallow assignment of parameters. !-->
<!-- See http://yle.sf.net/config_coding.html !-->
<module name="ParameterAssignment"/>
<!-- this got moved here from the import !-->
<!-- Checks for unused import statements. !-->
<!-- See http://yle.sf.net/config_import.html !-->
<module name="UnusedImports"/>
</module>
<!-- ######## END OF TEMPLATE/CHECKSTYLE/OTHERS.XML ######## !-->
</module>