Merged branch release/1.0.0 into master

This commit is contained in:
Paul Campbell 2016-09-11 15:00:07 +01:00
commit 4528c6674d
4 changed files with 324 additions and 202 deletions

View file

@ -5,3 +5,24 @@ CHANGELOG
------
* Initial Release
1.0.0
------
* LineLength: allow lines up to 120 characters
* AtclauseOrder: use order forced by IntelliJ
* JavadocMethod: now required on protected and package methods
* JavadocType: require @author tag in name (email) format
* JavaNCSS: restrict limits another 20%
* MethodLength: reduced to max 40 lines
* ModifiedControlVariable: don't apply to enhanced for loops
* NestedTryDepth: prevent any nesting of try blocks
* NoWhiteSpaceAfter: prevent dot separator (.) from being the last character on line
* NPathComplexity: reduce to 5 to match CyclomaticComplexity
* PackageName: restrict to lowercase letters and numbers
* ParameterNumber: don't apply to @Overridden methods
* EitherLogOrThrow: support java.util.logging.Logger
* TodoComment: only match against comments
* IllegalType: recognise more classes from Collections
* Remove checks: RedundantImport, ForbidThrowAnonymousExceptions, AvoidConditionInversionCheck and FinalLocalVariable
* Added checks: AvoidInlineConditionals, EqualsAvoidNull, FinalLocalVariable, Header, IllegalToken, InterfaceTypeParameterName, MethodTypeParameterName, NoFinalizer, NoLineWrap, PackageAnnotation, RequireThis, SuppressWarnings, Translation, UncommentedMain and UniqueProperties

379
README.md
View file

