diff --git a/README.md b/README.md index a0d4d25..ce8abaf 100644 --- a/README.md +++ b/README.md @@ -2332,8 +2332,6 @@ if (condition) { } return ""; ```` - -Example: [MoveVariableInsideIf.java](https://github.com/kemitix/kemitix-checkstyle-ruleset/blob/master/regressions/src/main/java/net/kemitix/checkstyle/regressions/MoveVariableInsideIf.java) #### [NameConventionForJunit4TestClasses](http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/NameConventionForJunit4TestClassesCheck.html) Checks the names of JUnit test classes. Classes checked are those that have at least one method annotated with `Test` or `org.junit.Test`. diff --git a/builder/src/main/resources/rules/MoveVariableInsideIfCheck.md b/builder/src/main/resources/rules/MoveVariableInsideIfCheck.md index e5304b3..59a16c5 100644 --- a/builder/src/main/resources/rules/MoveVariableInsideIfCheck.md +++ b/builder/src/main/resources/rules/MoveVariableInsideIfCheck.md @@ -18,5 +18,3 @@ if (condition) { } return ""; ```` - -Example: [MoveVariableInsideIf.java](https://github.com/kemitix/kemitix-checkstyle-ruleset/blob/master/regressions/src/main/java/net/kemitix/checkstyle/regressions/MoveVariableInsideIf.java) diff --git a/pom.xml b/pom.xml index 6cbff27..be2a04a 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,6 @@ builder ruleset - regressions tile diff --git a/regressions/pom.xml b/regressions/pom.xml deleted file mode 100644 index dff6910..0000000 --- a/regressions/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - 4.0.0 - - net.kemitix - kemitix-parent - 5.1.0 - - - - net.kemitix.checkstyle - regressions - 4.1.0-SNAPSHOT - - - true - 2.11 - 0.8.1 - - 1.8 - 8.10 - 1.29.0 - 3.0.0 - ${project.version} - - - 0-disabled - net/kemitix/checkstyle-${kemitix.checkstyle.ruleset.level}.xml - net.kemitix.checkstyle.regressions - true - 2.5.6 - - - - - org.immutables - value - ${immutables-value.version} - provided - - - - - - - io.repaint.maven - tiles-maven-plugin - ${tiles-maven-plugin.version} - true - - - net.kemitix.tiles:maven-plugins:${kemitix-tiles.version} - net.kemitix.tiles:compiler:${kemitix-tiles.version} - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle-plugin.version} - - - com.puppycrawl.tools - checkstyle - ${checkstyle.version} - - - com.github.sevntu-checkstyle - sevntu-checkstyle-maven-plugin - ${sevntu.version} - - - net.kemitix.checkstyle - ruleset - ${kemitix.checkstyle.ruleset.version} - - - - ${kemitix.checkstyle.ruleset.location} - - - - verify - - check - - - - - - - - diff --git a/regressions/src/main/java/net/kemitix/checkstyle/regressions/AvoidDefaultSerializableInInnerClasses.java b/regressions/src/main/java/net/kemitix/checkstyle/regressions/AvoidDefaultSerializableInInnerClasses.java deleted file mode 100644 index 51f1157..0000000 --- a/regressions/src/main/java/net/kemitix/checkstyle/regressions/AvoidDefaultSerializableInInnerClasses.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Campbell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies - * or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.kemitix.checkstyle.regressions; - -import java.io.Serializable; - -/** - * Regression test for {@code AvoidDefaultSerializableInInnerClasses}. - * - * @author Paul Campbell (pcampbell@kemitix.net) - */ -public class AvoidDefaultSerializableInInnerClasses { - - /** - * Inner class should not use default implementations of {@code readObject()} and {@code writeObject()}. - */ - public class InnerClass implements Serializable { - - } - -} diff --git a/regressions/src/main/java/net/kemitix/checkstyle/regressions/Basic.java b/regressions/src/main/java/net/kemitix/checkstyle/regressions/Basic.java deleted file mode 100644 index f269c44..0000000 --- a/regressions/src/main/java/net/kemitix/checkstyle/regressions/Basic.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Campbell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies - * or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.kemitix.checkstyle.regressions; - -/** - * Sample class with no checkstyle issues. - * - * @author Paul Campbell (pcampbell@kemitix.net) - */ -class Basic { - -} diff --git a/regressions/src/main/java/net/kemitix/checkstyle/regressions/EmptyPublicCtorInClass.java b/regressions/src/main/java/net/kemitix/checkstyle/regressions/EmptyPublicCtorInClass.java deleted file mode 100644 index 0c49972..0000000 --- a/regressions/src/main/java/net/kemitix/checkstyle/regressions/EmptyPublicCtorInClass.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Campbell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies - * or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.kemitix.checkstyle.regressions; - -/** - * Regression demo for {@code EmptyPublicCtorInClassCheck}. - * - * @author Paul Campbell (pcampbell@kemitix.net) - */ -public class EmptyPublicCtorInClass { - - /** - * Useless empty public constructors. - */ - EmptyPublicCtorInClass() { - } - -} diff --git a/regressions/src/main/java/net/kemitix/checkstyle/regressions/ExplicitInitialization.java b/regressions/src/main/java/net/kemitix/checkstyle/regressions/ExplicitInitialization.java deleted file mode 100644 index 9c20896..0000000 --- a/regressions/src/main/java/net/kemitix/checkstyle/regressions/ExplicitInitialization.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Campbell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies - * or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.kemitix.checkstyle.regressions; - -/** - * Regression demo for {@code ExplicitInitializationCheck}. - * - * @author Paul Campbell (pcampbell@kemitix.net). - */ -@SuppressWarnings({"hideutilityclassconstructor", "PMD.UnusedPrivateField"}) -class ExplicitInitialization { - - private boolean validBoolean = false; - - private int validInt = 0; - - private String validString = ""; - - private Object validObject = new Object(); - - private Boolean invalidBoolean = null; - - private Integer invalidInteger = null; - - private String invalidString = null; - - private Object invalidObject = null; - -} diff --git a/regressions/src/main/java/net/kemitix/checkstyle/regressions/FinalizeImplementation.java b/regressions/src/main/java/net/kemitix/checkstyle/regressions/FinalizeImplementation.java deleted file mode 100644 index 849afb7..0000000 --- a/regressions/src/main/java/net/kemitix/checkstyle/regressions/FinalizeImplementation.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Campbell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies - * or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.kemitix.checkstyle.regressions; - -/** - * Regression test for {@code FinalizeImplementationCheck}. - * - * @author Paul Campbell pcampbell@kemitix.net - */ -class FinalizeImplementation { - - /** - * Negates effect of superclass finalize. - */ - @SuppressWarnings("PMD.EmptyFinalizer") - protected void finalize() { - // doesn't call super.finalize() - } - -} diff --git a/regressions/src/main/java/net/kemitix/checkstyle/regressions/MoveVariableInsideIf.java b/regressions/src/main/java/net/kemitix/checkstyle/regressions/MoveVariableInsideIf.java deleted file mode 100644 index 81c76d3..0000000 --- a/regressions/src/main/java/net/kemitix/checkstyle/regressions/MoveVariableInsideIf.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Campbell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies - * or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.kemitix.checkstyle.regressions; - -/** - * Regression demo for {@code MoveVariableInsideIfCheck}. - * - * @author Paul Campbell (pcampbell@kemitix.net) - */ -class MoveVariableInsideIf { - - private String input = "1"; - - private boolean condition; - - private String method(final String variable) { - return "value: " + variable; - } - - /** - * Fails if not suppressed. - * - * @return value - */ - protected String invalid() { - String variable = input.substring(1); - if (condition) { - return method(variable); - } - return ""; - } - - /** - * Rewrite {@link #invalid()} as this to pass. - * - * @return value - */ - protected String valid() { - if (condition) { - String variable = input.substring(1); - return method(variable); - } - return ""; - } -} diff --git a/regressions/src/main/java/net/kemitix/checkstyle/regressions/Values.java b/regressions/src/main/java/net/kemitix/checkstyle/regressions/Values.java deleted file mode 100644 index 30a8b17..0000000 --- a/regressions/src/main/java/net/kemitix/checkstyle/regressions/Values.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Campbell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies - * or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.kemitix.checkstyle.regressions; - -import org.immutables.value.Value; - -/** - * Regression subject for org.immutables. - * - * @author Paul Campbell (pcampbell@kemitix.net) - */ -@Value.Immutable -public interface Values { - - /** - * Gets the ID. - * - * @return the id - */ - @Value.Parameter - long getId(); - -} diff --git a/regressions/src/main/java/net/kemitix/checkstyle/regressions/package-info.java b/regressions/src/main/java/net/kemitix/checkstyle/regressions/package-info.java deleted file mode 100644 index e449fd3..0000000 --- a/regressions/src/main/java/net/kemitix/checkstyle/regressions/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Campbell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies - * or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package net.kemitix.checkstyle.regressions; diff --git a/set-version.sh b/set-version.sh index 717be2e..136b733 100644 --- a/set-version.sh +++ b/set-version.sh @@ -12,4 +12,4 @@ NEXT=$2 echo Updating version from $CURRENT to $NEXT ./mvnw versions:set -DnewVersion=$NEXT -perl -p -i -e "s,$CURRENT