diff --git a/README.md b/README.md index 919171e..83b34f8 100644 --- a/README.md +++ b/README.md @@ -22,76 +22,41 @@ The ruleset includes checks from both the core Checkstyle library and from the S ## Usage -To use this ruleset in your `maven-checkstyle-plugin` configuration add `checkstyle`, `sevntu-checkstyle-maven-plugin` and `kemitix-checktyle-ruleset` as dependencies of the `maven-checkstyle-plugin`. +To use this ruleset add the plugin `kemitix-checktyle-ruleset-maven-plugin`. +The `maven-checkstyle-plugin` will be included automatically. -You need to include `checkstyle` as the version bundled with the `maven-checkstyle-plugin` is not up-to-date enough. +The following goals implement increasingly strict rulesets: -Select the `configLocation` for the level of strictness required: - -* checkstyle-1-layout.xml -* checkstyle-2-naming.xml -* checkstyle-3-javadoc.xml -* checkstyle-4-tweaks.xml -* checkstyle-5-complexity.xml - -Only specify a single `configLocation` as each increasing level includes all the rules -from the previous. +* 1-layout +* 2-naming +* 3-javadoc +* 4-tweaks +* 5-complexity ```` - 2.17 - 7.3 - 1.22.0 2.0.0 5-complexity + - - - - 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-checkstyle-maven-plugin.version} - - - net.kemitix - kemitix-checkstyle-ruleset - ${kemitix-checkstyle-ruleset.version} - - - - net/kemitix/checkstyle-${kemitix-checkstyle-ruleset.level}.xml - - - - - org.apache.maven.plugins - maven-checkstyle-plugin + net.kemitix + kemitix-checkstyle-ruleset-maven-plugin + ${kemitix-checkstyle-ruleset.version} - validate validate - check - checkstyle + ${kemitix-checkstyle-ruleset.level} - + + sevntu-maven diff --git a/builder/pom.xml b/builder/pom.xml index e7c2116..9099d57 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -34,9 +34,12 @@ 2016 + 1.8 + UTF-8 + UTF-8 1.4.3.RELEASE 2.0.0-SNAPSHOT - 5-complexity + 1.16.12 3.6.1 2.3.4 1.0.0 @@ -66,6 +69,8 @@ org.projectlombok lombok + ${lombok.version} + provided com.speedment.common @@ -81,6 +86,7 @@ org.assertj assertj-core ${assertj.version} + test me.andrz @@ -90,35 +96,28 @@ - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven.checkstyle.plugin.version} - - net/kemitix/checkstyle-${kemitix-checkstyle-ruleset.level}.xml - - - - + + net.kemitix + kemitix-checkstyle-ruleset-maven-plugin + ${kemitix-checkstyle-ruleset.version} + org.springframework.boot spring-boot-maven-plugin ${spring-boot.version} - - - - - - - - - - - - + + true + + + + + + repackage + + + + org.eluder.coveralls diff --git a/builder/src/main/java/net/kemitix/checkstyle/ruleset/builder/RulesProperties.java b/builder/src/main/java/net/kemitix/checkstyle/ruleset/builder/RulesProperties.java index 6abb1e8..5eee953 100644 --- a/builder/src/main/java/net/kemitix/checkstyle/ruleset/builder/RulesProperties.java +++ b/builder/src/main/java/net/kemitix/checkstyle/ruleset/builder/RulesProperties.java @@ -25,7 +25,6 @@ SOFTWARE. package net.kemitix.checkstyle.ruleset.builder; import lombok.Getter; -import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @@ -37,7 +36,6 @@ import java.util.List; * * @author Paul Campbell (pcampbell@kemitix.net) */ -@Slf4j @Getter @Configuration @ConfigurationProperties diff --git a/builder/src/main/resources/README-template.md b/builder/src/main/resources/README-template.md index 528c337..489eaa5 100644 --- a/builder/src/main/resources/README-template.md +++ b/builder/src/main/resources/README-template.md @@ -22,76 +22,41 @@ The ruleset includes checks from both the core Checkstyle library and from the S ## Usage -To use this ruleset in your `maven-checkstyle-plugin` configuration add `checkstyle`, `sevntu-checkstyle-maven-plugin` and `kemitix-checktyle-ruleset` as dependencies of the `maven-checkstyle-plugin`. +To use this ruleset add the plugin `kemitix-checktyle-ruleset-maven-plugin`. +The `maven-checkstyle-plugin` will be included automatically. -You need to include `checkstyle` as the version bundled with the `maven-checkstyle-plugin` is not up-to-date enough. +The following goals implement increasingly strict rulesets: -Select the `configLocation` for the level of strictness required: - -* checkstyle-1-layout.xml -* checkstyle-2-naming.xml -* checkstyle-3-javadoc.xml -* checkstyle-4-tweaks.xml -* checkstyle-5-complexity.xml - -Only specify a single `configLocation` as each increasing level includes all the rules -from the previous. +* 1-layout +* 2-naming +* 3-javadoc +* 4-tweaks +* 5-complexity ```` - 2.17 - 7.3 - 1.22.0 2.0.0 5-complexity + - - - - 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-checkstyle-maven-plugin.version} - - - net.kemitix - kemitix-checkstyle-ruleset - ${kemitix-checkstyle-ruleset.version} - - - - net/kemitix/checkstyle-${kemitix-checkstyle-ruleset.level}.xml - - - - - org.apache.maven.plugins - maven-checkstyle-plugin + net.kemitix + kemitix-checkstyle-ruleset-maven-plugin + ${kemitix-checkstyle-ruleset.version} - validate validate - check - checkstyle + ${kemitix-checkstyle-ruleset.level} - + + sevntu-maven diff --git a/plugin-sample/LICENSE.txt b/plugin-sample/LICENSE.txt new file mode 100644 index 0000000..00c515a --- /dev/null +++ b/plugin-sample/LICENSE.txt @@ -0,0 +1,23 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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. +*/ diff --git a/plugin-sample/pom.xml b/plugin-sample/pom.xml new file mode 100644 index 0000000..15d13c9 --- /dev/null +++ b/plugin-sample/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + + net.kemitix + kemitix-checkstyle-ruleset-plugin-sample + 2.0.0-SNAPSHOT + + + + UTF-8 + UTF-8 + + + + + + net.kemitix + kemitix-checkstyle-ruleset-maven-plugin + ${project.version} + + + validate + + 2-naming + + + + + + + + + + sevntu-maven + sevntu-maven + http://sevntu-checkstyle.github.io/sevntu.checkstyle/maven2 + + + diff --git a/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java b/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java new file mode 100644 index 0000000..9f7eaba --- /dev/null +++ b/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java @@ -0,0 +1,38 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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.sample; + +/** + * Sample class to test the Kemitix Checkstyle Ruleset Maven Plugin against. + * + * @author Paul Campbell (paul.campbell@hubio.com) + */ +public class Sample { + + + public static void main(String[] args) { + System.out.println("Sample!"); + } +} diff --git a/plugin/LICENSE.txt b/plugin/LICENSE.txt new file mode 100644 index 0000000..00c515a --- /dev/null +++ b/plugin/LICENSE.txt @@ -0,0 +1,23 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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. +*/ diff --git a/plugin/pom.xml b/plugin/pom.xml new file mode 100644 index 0000000..62f63f2 --- /dev/null +++ b/plugin/pom.xml @@ -0,0 +1,104 @@ + + + 4.0.0 + + + net.kemitix + kemitix-checkstyle-ruleset-parent + 2.0.0-SNAPSHOT + + + kemitix-checkstyle-ruleset-maven-plugin + maven-plugin + Kemitix Checkstyle Ruleset Maven Plugin + Checkstyle configuration using the Kemitix Checkstyle Ruleset + + + 1.8 + UTF-8 + UTF-8 + 3.3.9 + 3.6.0 + 3.5 + 3.5 + 2.2.0 + 1.16.12 + 1.0.0 + + + + + org.apache.maven + maven-plugin-api + ${maven.version} + + + org.apache.maven + maven-core + ${maven.version} + + + org.apache.maven.plugin-tools + maven-plugin-annotations + ${maven-plugin-annotations.version} + provided + + + org.twdata.maven + mojo-executor + ${mojo-executor.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + me.andrz + map-builder + ${map-builder.version} + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + ${maven-plugin-plugin.version} + + + help-goal + + helpmojo + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + -Xlint:unchecked + + true + true + 1.8 + 1.8 + + + + + + + sevntu-maven + sevntu-maven + http://sevntu-checkstyle.github.io/sevntu.checkstyle/maven2 + + + diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java new file mode 100644 index 0000000..6098958 --- /dev/null +++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java @@ -0,0 +1,116 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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.ruleset.plugin; + +import lombok.Setter; +import lombok.val; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.BuildPluginManager; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.twdata.maven.mojoexecutor.MojoExecutor; + +/** + * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset. + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +public abstract class AbstractCheckMojo extends AbstractMojo { + + private static final String CHECKSTYLE_GROUPID = "com.puppycrawl.tools"; + + private static final String CHECKSTYLE_ARTIFACTID = "checkstyle"; + + private static final String SEVNTU_GROUPID = "com.github.sevntu.checkstyle"; + + private static final String SEVNTU_ARTIFACTID = "sevntu-checkstyle-maven-plugin"; + + private static final String KEMITIX_GROUPID = "net.kemitix"; + + private static final String KEMITIX_ARTIFACTID = "kemitix-checkstyle-ruleset"; + + private static final String APACHE_PLUGIN_GROUPID = "org.apache.maven.plugins"; + + private static final String APACHE_PLUGIN_ARTIFACTID = "maven-checkstyle-plugin"; + + private static final String CONFIG_LOCATION = "configLocation"; + + @Setter + @Parameter(defaultValue = "2.17") + private String mavenCheckstylePluginVersion; + + @Setter + @Parameter(defaultValue = "7.3") + private String checkstyleVersion; + + @Setter + @Parameter(defaultValue = "1.23.0") + private String sevntuVersion; + + @Setter + @Parameter(defaultValue = "2.0.0-SNAPSHOT") + private String rulesetVersion; + + @Setter + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject mavenProject; + + @Setter + @Parameter(defaultValue = "${session}", readonly = true) + private MavenSession mavenSession; + + @Component + private BuildPluginManager pluginManager; + + /** + * Execute Checkstyle Check. + * + * @param level The level of config file to use. + * + * @throws MojoExecutionException on execution error + * @throws MojoFailureException on execution failure + */ + protected final void performCheck(final String level) throws MojoExecutionException, MojoFailureException { + val checkstyle = MojoExecutor.dependency(CHECKSTYLE_GROUPID, CHECKSTYLE_ARTIFACTID, checkstyleVersion); + val sevntu = MojoExecutor.dependency(SEVNTU_GROUPID, SEVNTU_ARTIFACTID, sevntuVersion); + val ruleset = MojoExecutor.dependency(KEMITIX_GROUPID, KEMITIX_ARTIFACTID, rulesetVersion); + val checkstylePlugin = + MojoExecutor.plugin(APACHE_PLUGIN_GROUPID, APACHE_PLUGIN_ARTIFACTID, mavenCheckstylePluginVersion, + MojoExecutor.dependencies(checkstyle, sevntu, ruleset) + ); + val configLocation = + MojoExecutor.element(CONFIG_LOCATION, String.format("net/kemitix/checkstyle-%s.xml", level)); + + getLog().info( + String.format("Running Checkstyle %s (sevntu: %s) with %s", checkstyleVersion, sevntuVersion, level)); + MojoExecutor.executeMojo(checkstylePlugin, "check", MojoExecutor.configuration(configLocation), + MojoExecutor.executionEnvironment(mavenProject, mavenSession, pluginManager) + ); + } +} diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/ComplexityCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/ComplexityCheckMojo.java new file mode 100644 index 0000000..94090c8 --- /dev/null +++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/ComplexityCheckMojo.java @@ -0,0 +1,44 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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.ruleset.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + +/** + * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset: COMPLEXITY, TWEAKS, JAVADOC, NAMING and LAYOUT. + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +@Mojo(name = "5-complexity", defaultPhase = LifecyclePhase.VALIDATE) +public class ComplexityCheckMojo extends AbstractCheckMojo { + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + performCheck("5-complexity"); + } +} diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/JavadocCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/JavadocCheckMojo.java new file mode 100644 index 0000000..2952110 --- /dev/null +++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/JavadocCheckMojo.java @@ -0,0 +1,44 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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.ruleset.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + +/** + * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset: JAVADOC, NAMING and LAYOUT. + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +@Mojo(name = "3-javadoc", defaultPhase = LifecyclePhase.VALIDATE) +public class JavadocCheckMojo extends AbstractCheckMojo { + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + performCheck("3-javadoc"); + } +} diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/LayoutCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/LayoutCheckMojo.java new file mode 100644 index 0000000..e6aee8e --- /dev/null +++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/LayoutCheckMojo.java @@ -0,0 +1,44 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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.ruleset.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + +/** + * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset: LAYOUT. + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +@Mojo(name = "1-layout", defaultPhase = LifecyclePhase.VALIDATE) +public class LayoutCheckMojo extends AbstractCheckMojo { + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + performCheck("1-layout"); + } +} diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/NamingCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/NamingCheckMojo.java new file mode 100644 index 0000000..a650885 --- /dev/null +++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/NamingCheckMojo.java @@ -0,0 +1,44 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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.ruleset.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + +/** + * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Rulesets: NAMING and LAYOUT. + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +@Mojo(name = "2-naming", defaultPhase = LifecyclePhase.VALIDATE) +public class NamingCheckMojo extends AbstractCheckMojo { + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + performCheck("2-naming"); + } +} diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/TweaksCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/TweaksCheckMojo.java new file mode 100644 index 0000000..6cb2144 --- /dev/null +++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/TweaksCheckMojo.java @@ -0,0 +1,44 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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.ruleset.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + +/** + * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset: TWEAKS, JAVADOC, NAMING and LAYOUT. + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +@Mojo(name = "4-tweaks", defaultPhase = LifecyclePhase.VALIDATE) +public class TweaksCheckMojo extends AbstractCheckMojo { + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + performCheck("4-tweaks"); + } +} diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/package-info.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/package-info.java new file mode 100644 index 0000000..af77c05 --- /dev/null +++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/package-info.java @@ -0,0 +1,31 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 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. +*/ + +/** + * . + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ + +package net.kemitix.checkstyle.ruleset.plugin; diff --git a/pom.xml b/pom.xml index 293a289..f759f57 100644 --- a/pom.xml +++ b/pom.xml @@ -12,9 +12,16 @@ Kemitix Checkstyle Ruleset (Parent) Parent POM for the Kemitix Checkstyle Ruleset and it's Builder + + UTF-8 + UTF-8 + + builder ruleset + plugin + plugin-sample