@ -30,9 +30,10 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
<properties>
<checkstyle.version>7.0</checkstyle.version>
<sevntu-checkstyle-maven-plugin.version>1.21.0</sevntu-checkstyle-maven-plugin.version>
<kemitix-checkstyle-ruleset.version>1.0.0</kemitix-checkstyle-ruleset.version>
<kemitix-checkstyle-ruleset.version>0.1.1</kemitix-checkstyle-ruleset.version>
</properties>
<plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
@ -52,8 +53,29 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
<artifactId>kemitix-checkstyle-ruleset</artifactId>
<version>${kemitix-checkstyle-ruleset.version}</version>
</dependency>
<configuration>
<configLocation>net/kemitix/checkstyle.xml</configLocation>
</configuration>
</dependencies>
</plugin><!-- maven-checkstyle-plugin -->
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin><!-- maven-checkstyle-plugin -->
</plugins>
````
## All Checks
@ -71,7 +93,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [AvoidDefaultSerializableInInnerClasses](#avoiddefaultserializableininnerclasses) - sevntu - disabled
* [AvoidEscapedUnicodeCharacters](#avoidescapedunicodecharacters) - checkstyle - enabled
* [AvoidHidingCauseException](#avoidhidingcauseexception) - sevntu - enabled
* [AvoidInlineConditionals](#avoidinlineconditionals) - checkstyle - disabled
* [AvoidInlineConditionals](#avoidinlineconditionals) - checkstyle - enabled
* [AvoidModifiersForTypes](#avoidmodifiersfortypes) - sevntu - disabled
* [AvoidNestedBlocks](#avoidnestedblocks) - checkstyle - enabled
* [AvoidNotShortCircuitOperatorsForBoolean](#avoidnotshortcircuitoperatorsforboolean) - sevntu - enabled
@ -86,9 +108,9 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [ClassTypeParameterName](#classtypeparametername) - checkstyle - enabled
* [CommentsIndentation](#commentsindentation) - checkstyle - enabled
* [ConfusingCondition](#confusingcondition) - sevntu - enabled
* [ConstantName](#constantname) - checkstyle - enabled
* [ConstantName](#constantname) - checkstyle - enabled - insuppressible
* [ConstructorWithoutParams](#constructorwithoutparams) - sevntu - enabled
* [CovariantEquals](#covariantequals) - checkstyle - enabled
* [CovariantEquals](#covariantequals) - checkstyle - enabled - insuppressible
* [CustomDeclarationOrder](#customdeclarationorder) - sevntu - disabled
* [CyclomaticComplexity](#cyclomaticcomplexity) - checkstyle - enabled
* [DeclarationOrder](#declarationorder) - checkstyle - enabled
@ -104,8 +126,8 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [EmptyPublicCtorInClass](#emptypublicctorinclass) - sevntu - disabled
* [EmptyStatement](#emptystatement) - checkstyle - enabled
* [EnumValueName](#enumvaluename) - sevntu - enabled
* [EqualsAvoidNull](#equalsavoidnull) - checkstyle - disabled
* [EqualsHashCode](#equalshashcode) - checkstyle - enabled
* [EqualsAvoidNull](#equalsavoidnull) - checkstyle - enabled
* [EqualsHashCode](#equalshashcode) - checkstyle - enabled - insuppressible
* [ExecutableStatementCount](#executablestatementcount) - checkstyle - enabled
* [ExplicitInitialization](#explicitinitialization) - checkstyle - enabled
* [FallThrough](#fallthrough) - checkstyle - enabled
@ -120,7 +142,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [ForbidCertainImports](#forbidcertainimports) - sevntu - disabled
* [ForbidInstantiation](#forbidinstantiation) - sevntu - disabled
* [ForbidReturnInFinallyBlock](#forbidreturninfinallyblock) - sevntu - enabled
* [ForbidThrowAnonymousExceptions](#forbidthrowanonymousexceptions) - sevntu - enabled
* [ForbidThrowAnonymousExceptions](#forbidthrowanonymousexceptions) - sevntu - disabled
* [ForbidWildcardAsReturnType](#forbidwildcardasreturntype) - sevntu - enabled
* [GenericWhitespace](#genericwhitespace) - checkstyle - enabled
* [Header](#header) - checkstyle - disabled
@ -132,7 +154,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [IllegalImport](#illegalimport) - checkstyle - enabled
* [IllegalInstantiation](#illegalinstantiation) - checkstyle - disabled
* [IllegalThrows](#illegalthrows) - checkstyle - enabled
* [IllegalToken](#illegaltoken) - checkstyle - disabled
* [IllegalToken](#illegaltoken) - checkstyle - enabled
* [IllegalTokenText](#illegaltokentext) - checkstyle - disabled
* [IllegalType](#illegaltype) - checkstyle - enabled
* [ImportControl](#importcontrol) - checkstyle - disabled
@ -142,7 +164,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [InnerClass](#innerclass) - sevntu - disabled
* [InnerTypeLast](#innertypelast) - checkstyle - enabled
* [InterfaceIsType](#interfaceistype) - checkstyle - enabled
* [InterfaceTypeParameterName](#interfacetypeparametername) - checkstyle - disabled
* [InterfaceTypeParameterName](#interfacetypeparametername) - checkstyle - enabled
* [InterfaceTypeParameterName](#interfacetypeparametername-1) - sevntu - disabled
* [JavadocMethod](#javadocmethod) - checkstyle - enabled
* [JavadocPackage](#javadocpackage) - checkstyle - enabled
@ -165,7 +187,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [MethodLength](#methodlength) - checkstyle - enabled
* [MethodName](#methodname) - checkstyle - enabled
* [MethodParamPad](#methodparampad) - checkstyle - enabled
* [MethodTypeParameterName](#methodtypeparametername) - checkstyle - disabled
* [MethodTypeParameterName](#methodtypeparametername) - checkstyle - enabled
* [MissingCtor](#missingctor) - checkstyle - disabled
* [MissingDeprecated](#missingdeprecated) - checkstyle - enabled
* [MissingOverride](#missingoverride) - checkstyle - disabled
@ -184,9 +206,9 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [NestedSwitch](#nestedswitch) - sevntu - enabled
* [NestedTryDepth](#nestedtrydepth) - checkstyle - enabled
* [NewlineAtEndOfFile](#newlineatendoffile) - checkstyle - enabled
* [NoClone](#noclone) - checkstyle - enabled
* [NoFinalizer](#nofinalizer) - checkstyle - disabled
* [NoLineWrap](#nolinewrap) - checkstyle - disabled
* [NoClone](#noclone) - checkstyle - enabled - insuppressible
* [NoFinalizer](#nofinalizer) - checkstyle - enabled
* [NoLineWrap](#nolinewrap) - checkstyle - enabled
* [NoMainMethodInAbstractClass](#nomainmethodinabstractclass) - sevntu - enabled
* [NonEmptyAtclauseDescription](#nonemptyatclausedescription) - checkstyle - enabled
* [NoWhitespaceAfter](#nowhitespaceafter) - checkstyle - enabled
@ -194,21 +216,21 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [NPathComplexity](#npathcomplexity) - checkstyle - enabled
* [NumericLiteralNeedsUnderscore](#numericliteralneedsunderscore) - sevntu - enabled
* [OneStatementPerLine](#onestatementperline) - checkstyle - enabled
* [OneTopLevelClass](#onetoplevelclass) - checkstyle - enabled
* [OneTopLevelClass](#onetoplevelclass) - checkstyle - enabled - insuppressible
* [OperatorWrap](#operatorwrap) - checkstyle - enabled
* [OuterTypeFilename](#outertypefilename) - checkstyle - enabled
* [OuterTypeFilename](#outertypefilename) - checkstyle - enabled - insuppressible
* [OuterTypeNumber](#outertypenumber) - checkstyle - disabled
* [OverloadMethodsDeclarationOrder](#overloadmethodsdeclarationorder) - checkstyle - enabled
* [OverridableMethodInConstructor](#overridablemethodinconstructor) - sevntu - enabled
* [PackageAnnotation](#packageannotation) - checkstyle - disabled
* [PackageDeclaration](#packagedeclaration) - checkstyle - enabled
* [PackageAnnotation](#packageannotation) - checkstyle - enabled
* [PackageDeclaration](#packagedeclaration) - checkstyle - enabled - insuppressible
* [PackageName](#packagename) - checkstyle - enabled
* [ParameterAssignment](#parameterassignment) - checkstyle - disabled
* [ParameterName](#parametername) - checkstyle - enabled
* [ParameterNumber](#parameternumber) - checkstyle - enabled
* [ParenPad](#parenpad) - checkstyle - enabled
* [PublicReferenceToPrivateType](#publicreferencetoprivatetype) - sevntu - enabled
* [RedundantImport](#redundantimport) - checkstyle - enabled
* [RedundantImport](#redundantimport) - checkstyle - disabled
* [RedundantModifier](#redundantmodifier) - checkstyle - enabled
* [RedundantReturn](#redundantreturn) - sevntu - enabled
* [Regexp](#regexp) - checkstyle - disabled
@ -218,7 +240,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [RegexpSingleline](#regexpsingleline) - checkstyle - disabled
* [RegexpSinglelineJava](#regexpsinglelinejava) - checkstyle - disabled
* [RequiredParameterForAnnotation](#requiredparameterforannotation) - sevntu - disabled
* [RequireThis](#requirethis) - checkstyle - disabled
* [RequireThis](#requirethis) - checkstyle - enabled
* [ReturnBooleanFromTernary](#returnbooleanfromternary) - sevntu - enabled
* [ReturnCount](#returncount) - checkstyle - enabled
* [ReturnCountExtended](#returncountextended) - sevntu - disabled
@ -237,18 +259,18 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [SummaryJavadoc](#summaryjavadoc) - checkstyle - disabled
* [SuperClone](#superclone) - checkstyle - disabled
* [SuperFinalize](#superfinalize) - checkstyle - disabled
* [SuppressWarnings](#suppresswarnings) - checkstyle - enabled
* [SuppressWarningsHolder](#suppresswarningsholder) - checkstyle - enabled
* [SuppressWarnings](#suppresswarnings) - checkstyle - disabled
* [TernaryPerExpressionCount](#ternaryperexpressioncount) - sevntu - enabled
* [ThrowsCount](#throwscount) - checkstyle - enabled
* [TodoComment](#todocomment) - checkstyle - enabled
* [TrailingComment](#trailingcomment) - checkstyle - enabled
* [Translation](#translation) - checkstyle - disabled
* [Translation](#translation) - checkstyle - enabled
* [TypecastParenPad](#typecastparenpad) - checkstyle - enabled
* [TypeName](#typename) - checkstyle - enabled
* [UncommentedMain](#uncommentedmain) - checkstyle - disabled
* [TypeName](#typename) - checkstyle - enabled - insuppressible
* [UncommentedMain](#uncommentedmain) - checkstyle - enabled
* [UniformEnumConstantName](#uniformenumconstantname) - sevntu - enabled
* [UniqueProperties](#uniqueproperties) - checkstyle - disabled
* [UniqueProperties](#uniqueproperties) - checkstyle - enabled
* [UnnecessaryParentheses](#unnecessaryparentheses) - checkstyle - enabled
* [UnnecessaryParenthesesExtended](#unnecessaryparenthesesextended) - sevntu - disabled
* [UnusedImports](#unusedimports) - checkstyle - enabled
@ -256,7 +278,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty
* [UselessSingleCatch](#uselesssinglecatch) - sevntu - enabled
* [UselessSuperCtorCall](#uselesssuperctorcall) - sevntu - enabled
* [VariableDeclarationUsageDistance](#variabledeclarationusagedistance) - checkstyle - enabled
* [VisibilityModifier](#visibilitymodifier) - checkstyle - enabled
* [VisibilityModifier](#visibilitymodifier) - checkstyle - enabled - insuppressible
* [WhitespaceAfter](#whitespaceafter) - checkstyle - enabled
* [WhitespaceAround](#whitespacearound) - checkstyle - enabled
* [WhitespaceBeforeArrayInitializer](#whitespacebeforearrayinitializer) - sevntu - disabled
@ -272,9 +294,7 @@ Rules are listed in alphabetical order.
#### [AbbreviationAsWordInName](http://checkstyle.sourceforge.net/config_naming.html#AbbreviationAsWordInName)
Enforces proper `CamelCase` and avoids sequences of consecutive uppercase characters in identifiers. Does not apply to final or static variables, or @Overridden methods.
> TODO: enable for final and static variables.
Enforces proper `CamelCase` and avoids sequences of consecutive uppercase characters in identifiers. Does not apply to @Overridden methods.
Valid:
````
@ -364,17 +384,17 @@ Javadoc `@` clauses must be in the order:
````
/**
*
* @param ...
* @author ...
* @version ...
* @param ...
* @serial ...
* @return ...
* @throws ...
* @exception ...
* @serialData ...
* @serialField ...
* @see ...
* @since ...
* @serial ...
* @serialField ...
* @serialData ...
* @deprecated ...
*/
````
@ -394,6 +414,10 @@ Invalid:
String unitAbbrev = "\u03bcs";
````
#### [AvoidInlineConditionals](http://checkstyle.sourceforge.net/config_coding.html#AvoidInlineConditionals)
Prevents use of the `?:` operators.
#### [AvoidNestedBlocks](http://checkstyle.sourceforge.net/config_blocks.html#AvoidNestedBlocks)
Avoid unnecessary blocks.
@ -594,6 +618,8 @@ public void foo11() {
#### [ConstantName](http://checkstyle.sourceforge.net/config_naming.html#ConstantName)
> This check cannot be suppressed.
Requires constants (static, final fields) to be all uppercase. Numbers and numbers are permitted but not as the first character.
Valid:
@ -609,6 +635,8 @@ private static final int 12_CARD = 12;
#### [CovariantEquals](http://checkstyle.sourceforge.net/config_coding.html#CovariantEquals)
> This check cannot be suppressed.
Checks that classes which define a covariant equals() method also override method equals(Object).
Valid:
@ -894,8 +922,26 @@ Invalid:
doSomething();;
````
#### [EqualsAvoidNull](http://checkstyle.sourceforge.net/config_coding.html#EqualsAvoidNull)
Checks that string literals are on the left side in an `equals()` comparison.
Valid:
````
String nullString = null;
"value".equals(nullString);
````
Invalid:
````
String nullString = null;
nullString.equals("value");
````
#### [EqualsHashCode](http://checkstyle.sourceforge.net/config_coding.html#EqualsHashCode)
> This check cannot be suppressed.
Checks that when a class overrides the `equals()` method, that it also overrides the `hashCode()` method.
#### [ExecutableStatementCount](http://checkstyle.sourceforge.net/config_sizes.html#ExecutableStatementCount)
@ -1027,6 +1073,10 @@ List<T> list = ImmutableList.Builder<T>::new;
sort(list, Comparable::<String>compareTo);
````
#### [Header](http://checkstyle.sourceforge.net/config_header.html#Header)
Checks that all `*.java` source files begin with the contents of the `LICENSE.txt` file.
#### [HiddenField](http://checkstyle.sourceforge.net/config_coding.html#HiddenField)
Checks that a local variable or parameter in a method doesn't have the same name as a field. Doesn't apply in constructors or setters.
@ -1143,18 +1193,29 @@ Invalid:
throw new RuntimeException("boom!");
````
#### [IllegalToken](http://checkstyle.sourceforge.net/config_coding.html#IllegalToken)
Checks that labels are not used.
#### [IllegalType](http://checkstyle.sourceforge.net/config_coding.html#IllegalType)
Prevents variables, parameters and method returns from being one of the following:
Prevents use of implementation classes as variables, parameters or method returns. Use the interfaces instead.
* java.util.HashSet
Prevents variables, parameters and method returns from being any of the following:
* java.util.ArrayDeque
* java.util.ArrayList
* java.util.EnumMap
* java.util.EnumSet
* java.util.HashMap
* java.util.HashSet
* java.util.IdentityHashMap
* java.util.LinkedHashMap
* java.util.LinkedHashSet
* java.util.TreeSet
* java.util.LinkedList
* java.util.PriorityQueue
* java.util.TreeMap
> TODO: add more classes from Collections
* java.util.TreeSet
Valid:
````
@ -1207,15 +1268,23 @@ interface Foo {
}
````
#### [InterfaceTypeParameterName](http://checkstyle.sourceforge.net/config_naming.html#InterfaceTypeParameterName)
Checks that the type parameters for an interface are a single uppercase letter.
Valid:
````
interface <T> Portable {}
````
Invalid:
````
interface <Type> Portable {}
````
#### [JavadocMethod](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocMethod)
Checks that all public methods have a Javadoc block.
> TODO: scope = private (reset to default) - will require lots of new javadoc blocks
> TODO: validateThrows = true
> TODO: allowMissingPropertyJavadoc = true
Checks that all public, protected and package methods have a Javadoc block, that all `@throws` tags are used. Basic setters and getters do not require javadoc.
#### [JavadocPackage](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocPackage)
@ -1231,22 +1300,14 @@ Checks the formatting of the Javadoc blocks. See the official [Checkstyle docume
#### [JavadocType](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocType)
Checks the format for Javadoc for classes and enums. Javadoc must be present, not have any unknown tags and not missing any `@param` tags.
> TODO: authorFormat = "^.+ (\S+@[\S.]+)$" - name followed by email in brackets
Checks the format for Javadoc for classes and enums. Javadoc must be present, not have any unknown tags and not missing any `@param` tags. The `@author` tag must have a name and, in brackets, an email address.
#### [JavaNCSS](http://checkstyle.sourceforge.net/config_metrics.html#JavaNCSS)
Restricts the NCSS score for methods, classes and files to 50, 1500 and 2000 respectively. The NCSS score is a measure of the number of statements within a scope.
Restricts the NCSS score for methods, classes and files to 40, 1200 and 1600 respectively. The NCSS score is a measure of the number of statements within a scope.
Too high an NCSS score suggests that the method or class is doing too much and should be decomposed into smaller units.
> TODO: methodMaximum = 40 - reduce by 20%
> TODO: classMaximum = 1200
> TODO: fileMaximum = 1600
#### [LeftCurly](http://checkstyle.sourceforge.net/config_blocks.html#LeftCurly)
Checks that the left curly brace ('{') is placed at the end of the line. Does not check enums.
@ -1267,12 +1328,10 @@ class Bar
#### [LineLength](http://checkstyle.sourceforge.net/config_sizes.html#LineLength)
Limits the line length to 80 characters.
Limits the line length to 120 characters.
Doesn't check package or import lines.
> TODO: ignorePattern = "^\s\\* .+" exclude javadoc blocks
#### [LocalFinalVariableName](http://checkstyle.sourceforge.net/config_naming.html#LocalFinalVariableName)
Checks the format of local, `final` variable names, including `catch` parameters.
@ -1316,8 +1375,6 @@ Restricts the number of methods in a type to 30.
Restricts the number of lines in a method to 60. Include blank lines and single line comments. You should be able to see an entire method without needing to scroll.
> TODO: max = 40
#### [MethodName](http://checkstyle.sourceforge.net/config_naming.html#MethodName)
Checks the format of method names.
@ -1341,6 +1398,22 @@ void getValue
();
````
#### [MethodTypeParameterName](http://checkstyle.sourceforge.net/config_naming.html#MethodTypeParameterName)
Restricts method generics parameters to be a single uppercase letter.
Valid:
````
List<A> getItems() {}
````
Invalid:
````
List<a> getItems() {}
List<BB> getItems() {}
List<C3> getItems() {}
````
#### [MissingDeprecated](http://checkstyle.sourceforge.net/config_annotation.html#MissingDeprecated)
Both the `@Deprecated` annotation and the Javadoc tag `@deprecated` must be used in pairs.
@ -1413,8 +1486,6 @@ for (int i = 0; i < 1; i++) {
}
````
> TODO: skipEnhancesForLoopVariable = true
#### [ModifierOrder](http://checkstyle.sourceforge.net/config_modifier.html#ModifierOrder)
Check that modifiers are in the following order:
@ -1551,19 +1622,17 @@ if (isValid()) { // depth 0
#### [NestedTryDepth](http://checkstyle.sourceforge.net/config_coding.html#NestedTryDepth)
Checks that `try` blocks are not nested more than 1 deep.
Checks that `try` blocks are not nested.
Valid:
````
try {
doSomething();
try {
doSomeOtherThing();
} catch (OtherExceptions oe) {
// handle it
}
} catch (SomeException se) {
// handle it
} catch (OtherExceptions oe) {
// handle it
}
````
@ -1581,18 +1650,28 @@ try {
}
````
> TODO: max = 0 - don't nest try blocks
#### [NewlineAtEndOfFile](http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile)
Checks that files end with a line-feed character, (i.e. unix-style line ending).
#### [NoClone](http://checkstyle.sourceforge.net/config_coding.html#NoClone)
> This check cannot be suppressed.
Checks that the `clone()` method from `Object` has not been overridden. Use a copy constructor, or better yet, a static factory method.
> See [Effective Java], 2nd Edition by Josh Bloch: Item 11: Override clone judiciously.
#### [NoFinalizer](http://checkstyle.sourceforge.net/config_coding.html#NoFinalizer)
Checks that the `finalize()` method from `Object` has not been overridden.
> See [Effective Java], 2nd Edition by Josh Bloch: Item 7: Avoid finalizers.
#### [NoLineWrap](http://checkstyle.sourceforge.net/config_whitespace.html#NoLineWrap)
Prevents wrapping of `package` and `import` statements.
#### [NonEmptyAtclauseDescription](http://checkstyle.sourceforge.net/config_javadoc.html#NonEmptyAtclauseDescription)
Checks that the Javadoc clauses `@param`, `@return`, `@throws` and `@deprecated` all have descriptions.
@ -1647,8 +1726,6 @@ int[ ] a;
int d = a[ 2];
````
> TODO: tokens = DOT & allowLineBreaks = false
#### [NoWhitespaceBefore](http://checkstyle.sourceforge.net/config_whitespace.html#NoWhitespaceBefore)
Checks that there is no whitespace before the comma operator (','), statement terminator (';'), postfix increment ('++') or postfix decrement ('--').
@ -1671,9 +1748,7 @@ i --;
#### [NPathComplexity](http://checkstyle.sourceforge.net/config_metrics.html#NPathComplexity)
Checks that the NPATH score (number of paths) through a method is no more than 200. This is similar to [Cyclomatic Complexity](#cyclomaticcomplexity).
> TODO: max = 5 - same as cyclomatic complexity
Checks that the NPATH score (number of paths) through a method is no more than 5. This is similar to [Cyclomatic Complexity](#cyclomaticcomplexity).
#### [OneStatementPerLine](http://checkstyle.sourceforge.net/config_coding.html#OneStatementPerLine)
@ -1692,6 +1767,8 @@ doSomething(); doSomethingElse();
#### [OneTopLevelClass](http://checkstyle.sourceforge.net/config_design.html#OneTopLevelClass)
> This check cannot be suppressed.
Checks that each source file contains only one top-level class, interface or enum.
#### [OperatorWrap](http://checkstyle.sourceforge.net/config_whitespace.html#OperatorWrap)
@ -1712,23 +1789,29 @@ int answer = getTheAnswerToLife() + getTheAnswerToTheUniverse() +
#### [OuterTypeFilename](http://checkstyle.sourceforge.net/config_misc.html#OuterTypeFilename)
> This check cannot be suppressed.
Checks that the source filename matches the name of the top-level class. e.g. `class Foo {}` is in file `Foo.java`.
#### [OverloadMethodsDeclarationOrder](http://checkstyle.sourceforge.net/config_coding.html#OverloadMethodsDeclarationOrder)
Checks that overload methods are grouped together in the source file.
#### [PackageAnnotation](http://checkstyle.sourceforge.net/config_annotation.html#PackageAnnotation)
Checks that package level annotations are in the `package-info.java` file.
#### [PackageDeclaration](http://checkstyle.sourceforge.net/config_coding.html#PackageDeclaration)
> This check cannot be suppressed.
Checks that the class has a `package` definition.
#### [PackageName](http://checkstyle.sourceforge.net/config_naming.html#PackageName)
Checks the format of package names.
Checks the format of package names. Only lowercase letters, no initial numbers or any underscores.
Identifiers must match `^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$`.
> TODO: format = `^[a-z]+(\.[a-z]+)*$` - only lowercase letters, no numbers or underscores
Identifiers must match `^[a-z]+(\.[a-z][a-z0-9]+)*$`.
#### [ParameterName](http://checkstyle.sourceforge.net/config_naming.html#ParameterName)
@ -1738,9 +1821,7 @@ Identifiers must match `^[a-z][a-zA-Z0-9]*$`.
#### [ParameterNumber](http://checkstyle.sourceforge.net/config_sizes.html#ParameterNumber)
Restricts the number of parameters in a method or constructor to 7.
> TODO: ignoreOverriddenMethods = true
Restricts the number of parameters in a method or constructor to 7. Overridden methods are not checked as there may be no access to change the super method.
#### [ParenPad](http://checkstyle.sourceforge.net/config_whitespace.html#ParenPad)
@ -1759,12 +1840,6 @@ doSomethingElse( 5);
doSomethingElse(5 );
````
#### [RedundantImport](http://checkstyle.sourceforge.net/config_imports.html#RedundantImport)
Checks for redundant `import`s. Checks for duplicates, imports from the `java.lang` package or from the current package.
> TODO: remove - [UnusedImports](#unusedimports) performs all the same checks and more
#### [RedundantModifier](http://checkstyle.sourceforge.net/config_modifier.html#RedundantModifier)
Checks for redundant modifiers. Checks for:
@ -1775,6 +1850,10 @@ Checks for redundant modifiers. Checks for:
* Class constructors.
* Nested enum definitions that are declared as static.
#### [RequireThis](http://checkstyle.sourceforge.net/config_coding.html#RequireThis)
Checks that references to instance fields where a parameter name overlaps are qualified by `this.`.
#### [ReturnCount](http://checkstyle.sourceforge.net/config_coding.html#ReturnCount)
Restricts methods to have at most 2 `return` statements in non-void methods, and at most 1 in void methods.
@ -1958,6 +2037,20 @@ Invalid:
if (x == "something") {}
````
#### [SuppressWarnings](http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarnings)
Prevents the use of `@SuppressWarnings` for the following checks:
* [ConstantName](#constantname)
* [CovariantEquals](#covariantequals)
* [EqualsHashCode](#equalshashcode)
* [NoClone](#noclone)
* [OneTopLevelClass](#onetoplevelclass)
* [OuterTypeFilename](#outertypefilename)
* [PackageDeclaration](#packagedeclaration)
* [TypeName](#typename)
* [VisibilityModifier](#visibilitymodifier)
#### [SuppressWarningsHolder](http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarningsHolder)
Used by Checkstyle to hold the checks to be suppressed from `@SuppressWarnings(...)` annotations.
@ -1985,8 +2078,6 @@ void doSomething() throws IllegalStateException,
Checks for remaining `TODO` and `FIXME` comments left in code. Their presence indicates that the program isn't finished yet.
> TODO: format = "(//\*).*((TODO)|(FIXME))" - only where in comments
#### [TrailingComment](http://checkstyle.sourceforge.net/config_misc.html#TrailingComment)
Checks for comments at the end of lines.
@ -2015,6 +2106,10 @@ int[] a = new int[2](
);
````
#### [Translation](http://checkstyle.sourceforge.net/config_misc.html#Translation)
Checks that all `messages*.properties` files all have the same set of keys.
#### [TypecastParenPad](http://checkstyle.sourceforge.net/config_whitespace.html#TypecastParenPad)
Checks that there are no spaces within the typecasting parentheses.
@ -2033,10 +2128,20 @@ String s = ( String ) list.get(2);
#### [TypeName](http://checkstyle.sourceforge.net/config_naming.html#TypeName)
> This check cannot be suppressed.
Checks the format of `class`, `interface`, `enum` identifiers, including annotations.
Identifiers must match `^[A-Z][a-zA-Z0-9]*$`.
#### [UncommentedMain](http://checkstyle.sourceforge.net/config_misc.html#UncommentedMain)
Checks for `public static void main()` methods that may have been left over from testing. Allowed in classes whose names end in `Main` or `Application`.
#### [UniqueProperties](http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties)
Checks `*.properties` files for duplicate property keys.
#### [UnnecessaryParentheses](http://checkstyle.sourceforge.net/config_coding.html#UnnecessaryParentheses)
Checks for the use of unnecessary parentheses.
@ -2085,6 +2190,8 @@ See the official [Checkstyle documentation](http://checkstyle.sourceforge.net/co
#### [VisibilityModifier](http://checkstyle.sourceforge.net/config_design.html#VisibilityModifier)
> This check cannot be suppressed.
Checks the visibility of class members to help enforce encapsulation. Only `static final` fields, immutable (see list below) fields or field with special annotation (see list below), may be public.
The following are considered immutable when `final`, and can be `public`:
@ -2273,7 +2380,7 @@ Map<Long, String> idTable = new HashMap<Long, String>();
Checks that when an exception is caught, that if it is logged then it is not also re-thrown. Log or throw; one or the other or neither, but not both.
> TODO: loggingMethodNames: add 'log'
Accepts `java.util.logging.Logger` and `org.slf4j.Logger`.
#### [EnumValueName](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/naming/EnumValueNameCheck.html)
@ -2313,7 +2420,7 @@ enum InvalidClassLike {
private String name;
ValidClassLike(String name) {
InvalidClassLike(String name) {
this.name = name;
}
}
@ -2352,10 +2459,6 @@ try {
}
````
#### [ForbidThrowAnonymousExceptions](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.html)
TODO: remove - [IllegalThrows](#illegalthrows) performs a similar check.
#### [ForbidWildcardAsReturnType](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.html)
Prevents declaring a method from returning a wildcard type as its return value.
@ -2633,34 +2736,16 @@ These checks are not enabled. Notes are included for each explaining why.
Couldn't get my IDE's (IntelliJ) code style to match.
#### [AvoidInlineConditionals](http://checkstyle.sourceforge.net/config_coding.html#AvoidInlineConditionals)
> TODO: enable
#### [EqualsAvoidNull](http://checkstyle.sourceforge.net/config_coding.html#EqualsAvoidNull)
> TODO: enable
#### [FinalLocalVariable](http://checkstyle.sourceforge.net/config_coding.html#FinalLocalVariable)
> TODO: enable
Doesn't recognise Lombok's `val` as being `final`.
#### [Header](http://checkstyle.sourceforge.net/config_header.html#Header)
> TODO: enable
> TODO: headerFile = LICENSE.txt
> TODO: fileExtensions = java
Checks that local variables are `final` if they are never modified after declaration.
#### [IllegalInstantiation](http://checkstyle.sourceforge.net/config_coding.html#IllegalInstantiation)
Not really suitable for a template ruleset as it requires an explicit list of classes to apply to.
#### [IllegalToken](http://checkstyle.sourceforge.net/config_coding.html#IllegalToken)
> TODO: enable
#### [IllegalTokenText](http://checkstyle.sourceforge.net/config_coding.html#IllegalTokenText)
Generic rule; doesn't embody a 'quality' check.
@ -2677,10 +2762,6 @@ Generic rule; doesn't embody a 'quality' check.
Couldn't get my IDE's (IntelliJ) code style to match.
#### [InterfaceTypeParameterName](http://checkstyle.sourceforge.net/config_naming.html#InterfaceTypeParameterName)
> TODO: enable
#### [JavadocTagContinuationIndentation](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocTagContinuationIndentation)
Couldn't get my IDE's (IntelliJ) code style to match.
@ -2689,37 +2770,27 @@ Couldn't get my IDE's (IntelliJ) code style to match.
Member variables should usually be named such that it is clear what they are. Comments for clarification should be the exception.
#### [MethodTypeParameterName](http://checkstyle.sourceforge.net/config_naming.html#MethodTypeParameterName)
> TODO: enable
#### [MissingCtor](http://checkstyle.sourceforge.net/config_coding.html#MissingCtor)
> TODO: enable
Would not see constructors created using Lombok's `@NoArgsConstructor`.
#### [MissingOverride](http://checkstyle.sourceforge.net/config_annotation.html#MissingOverride)
The javadoc compiler automatically inherits the javadoc from the overridden method, it doesn't need to be told to do so.
#### [NoFinalizer](http://checkstyle.sourceforge.net/config_coding.html#NoFinalizer)
> TODO: enable
#### [NoLineWrap](http://checkstyle.sourceforge.net/config_whitespace.html#NoLineWrap)
> TODO: enable
#### [OuterTypeNumber](http://checkstyle.sourceforge.net/config_sizes.html#OuterTypeNumber)
Already covered by the [OneTopLevelClass](#onetoplevelclass) check.
#### [PackageAnnotation](http://checkstyle.sourceforge.net/config_annotation.html#PackageAnnotation)
> TODO: enable
#### [ParameterAssignment](http://checkstyle.sourceforge.net/config_coding.html#ParameterAssignment)
> TODO: enable
[FinalParameters](#finalparameters) already protects against assigning values to parameters.
#### [RedundantImport](http://checkstyle.sourceforge.net/config_imports.html#RedundantImport)
[UnusedImports](#unusedimports) performs all the same checks and more.
Checks for redundant `import`s. Checks for duplicates, imports from the `java.lang` package or from the current package.
#### [Regexp](http://checkstyle.sourceforge.net/config_regexp.html#Regexp)
@ -2745,12 +2816,6 @@ Generic rule; doesn't embody a 'quality' check.
Generic rule; doesn't embody a 'quality' check.
#### [RequireThis](http://checkstyle.sourceforge.net/config_coding.html#RequireThis)
> TODO: enable
> TODO: checkMethods = false
#### [SingleLineJavadoc](http://checkstyle.sourceforge.net/config_javadoc.html#SingleLineJavadoc)
I don't use single line javadoc blocks.
@ -2765,27 +2830,7 @@ Overridding the `clone()` method is not allowed by the [NoClone](#noclone) check
#### [SuperFinalize](http://checkstyle.sourceforge.net/config_coding.html#SuperFinalize)
> TODO: enable
#### [SuppressWarnings](http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarnings)
> TODO: enable
> TODO: format = ^constantname|covariantequals|equalshashcode|noclone|onetoplevelclass|outertypefilename|packagedeclaration|typename|visibilitymodifier$
#### [Translation](http://checkstyle.sourceforge.net/config_misc.html#Translation)
> TODO: enable
#### [UncommentedMain](http://checkstyle.sourceforge.net/config_misc.html#UncommentedMain)
> TODO: enable
> TODO: excludedClasses = "Main$"
#### [UniqueProperties](http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties)
> TODO: enable
[NoFinalizer](#nofinalizer) prevents use of `finalize()`.
#### [WriteTag](http://checkstyle.sourceforge.net/config_javadoc.html#WriteTag)
@ -2799,8 +2844,6 @@ As the sevntu check are considered experimental not all those that are not enabl
Should already be covered by [SimplifyBooleanExpression](simplifybooleanexpression).
> TODO: disable
#### [AvoidDefaultSerializableInInnerClasses](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/AvoidDefaultSerializableInInnerClassesCheck.html)
> TODO: enable
@ -2841,6 +2884,10 @@ Generic rule; doesn't embody a 'quality' check.
Generic rule; doesn't embody a 'quality' check.
#### [ForbidThrowAnonymousExceptions](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/ForbidThrowAnonymousExceptionsCheck.html)
[IllegalThrows](#illegalthrows) performs a similar check.
#### [HideUtilityClassConstructor](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/design/HideUtilityClassConstructorCheck.html)
See [HideUtilityClassConstructor](#hideutilityclassconstructor).

View file

@ -6,7 +6,7 @@
<groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset</artifactId>
<version>0.1.1</version>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>Kemitix Checkstyle Ruleset</name>

View file

@ -15,24 +15,35 @@
</module>
<module name="FileLength"/> <!-- files must be less than 2000 lines -->
<module name="FileTabCharacter"/> <!-- tabs not allowed -->
<module name="Header"> <!-- All java source files start with the contents of LICENSE.txt -->
<property name="headerFile" value="LICENSE.txt"/>
<property name="fileExtensions" value="java"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="SuppressWarningsFilter"/> <!-- enable @SuppressWarnings for checkstyle rules -->
<module name="Translation"/> <!-- Checks that messages files have the same keys -->
<module name="UniqueProperties"/> <!-- checks for duplicate keys in properties files -->
<module name="TreeWalker">
<module name="AbbreviationAsWordInName"/> <!-- enforce proper CamelCase -->
<module name="AbbreviationAsWordInName"> <!-- enforce proper CamelCase -->
</module>
<module name="AbstractClassName"/> <!-- enforce Abstract.* in abstract class names -->
<module name="AnnotationLocation"/> <!-- annotations should be on line by themselves -->
<module name="AnnotationUseStyle"/> <!-- annotations should only use () and named attributes when needed -->
<module name="AnonInnerLength"/> <!-- limits anonymous inner classes to 20 lines -->
<module name="ArrayTypeStyle"/> <!-- enforce Java style arrays -->
<module name="AtclauseOrder"/> <!-- enforce standard order for javadoc elements -->
<module name="AtclauseOrder"> <!-- enforce standard order for javadoc elements - matches IntelliJ's order -->
<property name="tagOrder" value="@param, @author, @version, @serial, @return, @throws, @exception,
@serialData, @serialField, @see, @since, @deprecated"/>
</module>
<module name="AvoidEscapedUnicodeCharacters"> <!-- prevent use of obscure escape codes -->
<property name="allowEscapesForControlCharacters" value="true"/> <!-- unless non-printable controls -->
</module>
<module name="AvoidInlineConditionals"/> <!-- detects ?: usage -->
<module name="AvoidNestedBlocks"/> <!-- avoid unnecessary blocks {} -->
<module name="AvoidStarImport"/> <!-- import package.* is not allowed -->
<module name="AvoidStaticImport"> <!-- import static ... is not allowed -->
@ -67,6 +78,7 @@
<module name="EmptyForIteratorPad"/> <!-- empty for loop iterator muse have have no spaces -->
<module name="EmptyLineSeparator"/> <!-- enforce blank lines after header, fields, constructors, methods, etc -->
<module name="EmptyStatement"/> <!-- prevent standalone ";" semicolons -->
<module name="EqualsAvoidNull"/> <!-- prevents v = null; v.equals("..") -->
<module name="EqualsHashCode"/> <!-- if equals() is overridden then so must hashCode() be -->
<module name="ExecutableStatementCount"/> <!-- limit executable statements to 30 per method -->
<module name="ExplicitInitialization"/> <!-- avoid initializing a field twice to the same value -->
@ -86,21 +98,35 @@
<module name="IllegalCatch"/> <!-- prevent generic catches (i.e. Exception, Throwable, RuntimeException) -->
<module name="IllegalImport"/> <!-- prevent imports from the sun.* package -->
<module name="IllegalThrows"/> <!-- prevent generic throws (i.e. Exception, Throwable, RuntimeException) -->
<module name="IllegalType"/> <!-- prevents variables, returns or parameters of non-interface Collections classes -->
<module name="IllegalToken"/> <!-- prevents use of labels -->
<module name="IllegalType"> <!-- prevents variables, returns or parameters of non-interface Collections classes -->
<property name="illegalClassNames" value="java.util.ArrayDeque, java.util.ArrayList, java.util.EnumMap, java.util.EnumSet, java.util.HashMap, java.util.HashSet, java.util.IdentityHashMap, java.util.LinkedHashMap, java.util.LinkedHashSet, java.util.LinkedList, java.util.PriorityQueue, java.util.TreeMap, java.util.TreeSet"/>
</module>
<module name="InnerAssignment"/> <!-- prevent assignments in subexpressions (i.e. while((line = read()){}) -->
<module name="InnerTypeLast"/> <!-- inner classes appear after methods and fields -->
<module name="InterfaceIsType"/> <!-- interface must define method not just constants -->
<module name="InterfaceTypeParameterName"/> <!-- interface generic type is a single uppercase letter -->
<module name="JavadocMethod"> <!-- methods should have javadoc block -->
<property name="scope" value="public"/> <!-- if they are public -->
<property name="scope" value="package"/> <!-- if they are public, protected or package -->
<property name="validateThrows" value="true"/> <!-- warn about unused @throws tags -->
<property name="allowMissingPropertyJavadoc" value="true"/> <!-- skip basic setters and getters -->
</module>
<module name="JavadocParagraph"/> <!-- javadoc paragraphs have opening <p> elements -->
<module name="JavadocStyle"/> <!-- javadoc comments are well formed -->
<module name="JavadocType"/> <!-- javadoc is present for classes, interfaces and enums -->
<module name="JavaNCSS"/> <!-- Non-Commenting Source Statements complexity analysis -->
<module name="JavadocType"> <!-- javadoc is present for classes, interfaces and enums -->
<property name="authorFormat" value="^.+ (\S+@[\S.]+)$"/> <!-- name followed by email in brackets -->
</module>
<module name="JavaNCSS"> <!-- Non-Commenting Source Statements complexity analysis -->
<property name="methodMaximum" value="40"/> <!-- lines per methods -->
<property name="classMaximum" value="1200"/> <!-- lines per class -->
<property name="fileMaximum" value="1600"/> <!-- lines per file -->
</module>
<module name="LeftCurly"/> <!-- placement of left curly braces ('{') for code blocks at end of line -->
<module name="LineLength"/> <!-- lines can't be longer the 80 -->
<module name="LineLength"> <!-- lines can't be longer the 120 -->
<property name="max" value="120"/>
</module>
<module name="LocalFinalVariableName"/> <!-- validates identifiers for local, final variables, including catch parameters -->
<module name="LocalVariableName"/> <!-- validates non-final identifiers -->
@ -110,13 +136,16 @@
<property name="maxTotal" value="30"/>
</module>
<module name="MethodLength"> <!-- restrict the number of lines in a method -->
<property name="max" value="60"/>
<property name="max" value="40"/>
</module>
<module name="MethodName"/> <!-- method names conform to ^[a-z][a-zA-Z0-9]*$ -->
<module name="MethodParamPad"/> <!-- verifies padding around method parameters -->
<module name="MethodTypeParameterName"/> <!-- restrict method type parameters (i.e. generics) to ^[A-Z]$ -->
<module name="MissingDeprecated"/> <!-- @Deprecated annotation must be accompanied by javadoc @deprecated -->
<module name="MissingSwitchDefault"/> <!-- switch must have a default -->
<module name="ModifiedControlVariable"/> <!-- prevent for loop control being modified inside loop -->
<module name="ModifiedControlVariable"> <!-- prevent for loop control being modified inside loop -->
<property name="skipEnhancedForLoopVariable" value="true"/> <!-- doesn't apply to for(String line : lines) {} -->
</module>
<module name="ModifierOrder"/> <!-- enforce order: public protected private abstract static final transient volatile synchronized native strictfp -->
<module name="MultipleStringLiterals"/> <!-- merge string literals -->
<module name="MultipleVariableDeclarations"/> <!-- declare variables separately -->
@ -125,13 +154,21 @@
<module name="NeedBraces"/> <!-- braces around code blocks -->
<module name="NestedForDepth"/> <!-- prevent nested for loops -->
<module name="NestedIfDepth"/> <!-- prevent nested if-else blocks -->
<module name="NestedTryDepth"/> <!-- prevent nested try blocks -->
<module name="NestedTryDepth"> <!-- prevent nested try blocks -->
<property name="max" value="0"/>
</module>
<module name="NoClone"/> <!-- prevent overriding Object.clone() -->
<module name="NoFinalizer"/> <!-- prevent overriding Object.finalize() -->
<module name="NoLineWrap"/> <!-- prevent line wrapping package and import statements -->
<module name="NonEmptyAtclauseDescription"/> <!-- javadoc tags have descriptions -->
<module name="NoWhitespaceAfter"/> <!-- prevent white space after tokens -->
<module name="NoWhitespaceAfter"> <!-- prevent white space and line breaks after . separator-->
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="false"/>
</module>
<module name="NoWhitespaceBefore"/> <!-- prevent white space before tokens -->
<module name="NPathComplexity"> <!-- restrict method complexity -->
<property name="max" value="400"/>
<property name="max" value="5"/>
</module>
<module name="OneStatementPerLine"/> <!-- only one statement per line -->
@ -140,14 +177,21 @@
<module name="OuterTypeFilename"/> <!-- class name and filename must match -->
<module name="OverloadMethodsDeclarationOrder"/> <!-- group overloaded methods together -->
<module name="PackageAnnotation"/> <!-- package level annotations appear in package-info.java -->
<module name="PackageDeclaration"/> <!-- class must have package and it must match the directory -->
<module name="PackageName"/> <!-- validate package name format -->
<module name="PackageName"> <!-- validate package name format -->
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]+)*$"/> <!-- only lowercase letters, no initial numbers or underscores -->
</module>
<module name="ParameterName"/> <!-- validate parameter name format -->
<module name="ParameterNumber"/> <!-- limits the number of parameters to 7 -->
<module name="ParameterNumber"> <!-- limits the number of parameters to 7 -->
<property name="ignoreOverriddenMethods" value="true"/> <!-- don't apply to @Overridden -->
</module>
<module name="ParenPad"/> <!-- parentheses should have no padding spaces -->
<module name="RedundantImport"/> <!-- checks for redundant imports (i.e. in the same package) -->
<module name="RedundantModifier"/> <!-- checks for redundant modifies (e.g. public methods in an interface) -->
<module name="RequireThis"> <!-- references to instance fields where parameter name overlaps use this. -->
<property name="checkMethods" value="false"/>
</module>
<module name="ReturnCount"/> <!-- Restricts return statements to 2 per method (1 if return type is void) -->
<module name="RightCurly"/> <!-- placement of right curly braces ('}') for code blocks at end of line -->
@ -164,16 +208,24 @@
<module name="SingleSpaceSeparator"/> <!-- Checks that non-whitespace characters are separated by only 1 character -->
<module name="StaticVariableName"/> <!-- Static non-finals should be formatted like normal identifiers -->
<module name="StringLiteralEquality"/> <!-- use .equals(...) when comparing strings for equality -->
<module name="SuppressWarnings">
<property name="format"
value="^constantname|covariantequals|equalshashcode|noclone|onetoplevelclass|outertypefilename|packagedeclaration|typename|visibilitymodifier$"/>
</module>
<module name="SuppressWarningsHolder"/> <!-- holds all @SuppressWarnings found for SuppressWarningsFilter -->
<module name="ThrowsCount"/> <!-- Restricts throws statements to 4 -->
<module name="TodoComment"> <!-- no to do or fix me comments -->
<property name="format" value="(TODO)|(FIXME)"/>
<property name="format" value="^(\s*\*).*((TODO)|(FIXME))"/>
</module>
<module name="TrailingComment"/> <!-- no end-line comments (the irony!) -->
<module name="TypecastParenPad"/> <!-- no spaces in type casting parentheses -->
<module name="TypeName"/> <!-- validates class, interface, enum and annotation names -->
<module name="UncommentedMain"> <!-- checks for stray public static void main() methods -->
<!-- allowed in classes that end in Main or Application-->
<property name="excludedClasses" value="(Main|Application)$"/>
</module>
<module name="UnnecessaryParentheses"/> <!-- unnecessary parentheses -->
<module name="UnusedImports"/> <!-- checks for import that aren't used -->
<module name="UpperEll"/> <!-- long constants have an 'L' suffix -->
@ -192,9 +244,12 @@
<module name="ConfusingConditionCheck"/> <!-- prevents negation within an "if" expression if "else" is present -->
<module name="DiamondOperatorForVariableDefinitionCheck"/> <!-- use the diamond operator -->
<module name="EitherLogOrThrowCheck"/> <!-- log or throw an exception - don't do both -->
<module name="EitherLogOrThrowCheck"> <!-- log or throw an exception - don't do both -->
<property name="loggerFullyQualifiedClassName" value="java.util.logging.Logger"/>
<property name="loggingMethodNames" value="log, severe, warning, info, config, fine, finer, finest, "/>
</module>
<module name="ForbidCCommentsInMethodsCheck"/> <!-- prevent /* C-style */ comments inside methods -->
<module name="ForbidReturnInFinallyBlockCheck"/> <!-- returns in finally override returns elsewhere in method -->
<module name="ForbidThrowAnonymousExceptionsCheck"/> <!-- only throw concrete exceptions -->
<module name="LogicConditionNeedOptimizationCheck"/> <!-- prevent placement of local variables and fields after call to method in logical conditionals -->
<module name="MapIterationInForEachLoopCheck"/> <!-- warns of unoptimised map iteration -->
<module name="NameConventionForJunit4TestClassesCheck"/> <!-- checks names of test classes -->
@ -210,7 +265,6 @@
<module name="UselessSingleCatchCheck"/> <!-- prevent single catch blocks that just rethrow the original exception -->
<module name="UselessSuperCtorCallCheck"/> <!-- detects calls to super() when not needed -->
<!-- sevntu/design -->
<module name="AvoidConditionInversionCheck"/> <!-- catch condition inversion which could be more readable -->
<!--<module name="ChildBlockLengthCheck"/> &lt;!&ndash; broken in sevntu 1.20 - limit child blocks to 80% of parent block &ndash;&gt;-->
<module name="ConstructorWithoutParamsCheck"/> <!-- Exception classes must take parameters -->
<module name="ForbidWildcardAsReturnTypeCheck"/> <!-- forbid <? extends|super Object> generics as return types on public, protected and package methods -->