From 5a0b8443a410bec2928bea8a33ceb2044b59aa35 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 16 Aug 2016 16:23:56 +0100 Subject: [PATCH 01/48] pom.xml: version set to 0.2.0-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7a652cb..13dcc07 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.kemitix kemitix-checkstyle-ruleset - 0.1.0 + 0.2.0-SNAPSHOT jar Kemitix Checkstyle Ruleset From afcbd11e3fcb7304396c7fa70d18a76321a324ac Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 16 Aug 2016 19:09:59 +0100 Subject: [PATCH 02/48] README.md: fix checkstyle configuration example --- README.md | 58 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a7cf69f..b43609a 100644 --- a/README.md +++ b/README.md @@ -30,30 +30,52 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty 7.0 1.21.0 - 1.0.0 + 0.1.1 + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + com.puppycrawl.tools + checkstyle + ${checkstyle.version} + + + com.github.sevntu.checkstyle + sevntu-checkstyle-maven-plugin + ${sevntu-checkstyle-maven-plugin.version} + + + net.kemitix + kemitix-checkstyle-ruleset + ${kemitix-checkstyle-ruleset.version} + + + net/kemitix/checkstyle.xml + + + + + org.apache.maven.plugins maven-checkstyle-plugin - - - com.puppycrawl.tools - checkstyle - ${checkstyle.version} - - - com.github.sevntu.checkstyle - sevntu-checkstyle-maven-plugin - ${sevntu-checkstyle-maven-plugin.version} - - - net.kemitix - kemitix-checkstyle-ruleset - ${kemitix-checkstyle-ruleset.version} - - + + + validate + validate + + check + checkstyle + + + + ```` ## All Checks From c24540c17cfbc2b937802102a44bfb5ddebfd36c Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 4 Sep 2016 22:30:28 +0100 Subject: [PATCH 03/48] LineLength: set max to 120 Widescreen monitor are more common, and this is the default for IntelliJ. Removing the TODO note about ignoring Javadoc blocks as this is less urget now with the 150% width increase. --- README.md | 4 +--- src/main/resources/net/kemitix/checkstyle.xml | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b43609a..9282508 100644 --- a/README.md +++ b/README.md @@ -1289,12 +1289,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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index c9be749..fec0bb4 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -100,7 +100,9 @@ - + + + From c1beb073dae5af24bace3c67467043593cf22d0b Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 4 Sep 2016 22:34:32 +0100 Subject: [PATCH 04/48] AtclauseOrder: adjust order to match that forced by IntelliJ --- README.md | 8 ++++---- src/main/resources/net/kemitix/checkstyle.xml | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9282508..4c53fab 100644 --- a/README.md +++ b/README.md @@ -386,17 +386,17 @@ Javadoc `@` clauses must be in the order: ```` /** * + * @param ... * @author ... * @version ... - * @param ... + * @serial ... * @return ... * @throws ... * @exception ... + * @serialData ... + * @serialField ... * @see ... * @since ... - * @serial ... - * @serialField ... - * @serialData ... * @deprecated ... */ ```` diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index fec0bb4..632dfee 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -29,7 +29,10 @@ - + + + From ee9753c9bbf9d2a71c36017cdba9674f1ca3e25f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 4 Sep 2016 22:37:34 +0100 Subject: [PATCH 05/48] AbbreviationAsWordInName: apply to final and static --- README.md | 4 +--- src/main/resources/net/kemitix/checkstyle.xml | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4c53fab..63b4aeb 100644 --- a/README.md +++ b/README.md @@ -294,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: ```` diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 632dfee..7732808 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -23,7 +23,10 @@ - + + + + From d82ef2337e24639a6a09928764c0dd842dec7add Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 07:22:33 +0100 Subject: [PATCH 06/48] JavadocMethod: require on protected and package Also: * warn about unused @throws tags * skip basic setters and getters --- README.md | 8 +------- src/main/resources/net/kemitix/checkstyle.xml | 4 +++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 63b4aeb..3a9db02 100644 --- a/README.md +++ b/README.md @@ -1229,13 +1229,7 @@ interface Foo { #### [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) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 7732808..33329a8 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -98,7 +98,9 @@ - + + + From 3cc5a02dd6083288890ff6745fa21472ecf0118f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 07:28:25 +0100 Subject: [PATCH 07/48] JavadocType: require @author tag in format "name (email)" --- README.md | 4 +--- src/main/resources/net/kemitix/checkstyle.xml | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3a9db02..ad9ac56 100644 --- a/README.md +++ b/README.md @@ -1245,9 +1245,7 @@ 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) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 33329a8..0ccd9a9 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -104,7 +104,9 @@ - + + + From 02a755f3786e7420b12ec6608996078a10020042 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 07:55:40 +0100 Subject: [PATCH 08/48] JavaNCSS: reduce limits by 20% --- README.md | 8 +------- src/main/resources/net/kemitix/checkstyle.xml | 6 +++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ad9ac56..487247f 100644 --- a/README.md +++ b/README.md @@ -1249,16 +1249,10 @@ Checks the format for Javadoc for classes and enums. Javadoc must be present, no #### [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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 0ccd9a9..eecf96e 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -107,7 +107,11 @@ - + + + + + From 633b270172aa3ed007cd3a2866e9e6e385a21e29 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:30:42 +0100 Subject: [PATCH 09/48] MethodLength: reduce limit to 40 lines --- README.md | 2 -- src/main/resources/net/kemitix/checkstyle.xml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 487247f..514046b 100644 --- a/README.md +++ b/README.md @@ -1320,8 +1320,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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index eecf96e..4b56f6d 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -126,7 +126,7 @@ - + From 78b24a265d37226af07646fd136655b0eab99e02 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:34:23 +0100 Subject: [PATCH 10/48] ModifiedControlVariable: don't apply to enhanced for loops --- README.md | 2 -- src/main/resources/net/kemitix/checkstyle.xml | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 514046b..d890cec 100644 --- a/README.md +++ b/README.md @@ -1415,8 +1415,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: diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 4b56f6d..e99f9a1 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -132,7 +132,9 @@ - + + + From bb3aec4ab6b529ea926e909dcaa903b84406ad76 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:37:06 +0100 Subject: [PATCH 11/48] NestedTryDepth: prevent all nested try blocks --- README.md | 12 ++++-------- src/main/resources/net/kemitix/checkstyle.xml | 4 +++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d890cec..ff88a7e 100644 --- a/README.md +++ b/README.md @@ -1551,19 +1551,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 - } + doSomeOtherThing(); } catch (SomeException se) { // handle it +} catch (OtherExceptions oe) { + // handle it } ```` @@ -1581,8 +1579,6 @@ 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). diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index e99f9a1..917e7e6 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -143,7 +143,9 @@ - + + + From 109276cdea4f07a0643997961d674977d9315c4c Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:40:27 +0100 Subject: [PATCH 12/48] NoWhitespaceAfter: prevent whitespace and new line after dot separator --- README.md | 2 -- src/main/resources/net/kemitix/checkstyle.xml | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ff88a7e..10152c6 100644 --- a/README.md +++ b/README.md @@ -1643,8 +1643,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 ('--'). diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 917e7e6..3ad7383 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -149,6 +149,10 @@ + + + + From 9e15232d1b9181671cf6c66e1720fb0fb9667256 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:41:12 +0100 Subject: [PATCH 13/48] NPathComplexity: reduce to 5 to match CyclomaticComplexity --- README.md | 4 +--- src/main/resources/net/kemitix/checkstyle.xml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 10152c6..2d73f81 100644 --- a/README.md +++ b/README.md @@ -1665,9 +1665,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) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 3ad7383..f56d306 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -155,7 +155,7 @@ - + From d63620c9b408fd2bed3555e80e35b87edf26be5f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:43:11 +0100 Subject: [PATCH 14/48] PackageName: restrict to only lowercase letters --- README.md | 4 +--- src/main/resources/net/kemitix/checkstyle.xml | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2d73f81..2359f5a 100644 --- a/README.md +++ b/README.md @@ -1718,9 +1718,7 @@ Checks that the class has a `package` definition. Checks the format of package names. -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]+)*$`. #### [ParameterName](http://checkstyle.sourceforge.net/config_naming.html#ParameterName) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index f56d306..4291089 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -165,7 +165,9 @@ - + + + From 14462f9ea4c2bcb071963018e038386024c1f0e7 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:45:38 +0100 Subject: [PATCH 15/48] ParameterNumber: don't apply limit to overridden methods --- README.md | 4 +--- src/main/resources/net/kemitix/checkstyle.xml | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2359f5a..abd3e70 100644 --- a/README.md +++ b/README.md @@ -1728,9 +1728,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) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 4291089..37cd8c6 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -169,7 +169,9 @@ - + + + From ee52569e22d3821ab4b3d505fffff9024e953896 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:47:49 +0100 Subject: [PATCH 16/48] RedundantImport: remove redundant check --- README.md | 14 +++++++------- src/main/resources/net/kemitix/checkstyle.xml | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index abd3e70..4f6ae77 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [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 @@ -1747,12 +1747,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: @@ -2709,6 +2703,12 @@ Already covered by the [OneTopLevelClass](#onetoplevelclass) check. > TODO: enable +#### [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) Generic rule; doesn't embody a 'quality' check. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 37cd8c6..8a49ad6 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -174,7 +174,6 @@ - From 4800ef85d0039dddc5af15481a3b6b2335eb2335 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Sep 2016 17:56:58 +0100 Subject: [PATCH 17/48] EitherLogOfThrow: add support for java.util.logging.Logger --- README.md | 2 +- src/main/resources/net/kemitix/checkstyle.xml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f6ae77..486dc5b 100644 --- a/README.md +++ b/README.md @@ -2255,7 +2255,7 @@ Map idTable = new HashMap(); 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) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 8a49ad6..6a77cab 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -219,6 +219,10 @@ + + + + From e5473df9d149f0367a36d78f58b78e19fabde1cb Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 18:28:26 +0100 Subject: [PATCH 18/48] ForbidThrowAnonymouseExceptions: remove redundant check --- README.md | 10 +++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 486dc5b..4864f4d 100644 --- a/README.md +++ b/README.md @@ -142,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 @@ -2334,10 +2334,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. @@ -2829,6 +2825,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). diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 6a77cab..90975e8 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -225,7 +225,6 @@ - From 9260b3b595cee39af950afed05168883c938dd80 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 18:46:11 +0100 Subject: [PATCH 19/48] EnumValueName: fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4864f4d..ef0b286 100644 --- a/README.md +++ b/README.md @@ -2295,7 +2295,7 @@ enum InvalidClassLike { private String name; - ValidClassLike(String name) { + InvalidClassLike(String name) { this.name = name; } } From 497afd2c68be90298c025ef283484a725d0336ad Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 18:51:49 +0100 Subject: [PATCH 20/48] TodoComment: only match against comments --- README.md | 2 -- src/main/resources/net/kemitix/checkstyle.xml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index ef0b286..da93703 100644 --- a/README.md +++ b/README.md @@ -1967,8 +1967,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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 90975e8..f0e16f6 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -195,7 +195,7 @@ - + From 322350eda650302a488a1d8933b421c84f1882b8 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 18:56:26 +0100 Subject: [PATCH 21/48] AvoidInlineConditionals: enabled --- README.md | 10 +++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index da93703..35c34cb 100644 --- a/README.md +++ b/README.md @@ -93,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 @@ -414,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. @@ -2609,10 +2613,6 @@ 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 diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index f0e16f6..459fa79 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -39,6 +39,7 @@ + From 5ed44301c8dfbb6bc5ccdcf345757e2eb2ada52d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 19:01:44 +0100 Subject: [PATCH 22/48] EqualsAvoidNull: enabled --- README.md | 22 ++++++++++++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 35c34cb..3386ec4 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ 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 +* [EqualsAvoidNull](#equalsavoidnull) - checkstyle - enabled * [EqualsHashCode](#equalshashcode) - checkstyle - enabled * [ExecutableStatementCount](#executablestatementcount) - checkstyle - enabled * [ExplicitInitialization](#explicitinitialization) - checkstyle - enabled @@ -918,6 +918,22 @@ 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) Checks that when a class overrides the `equals()` method, that it also overrides the `hashCode()` method. @@ -2613,10 +2629,6 @@ These checks are not enabled. Notes are included for each explaining why. Couldn't get my IDE's (IntelliJ) code style to match. -#### [EqualsAvoidNull](http://checkstyle.sourceforge.net/config_coding.html#EqualsAvoidNull) - -> TODO: enable - #### [FinalLocalVariable](http://checkstyle.sourceforge.net/config_coding.html#FinalLocalVariable) > TODO: enable diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 459fa79..47e8301 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -74,6 +74,7 @@ + From af2b893796de11d9741d6616af1d74067b618fc4 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 19:05:51 +0100 Subject: [PATCH 23/48] FinalLocalVariable: enable --- README.md | 10 +++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3386ec4..146ff6d 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [FileTabCharacter](#filetabcharacter) - checkstyle - enabled * [FinalClass](#finalclass) - checkstyle - enabled * [FinalizeImplementation](#finalizeimplementation) - sevntu - disabled -* [FinalLocalVariable](#finallocalvariable) - checkstyle - disabled +* [FinalLocalVariable](#finallocalvariable) - checkstyle - enabled * [FinalParameters](#finalparameters) - checkstyle - enabled * [ForbidAnnotation](#forbidannotation) - sevntu - disabled * [ForbidCCommentsInMethods](#forbidccommentsinmethods) - sevntu - enabled @@ -1038,6 +1038,10 @@ class Invalid { } ```` +#### [FinalLocalVariable](http://checkstyle.sourceforge.net/config_coding.html#FinalLocalVariable) + +Checks that local variables are `final` if they are never modified after declaration. + #### [FinalParameters](http://checkstyle.sourceforge.net/config_misc.html#FinalParameters) Parameters to a method must be `final`. @@ -2629,10 +2633,6 @@ These checks are not enabled. Notes are included for each explaining why. Couldn't get my IDE's (IntelliJ) code style to match. -#### [FinalLocalVariable](http://checkstyle.sourceforge.net/config_coding.html#FinalLocalVariable) - -> TODO: enable - #### [Header](http://checkstyle.sourceforge.net/config_header.html#Header) > TODO: enable diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 47e8301..d6ac91e 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -81,6 +81,7 @@ + From 55e103c531be1d23d27549292cba4c9182982949 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 19:10:05 +0100 Subject: [PATCH 24/48] Header: enabled --- README.md | 12 ++++-------- src/main/resources/net/kemitix/checkstyle.xml | 4 ++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 146ff6d..5e9c3ad 100644 --- a/README.md +++ b/README.md @@ -1071,6 +1071,10 @@ List list = ImmutableList.Builder::new; sort(list, Comparable::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. @@ -2633,14 +2637,6 @@ These checks are not enabled. Notes are included for each explaining why. Couldn't get my IDE's (IntelliJ) code style to match. -#### [Header](http://checkstyle.sourceforge.net/config_header.html#Header) - -> TODO: enable - -> TODO: headerFile = LICENSE.txt - -> TODO: fileExtensions = java - #### [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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index d6ac91e..4c0fe71 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -86,6 +86,10 @@ + + + + From aed8ec658cc8bbceaf504c68a3add3ad70b5dd0a Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 20:16:51 +0100 Subject: [PATCH 25/48] IllegalToken: enabled --- README.md | 10 +++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5e9c3ad..006a88e 100644 --- a/README.md +++ b/README.md @@ -154,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 @@ -1191,6 +1191,10 @@ 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: @@ -2641,10 +2645,6 @@ Couldn't get my IDE's (IntelliJ) code style to match. 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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 4c0fe71..82440f0 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -99,6 +99,7 @@ + From d3136df13414278fdfabc7d0284f84da5dc864fa Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Sep 2016 20:22:52 +0100 Subject: [PATCH 26/48] InterfaceTypeParameterName: enabled --- README.md | 20 ++++++++++++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 006a88e..0b1d1a7 100644 --- a/README.md +++ b/README.md @@ -164,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 @@ -1259,6 +1259,20 @@ 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 Portable {} +```` + +Invalid: +```` +interface Portable {} +```` + #### [JavadocMethod](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocMethod) 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. @@ -2661,10 +2675,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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 82440f0..520c9f2 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -104,6 +104,7 @@ + From 0c12b97cd2cf80e4050a522a1514f80bc6a39a00 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 8 Sep 2016 20:03:11 +0100 Subject: [PATCH 27/48] IllegalType: added more classes from Collections --- README.md | 17 ++++++++++++----- src/main/resources/net/kemitix/checkstyle.xml | 4 +++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0b1d1a7..2598dd6 100644 --- a/README.md +++ b/README.md @@ -1197,16 +1197,23 @@ 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: ```` diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 520c9f2..bc75507 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -100,7 +100,9 @@ - + + + From 779839dbdeb6d1fa50df521b5bbbc6c05460ea6c Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 9 Sep 2016 19:03:10 +0100 Subject: [PATCH 28/48] MethodTypeParameterName: enabled --- README.md | 22 ++++++++++++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2598dd6..666553f 100644 --- a/README.md +++ b/README.md @@ -187,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 @@ -1396,6 +1396,22 @@ void getValue (); ```` +#### [MethodTypeParameterName](http://checkstyle.sourceforge.net/config_naming.html#MethodTypeParameterName) + +Restricts method generics parameters to be a single uppercase letter. + +Valid: +```` +List getItems() {} +```` + +Invalid: +```` +List getItems() {} +List getItems() {} +List getItems() {} +```` + #### [MissingDeprecated](http://checkstyle.sourceforge.net/config_annotation.html#MissingDeprecated) Both the `@Deprecated` annotation and the Javadoc tag `@deprecated` must be used in pairs. @@ -2690,10 +2706,6 @@ 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 diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index bc75507..3845af1 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -141,6 +141,7 @@ + From 15e2c9e441ab1c1c81c54322d8d7026066ece793 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 9 Sep 2016 19:06:09 +0100 Subject: [PATCH 29/48] MissingCtor: leave disabled --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 666553f..b32456a 100644 --- a/README.md +++ b/README.md @@ -2708,7 +2708,7 @@ Member variables should usually be named such that it is clear what they are. Co #### [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) From e10b3c00326fe4f32c215386e8ba4c0b64eb1542 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 9 Sep 2016 19:09:48 +0100 Subject: [PATCH 30/48] NoFinalizer: enabled --- README.md | 12 +++++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b32456a..8097ef0 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [NestedTryDepth](#nestedtrydepth) - checkstyle - enabled * [NewlineAtEndOfFile](#newlineatendoffile) - checkstyle - enabled * [NoClone](#noclone) - checkstyle - enabled -* [NoFinalizer](#nofinalizer) - checkstyle - disabled +* [NoFinalizer](#nofinalizer) - checkstyle - enabled * [NoLineWrap](#nolinewrap) - checkstyle - disabled * [NoMainMethodInAbstractClass](#nomainmethodinabstractclass) - sevntu - enabled * [NonEmptyAtclauseDescription](#nonemptyatclausedescription) - checkstyle - enabled @@ -1658,6 +1658,12 @@ Checks that the `clone()` method from `Object` has not been overridden. Use a c > 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. + #### [NonEmptyAtclauseDescription](http://checkstyle.sourceforge.net/config_javadoc.html#NonEmptyAtclauseDescription) Checks that the Javadoc clauses `@param`, `@return`, `@throws` and `@deprecated` all have descriptions. @@ -2714,10 +2720,6 @@ Would not see constructors created using Lombok's `@NoArgsConstructor`. 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 diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 3845af1..676002c 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -159,6 +159,7 @@ + From 41d4166affcc3352115abb2cf7440edd08e73ebe Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 9 Sep 2016 19:12:03 +0100 Subject: [PATCH 31/48] NoLineWrap: enabled --- README.md | 10 +++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8097ef0..30bac4b 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [NewlineAtEndOfFile](#newlineatendoffile) - checkstyle - enabled * [NoClone](#noclone) - checkstyle - enabled * [NoFinalizer](#nofinalizer) - checkstyle - enabled -* [NoLineWrap](#nolinewrap) - checkstyle - disabled +* [NoLineWrap](#nolinewrap) - checkstyle - enabled * [NoMainMethodInAbstractClass](#nomainmethodinabstractclass) - sevntu - enabled * [NonEmptyAtclauseDescription](#nonemptyatclausedescription) - checkstyle - enabled * [NoWhitespaceAfter](#nowhitespaceafter) - checkstyle - enabled @@ -1664,6 +1664,10 @@ 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. @@ -2720,10 +2724,6 @@ Would not see constructors created using Lombok's `@NoArgsConstructor`. The javadoc compiler automatically inherits the javadoc from the overridden method, it doesn't need to be told to do so. -#### [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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 676002c..3b22b1c 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -160,6 +160,7 @@ + From 66c87c22235e10a572ada5b5bd66ba84c5e4660d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 9 Sep 2016 20:45:24 +0100 Subject: [PATCH 32/48] PackageAnnotation: enabled --- README.md | 10 +++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 30bac4b..71b3b77 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [OuterTypeNumber](#outertypenumber) - checkstyle - disabled * [OverloadMethodsDeclarationOrder](#overloadmethodsdeclarationorder) - checkstyle - enabled * [OverridableMethodInConstructor](#overridablemethodinconstructor) - sevntu - enabled -* [PackageAnnotation](#packageannotation) - checkstyle - disabled +* [PackageAnnotation](#packageannotation) - checkstyle - enabled * [PackageDeclaration](#packagedeclaration) - checkstyle - enabled * [PackageName](#packagename) - checkstyle - enabled * [ParameterAssignment](#parameterassignment) - checkstyle - disabled @@ -1789,6 +1789,10 @@ Checks that the source filename matches the name of the top-level class. e.g. ` 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) Checks that the class has a `package` definition. @@ -2728,10 +2732,6 @@ The javadoc compiler automatically inherits the javadoc from the overridden meth 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 diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 3b22b1c..9984251 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -178,6 +178,7 @@ + From b1ddcc94dcefd3cba2b07defa72392b82c899a21 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 9 Sep 2016 20:47:35 +0100 Subject: [PATCH 33/48] ParameterAssignment: not needed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71b3b77..2db588f 100644 --- a/README.md +++ b/README.md @@ -2734,7 +2734,7 @@ Already covered by the [OneTopLevelClass](#onetoplevelclass) check. #### [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) From 4727f4faa512eb76621fb1254249493e18b52f62 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 9 Sep 2016 20:56:37 +0100 Subject: [PATCH 34/48] RequireThis: enabled --- README.md | 12 +++++------- src/main/resources/net/kemitix/checkstyle.xml | 3 +++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2db588f..c0513c1 100644 --- a/README.md +++ b/README.md @@ -240,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 @@ -1840,6 +1840,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. @@ -2766,12 +2770,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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 9984251..9a2273d 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -190,6 +190,9 @@ + + + From ccdcba8e6b1e248d8e590a42dcff952d934ee176 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 08:45:01 +0100 Subject: [PATCH 35/48] SuperFinalize: leave disabled --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c0513c1..85fe382 100644 --- a/README.md +++ b/README.md @@ -2784,7 +2784,7 @@ Overridding the `clone()` method is not allowed by the [NoClone](#noclone) check #### [SuperFinalize](http://checkstyle.sourceforge.net/config_coding.html#SuperFinalize) -> TODO: enable +[NoFinalizer](#nofinalizer) prevents use of `finalize()`. #### [SuppressWarnings](http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarnings) From 524fbc029dd2ca750b0323ff1b6ff680a820a72d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 19:44:38 +0100 Subject: [PATCH 36/48] SuppressWarnings: enabled --- README.md | 58 ++++++++++++++----- src/main/resources/net/kemitix/checkstyle.xml | 4 ++ 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 85fe382..007e71e 100644 --- a/README.md +++ b/README.md @@ -108,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 @@ -127,7 +127,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [EmptyStatement](#emptystatement) - checkstyle - enabled * [EnumValueName](#enumvaluename) - sevntu - enabled * [EqualsAvoidNull](#equalsavoidnull) - checkstyle - enabled -* [EqualsHashCode](#equalshashcode) - checkstyle - enabled +* [EqualsHashCode](#equalshashcode) - checkstyle - enabled - insuppressible * [ExecutableStatementCount](#executablestatementcount) - checkstyle - enabled * [ExplicitInitialization](#explicitinitialization) - checkstyle - enabled * [FallThrough](#fallthrough) - checkstyle - enabled @@ -206,7 +206,7 @@ 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 +* [NoClone](#noclone) - checkstyle - enabled - insuppressible * [NoFinalizer](#nofinalizer) - checkstyle - enabled * [NoLineWrap](#nolinewrap) - checkstyle - enabled * [NoMainMethodInAbstractClass](#nomainmethodinabstractclass) - sevntu - enabled @@ -216,14 +216,14 @@ 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 - enabled -* [PackageDeclaration](#packagedeclaration) - checkstyle - enabled +* [PackageDeclaration](#packagedeclaration) - checkstyle - enabled - insuppressible * [PackageName](#packagename) - checkstyle - enabled * [ParameterAssignment](#parameterassignment) - checkstyle - disabled * [ParameterName](#parametername) - checkstyle - enabled @@ -259,15 +259,15 @@ 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 * [TypecastParenPad](#typecastparenpad) - checkstyle - enabled -* [TypeName](#typename) - checkstyle - enabled +* [TypeName](#typename) - checkstyle - enabled - insuppressible * [UncommentedMain](#uncommentedmain) - checkstyle - disabled * [UniformEnumConstantName](#uniformenumconstantname) - sevntu - enabled * [UniqueProperties](#uniqueproperties) - checkstyle - disabled @@ -278,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 @@ -618,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: @@ -633,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: @@ -936,6 +940,8 @@ 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) @@ -1654,6 +1660,8 @@ 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. @@ -1763,6 +1771,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) @@ -1783,6 +1793,8 @@ 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) @@ -1795,6 +1807,8 @@ 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) @@ -2027,6 +2041,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. @@ -2100,6 +2128,8 @@ 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]*$`. @@ -2152,6 +2182,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`: @@ -2786,12 +2818,6 @@ Overridding the `clone()` method is not allowed by the [NoClone](#noclone) check [NoFinalizer](#nofinalizer) prevents use of `finalize()`. -#### [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 diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 9a2273d..2758851 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -209,6 +209,10 @@ + + + From 559daa92e85ba36a41e863c758329a5852131081 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 19:42:51 +0100 Subject: [PATCH 37/48] Translation: enabled --- README.md | 10 +++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 007e71e..fcd8e85 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [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 - insuppressible * [UncommentedMain](#uncommentedmain) - checkstyle - disabled @@ -2110,6 +2110,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. @@ -2818,10 +2822,6 @@ Overridding the `clone()` method is not allowed by the [NoClone](#noclone) check [NoFinalizer](#nofinalizer) prevents use of `finalize()`. -#### [Translation](http://checkstyle.sourceforge.net/config_misc.html#Translation) - -> TODO: enable - #### [UncommentedMain](http://checkstyle.sourceforge.net/config_misc.html#UncommentedMain) > TODO: enable diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 2758851..f4be52c 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -220,6 +220,7 @@ + From cf5b220915bdb9b686510cc0deac2b6453a0e8ea Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 19:45:22 +0100 Subject: [PATCH 38/48] UncommentedMain: enabled --- README.md | 12 +++++------- src/main/resources/net/kemitix/checkstyle.xml | 4 ++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fcd8e85..0a848f0 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [Translation](#translation) - checkstyle - enabled * [TypecastParenPad](#typecastparenpad) - checkstyle - enabled * [TypeName](#typename) - checkstyle - enabled - insuppressible -* [UncommentedMain](#uncommentedmain) - checkstyle - disabled +* [UncommentedMain](#uncommentedmain) - checkstyle - enabled * [UniformEnumConstantName](#uniformenumconstantname) - sevntu - enabled * [UniqueProperties](#uniqueproperties) - checkstyle - disabled * [UnnecessaryParentheses](#unnecessaryparentheses) - checkstyle - enabled @@ -2138,6 +2138,10 @@ Checks the format of `class`, `interface`, `enum` identifiers, including annotat 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`. + #### [UnnecessaryParentheses](http://checkstyle.sourceforge.net/config_coding.html#UnnecessaryParentheses) Checks for the use of unnecessary parentheses. @@ -2822,12 +2826,6 @@ Overridding the `clone()` method is not allowed by the [NoClone](#noclone) check [NoFinalizer](#nofinalizer) prevents use of `finalize()`. -#### [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 diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index f4be52c..345f4d2 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -224,6 +224,10 @@ + + + + From 0db1b15bfc9fb35481c5224bc37ea3b7fa205467 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 19:49:29 +0100 Subject: [PATCH 39/48] UniqueProperties: enabled --- README.md | 10 +++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0a848f0..7283ad3 100644 --- a/README.md +++ b/README.md @@ -270,7 +270,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [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 @@ -2142,6 +2142,10 @@ Identifiers must match `^[A-Z][a-zA-Z0-9]*$`. 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. @@ -2826,10 +2830,6 @@ Overridding the `clone()` method is not allowed by the [NoClone](#noclone) check [NoFinalizer](#nofinalizer) prevents use of `finalize()`. -#### [UniqueProperties](http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties) - -> TODO: enable - #### [WriteTag](http://checkstyle.sourceforge.net/config_javadoc.html#WriteTag) Generic rule; doesn't embody a 'quality' check. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 345f4d2..3161cb8 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -228,6 +228,7 @@ + From ec422ffa3cbaa6c381eae2a2541635514ca0197d Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 19:52:01 +0100 Subject: [PATCH 40/48] AvoidConditionInversionCheck: disabled --- README.md | 2 -- src/main/resources/net/kemitix/checkstyle.xml | 1 - 2 files changed, 3 deletions(-) diff --git a/README.md b/README.md index 7283ad3..8a368ad 100644 --- a/README.md +++ b/README.md @@ -2842,8 +2842,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 diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 3161cb8..dce775c 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -268,7 +268,6 @@ - From bf072e39b03cabdc001ac9c384cb84c7ccfddcfb Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 20:03:03 +0100 Subject: [PATCH 41/48] Header: move to Checker module --- src/main/resources/net/kemitix/checkstyle.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index dce775c..f18bb8a 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -15,6 +15,10 @@ + + + + @@ -86,10 +90,6 @@ - - - - From 4e274f70df2132dcd7aef9daf662a8e3c70b61ed Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 20:04:12 +0100 Subject: [PATCH 42/48] Translation: move to Checker module --- src/main/resources/net/kemitix/checkstyle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index f18bb8a..61fb619 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -24,6 +24,7 @@ + @@ -220,7 +221,6 @@ - From 43afb58d8f8d65412ee1d68d02195141425b3f35 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 10 Sep 2016 20:05:00 +0100 Subject: [PATCH 43/48] UniqueProperties: move to Checker module --- src/main/resources/net/kemitix/checkstyle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 61fb619..0705aaf 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -25,6 +25,7 @@ + @@ -228,7 +229,6 @@ - From 52bc4ff5c3c8026dfe0312689d158d16c1e29312 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 11 Sep 2016 08:14:27 +0100 Subject: [PATCH 44/48] AbbreviationAsWordInName: fix to work with CONSTANT naming convention Having the ignoreStatic and ignoreFinal flags disabled meant that constants (static final) had to be in CamelCase, which conflicts with the ConstantName check. --- src/main/resources/net/kemitix/checkstyle.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 0705aaf..0730dfb 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -30,8 +30,6 @@ - - From 5890f179f81712df071666949b1ca62e82c149b7 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 11 Sep 2016 08:28:24 +0100 Subject: [PATCH 45/48] FinalLocalVariable: disable - Lombok val This check fails to recognise Lombok's val as being a final. --- README.md | 12 +++++++----- src/main/resources/net/kemitix/checkstyle.xml | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8a368ad..9690921 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ You need to include `checkstyle` as the version bundled with the `maven-checksty * [FileTabCharacter](#filetabcharacter) - checkstyle - enabled * [FinalClass](#finalclass) - checkstyle - enabled * [FinalizeImplementation](#finalizeimplementation) - sevntu - disabled -* [FinalLocalVariable](#finallocalvariable) - checkstyle - enabled +* [FinalLocalVariable](#finallocalvariable) - checkstyle - disabled * [FinalParameters](#finalparameters) - checkstyle - enabled * [ForbidAnnotation](#forbidannotation) - sevntu - disabled * [ForbidCCommentsInMethods](#forbidccommentsinmethods) - sevntu - enabled @@ -1044,10 +1044,6 @@ class Invalid { } ```` -#### [FinalLocalVariable](http://checkstyle.sourceforge.net/config_coding.html#FinalLocalVariable) - -Checks that local variables are `final` if they are never modified after declaration. - #### [FinalParameters](http://checkstyle.sourceforge.net/config_misc.html#FinalParameters) Parameters to a method must be `final`. @@ -2740,6 +2736,12 @@ These checks are not enabled. Notes are included for each explaining why. Couldn't get my IDE's (IntelliJ) code style to match. +#### [FinalLocalVariable](http://checkstyle.sourceforge.net/config_coding.html#FinalLocalVariable) + +Doesn't recognise Lombok's `val` as being `final`. + +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. diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 0730dfb..66fa2ab 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -85,7 +85,6 @@ - From f73a7af6ab3a75f8709c58788278a5c7f35e38b1 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 11 Sep 2016 08:29:39 +0100 Subject: [PATCH 46/48] PackageName: allow numbers in package names, after an initial letter --- README.md | 4 ++-- src/main/resources/net/kemitix/checkstyle.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9690921..6292a06 100644 --- a/README.md +++ b/README.md @@ -1809,9 +1809,9 @@ 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-z]+)*$`. +Identifiers must match `^[a-z]+(\.[a-z][a-z0-9]+)*$`. #### [ParameterName](http://checkstyle.sourceforge.net/config_naming.html#ParameterName) diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/src/main/resources/net/kemitix/checkstyle.xml index 66fa2ab..997c29e 100644 --- a/src/main/resources/net/kemitix/checkstyle.xml +++ b/src/main/resources/net/kemitix/checkstyle.xml @@ -180,7 +180,7 @@ - + From 23e82e12e5261585163e028edecbcd48ffa3cf89 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 11 Sep 2016 14:59:32 +0100 Subject: [PATCH 47/48] pom.xml: version set to 1.0.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 484d94f..43eaa15 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.kemitix kemitix-checkstyle-ruleset - 0.2.0-SNAPSHOT + 1.0.0 jar Kemitix Checkstyle Ruleset @@ -131,4 +131,4 @@ - \ No newline at end of file + From ecd801bb9f7d16065dde4d19868de6bf0954b119 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 11 Sep 2016 14:59:39 +0100 Subject: [PATCH 48/48] CHANGELOG --- CHANGELOG | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index ceba5c7..cd8bd3e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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