Author: dennisl Date: Fri May 1 19:07:06 2015 New Revision: 1677213 URL: http://svn.apache.org/r1677213 Log: [MCHECKSTYLE-268] Add flag/option to use built-in Google style
Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/invoker.properties - copied unchanged from r1677129, maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/invoker.properties maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/pom.xml - copied, changed from r1677129, maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/pom.xml maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/org/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/org/MyClass.java (with props) maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/verify.groovy - copied, changed from r1677129, maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/verify.groovy Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/config/index.apt maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm Copied: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/pom.xml (from r1677129, maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/pom.xml) URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/pom.xml?p2=maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/pom.xml&p1=maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/pom.xml&r1=1677129&r2=1677213&rev=1677213&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/pom.xml (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/pom.xml Fri May 1 19:07:06 2015 @@ -18,21 +18,15 @@ ~ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.maven.plugins.checkstyle</groupId> - <artifactId>check-fail</artifactId> + <artifactId>MCHECKSTYLE-268</artifactId> <version>1.0-SNAPSHOT</version> - <packaging>jar</packaging> - - <url>http://maven.apache.org/</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <checkstyle.violation.ignore>NewlineAtEndOfFile</checkstyle.violation.ignore> </properties> <build> @@ -47,6 +41,10 @@ <goals> <goal>check</goal> </goals> + <configuration> + <configLocation>google_checks.xml</configLocation> + <violationSeverity>warning</violationSeverity> + </configuration> </execution> </executions> </plugin> Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/org/MyClass.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/org/MyClass.java?rev=1677213&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/org/MyClass.java (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/org/MyClass.java Fri May 1 19:07:06 2015 @@ -0,0 +1,29 @@ +package org; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Yada yada yada. + */ +public class MyClass { + // This is a line that is more than 100 characters long and starts with a tab character, so it should trigger two violations using google_checks.xml + public static void main(String[] args) { + } +} Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/org/MyClass.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/src/main/java/org/MyClass.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Copied: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/verify.groovy (from r1677129, maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/verify.groovy) URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/verify.groovy?p2=maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/verify.groovy&p1=maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/verify.groovy&r1=1677129&r2=1677213&rev=1677213&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/check-fail/verify.groovy (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-268/verify.groovy Fri May 1 19:07:06 2015 @@ -19,4 +19,4 @@ */ def buildLog = new File( basedir, 'build.log' ) -assert buildLog.text.contains( "[INFO] There is 1 error reported by Checkstyle" ) +assert buildLog.text.contains( "You have 2 Checkstyle violations." ) Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java?rev=1677213&r1=1677212&r2=1677213&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java Fri May 1 19:07:06 2015 @@ -102,10 +102,11 @@ public abstract class AbstractCheckstyle * </p> * <p/> * <p> - * There are 2 predefined rulesets included in Maven Checkstyle Plugin: + * There are 3 predefined rulesets included in Maven Checkstyle Plugin: * </p> * <ul> * <li><code>sun_checks.xml</code>: Sun Checks.</li> + * <li><code>google_checks.xml</code>: Google Checks.</li> * <li><code>config/maven_checks.xml</code>: Maven Source Checks.</li> * </ul> */ Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java?rev=1677213&r1=1677212&r2=1677213&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java Fri May 1 19:07:06 2015 @@ -190,10 +190,11 @@ public class CheckstyleViolationCheckMoj * </p> * <p/> * <p> - * There are 2 predefined rulesets. + * There are 3 predefined rulesets. * </p> * <ul> * <li><code>sun_checks.xml</code>: Sun Checks.</li> + * <li><code>google_checks.xml</code>: Google Checks.</li> * <li><code>config/maven_checks.xml</code>: Maven Source Checks.</li> * </ul> * Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/config/index.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/config/index.apt?rev=1677213&r1=1677212&r2=1677213&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/config/index.apt (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/config/index.apt Fri May 1 19:07:06 2015 @@ -34,6 +34,8 @@ Predefined Rulesets * {{{http://checkstyle.sourceforge.net/sun_style.html}<<<sun_checks.xml>>>}} + * {{{http://checkstyle.sourceforge.net/google_style.html}<<<google_checks.xml>>>}} + * {{{/shared/maven-shared-resources/maven_checks.html}<<<config/maven_checks.xml>>>}} [] @@ -56,3 +58,7 @@ Predefined Rulesets <<<config/sun_checks.xml>>> predefined ruleset. This was removed in version 2.16 and the plugin instead references the original configuration provided by the Checkstyle project. + + In versions 2.16 and later the plugin references the <<<google_checks.xml>>> + predefined ruleset. This is a configuration provided by the Checkstyle + project. Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm?rev=1677213&r1=1677212&r2=1677213&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm Fri May 1 19:07:06 2015 @@ -55,9 +55,11 @@ Using a Custom Checkstyle Checker Config resource named <<<checkstyle.xml>>> within the compile scope of the dependencies or build extensions classpath. - There are 2 predefined Checkstyle configuration definitions that ship with the Checkstyle Plugin, + There are 3 predefined Checkstyle configuration definitions that ship with the Checkstyle Plugin, the Sun Microsystems Definition is selected by default. * <<sun_checks.xml>> - Sun Microsystems Definition (default). + * <<google_checks.xml>> - Google Definition. + * <<config/maven_checks.xml>> - Maven Development Definitions. Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm?rev=1677213&r1=1677212&r2=1677213&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm Fri May 1 19:07:06 2015 @@ -36,7 +36,8 @@ ${project.name} {{{./examples/upgrading-checkstyle.html}upgrade the version used at runtime}}. The plugin can be configured in the project's POM. Predefined rulesets are included with the plugin, these are: - {{{http://checkstyle.sourceforge.net/sun_style.html}<<<sun_checks.xml>>>}} and + {{{http://checkstyle.sourceforge.net/sun_style.html}<<<sun_checks.xml>>>}}, + {{{http://checkstyle.sourceforge.net/google_style.html}<<<google_checks.xml>>>}} and {{{/shared/maven-shared-resources/maven_checks.html}<<<config/maven_checks.xml>>>}}. You can also use a custom ruleset by specifying it in the plugin configuration.