maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gb...@apache.org
Subject svn commit: r1796441 - in /maven/plugins/trunk/maven-checkstyle-plugin/src: it/MCHECKSTYLE-338/ it/MCHECKSTYLE-338/empty-logging-check/ it/MCHECKSTYLE-338/empty-logging-check/src/ it/MCHECKSTYLE-338/empty-logging-check/src/main/ it/MCHECKSTYLE-338/empt...
Date Sat, 27 May 2017 19:40:31 GMT
Author: gboue
Date: Sat May 27 19:40:30 2017
New Revision: 1796441

URL: http://svn.apache.org/viewvc?rev=1796441&view=rev
Log:
[MCHECKSTYLE-338] Add support for 'omitIgnoredModules'

The boolean parameter 'omitIgnoredModules' controls whether modules in a Checkstyle configuration
with a severity set to 'ignore' should be omitted or still executed during Checkstyle invocation.
This defaults to false to be consistent with the previous behavior of the plugin.

IT is done by writing a custom check that does nothing except always logging as an error the
name of the file it was invoked on. This is used to verify whether the check was invoked or
not depending on the value of 'omitIgnoredModules'.

Added:
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/checkstyle.xml   (with
props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml
  (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/checkstyle/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/checkstyle/EmptyLoggingCheck.java
  (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/invoker.properties
  (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/pom.xml
  (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/checkstyle/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/checkstyle/TestFalse.java
  (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/pom.xml
  (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/checkstyle/
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/checkstyle/TestTrue.java
  (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/pom.xml   (with props)
    maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/verify.groovy   (with
props)
Modified:
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleExecutorRequest.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/checkstyle.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/checkstyle.xml?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/checkstyle.xml (added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/checkstyle.xml Sat
May 27 19:40:30 2017
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+<module name="Checker">
+  <module name="org.apache.maven.plugins.checkstyle.EmptyLoggingCheck">
+    <property name="severity" value="ignore" />
+  </module>
+</module>

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/checkstyle.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/checkstyle.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml
(added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml
Sat May 27 19:40:30 2017
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<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>
+  <parent>
+    <groupId>org.apache.maven.plugins.checkstyle</groupId>
+    <artifactId>MCHECKSTYLE-338</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>empty-logging-check</artifactId>
+  <dependencies>
+    <dependency>
+      <groupId>com.puppycrawl.tools</groupId>
+      <artifactId>checkstyle</artifactId>
+      <version>@checkstyleVersion@</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/checkstyle/EmptyLoggingCheck.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/checkstyle/EmptyLoggingCheck.java?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/checkstyle/EmptyLoggingCheck.java
(added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/checkstyle/EmptyLoggingCheck.java
Sat May 27 19:40:30 2017
@@ -0,0 +1,43 @@
+package org.apache.maven.plugins.checkstyle;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.util.List;
+
+import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck;
+import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
+import com.puppycrawl.tools.checkstyle.api.LocalizedMessage;
+import com.puppycrawl.tools.checkstyle.api.SeverityLevel;
+
+public class EmptyLoggingCheck
+    extends AbstractFileSetCheck
+{
+
+    @Override
+    protected void processFiltered( File file, List<String> lines )
+        throws CheckstyleException
+    {
+        getMessageCollector().add( new LocalizedMessage( 0, 0, getMessageBundle(),
+                                                         "EmptyLoggingCheck on file " + file.getName(),
new Object[0],
+                                                         SeverityLevel.ERROR, getId(), getClass(),
null ) );
+    }
+
+}

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/checkstyle/EmptyLoggingCheck.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/empty-logging-check/src/main/java/org/apache/maven/plugins/checkstyle/EmptyLoggingCheck.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/invoker.properties?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/invoker.properties
(added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/invoker.properties
Sat May 27 19:40:30 2017
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals=clean verify
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/pom.xml?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/pom.xml
(added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/pom.xml
Sat May 27 19:40:30 2017
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<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>
+  <parent>
+    <groupId>org.apache.maven.plugins.checkstyle</groupId>
+    <artifactId>MCHECKSTYLE-338</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>omitignoredmodules-false</artifactId>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <omitIgnoredModules>false</omitIgnoredModules>
+          <failOnViolation>false</failOnViolation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/checkstyle/TestFalse.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/checkstyle/TestFalse.java?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/checkstyle/TestFalse.java
(added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/checkstyle/TestFalse.java
Sat May 27 19:40:30 2017
@@ -0,0 +1,25 @@
+package org.apache.maven.plugins.checkstyle;
+
+/*
+ * 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.
+ */
+
+public class TestFalse
+{
+
+}

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/checkstyle/TestFalse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-false/src/main/java/org/apache/maven/plugins/checkstyle/TestFalse.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/pom.xml?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/pom.xml
(added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/pom.xml
Sat May 27 19:40:30 2017
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<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>
+  <parent>
+    <groupId>org.apache.maven.plugins.checkstyle</groupId>
+    <artifactId>MCHECKSTYLE-338</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>omitignoredmodules-true</artifactId>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <omitIgnoredModules>true</omitIgnoredModules>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/checkstyle/TestTrue.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/checkstyle/TestTrue.java?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/checkstyle/TestTrue.java
(added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/checkstyle/TestTrue.java
Sat May 27 19:40:30 2017
@@ -0,0 +1,25 @@
+package org.apache.maven.plugins.checkstyle;
+
+/*
+ * 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.
+ */
+
+public class TestTrue
+{
+
+}

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/checkstyle/TestTrue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/omitignoredmodules-true/src/main/java/org/apache/maven/plugins/checkstyle/TestTrue.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/pom.xml?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/pom.xml (added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/pom.xml Sat May 27
19:40:30 2017
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<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>MCHECKSTYLE-338</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <url>https://issues.apache.org/jira/browse/MCHECKSTYLE-338</url>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <version>@pom.version@</version>
+          <configuration>
+            <configLocation>checkstyle.xml</configLocation>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.apache.maven.plugins.checkstyle</groupId>
+              <artifactId>empty-logging-check</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
+          <executions>
+            <execution>
+              <goals>
+                <goal>check</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+  </pluginManagement>
+  </build>
+  <modules>
+    <module>empty-logging-check</module>
+    <module>omitignoredmodules-false</module>
+    <module>omitignoredmodules-true</module>
+  </modules>
+</project>

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/verify.groovy?rev=1796441&view=auto
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/verify.groovy (added)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/verify.groovy Sat May
27 19:40:30 2017
@@ -0,0 +1,31 @@
+
+/*
+ * 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.
+ */
+
+buildLog = new File( basedir, 'build.log' )
+
+// verify that the "check" goal correctly raised a violation when the ignored module is not
omitted
+assert buildLog.text.contains( 'EmptyLogging: EmptyLoggingCheck on file TestFalse.java' )
+assert !buildLog.text.contains( 'EmptyLogging: EmptyLoggingCheck on file TestTrue.java' )
+
+// verify that the "checkstyle" goal launched by "check" does the same
+site = new File( basedir, 'omitignoredmodules-false/target/site/checkstyle.html' )
+assert site.text.contains( 'EmptyLoggingCheck on file TestFalse.java' )
+site = new File( basedir, 'omitignoredmodules-true/target/site/checkstyle.html' )
+assert !site.text.contains( 'EmptyLoggingCheck on file TestTrue.java' )

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-338/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java?rev=1796441&r1=1796440&r2=1796441&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
(original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
Sat May 27 19:40:30 2017
@@ -416,6 +416,15 @@ public abstract class AbstractCheckstyle
     private List<String> treeWalkerNames;
 
     /**
+     * Specifies whether modules with a configured severity of <code>ignore</code>
should be omitted during Checkstyle
+     * invocation.
+     * 
+     * @since 3.0.0
+     */
+    @Parameter( defaultValue = "false" )
+    private boolean omitIgnoredModules;
+
+    /**
      */
     @Component
     protected ResourceManager locator;
@@ -470,7 +479,8 @@ public abstract class AbstractCheckstyle
         try
         {
             CheckstyleExecutorRequest request = createRequest().setLicenseArtifacts( collectArtifacts(
"license" ) )
-                            .setConfigurationArtifacts( collectArtifacts( "configuration"
) );
+                            .setConfigurationArtifacts( collectArtifacts( "configuration"
) )
+                            .setOmitIgnoredModules( omitIgnoredModules );
 
             CheckstyleResults results = checkstyleExecutor.executeCheckstyle( request );
 

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java?rev=1796441&r1=1796440&r2=1796441&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
(original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
Sat May 27 19:40:30 2017
@@ -474,6 +474,15 @@ public class CheckstyleViolationCheckMoj
                     defaultValue = "${project.build.directory}/checkstyle-rules.xml" )
     private File rulesFiles;
 
+    /**
+     * Specifies whether modules with a configured severity of <code>ignore</code>
should be omitted during Checkstyle
+     * invocation.
+     * 
+     * @since 3.0.0
+     */
+    @Parameter( defaultValue = "false" )
+    private boolean omitIgnoredModules;
+
     private ByteArrayOutputStream stringOutputStream;
 
     /** {@inheritDoc} */
@@ -535,7 +544,8 @@ public class CheckstyleViolationCheckMoj
                     .setPropertyExpansion( propertyExpansion )
                     .setHeaderLocation( headerLocation ).setLicenseArtifacts( collectArtifacts(
"license" ) )
                     .setCacheFile( cacheFile ).setSuppressionsFileExpression( suppressionsFileExpression
)
-                    .setEncoding( encoding ).setPropertiesLocation( propertiesLocation );
+                    .setEncoding( encoding ).setPropertiesLocation( propertiesLocation )
+                    .setOmitIgnoredModules( omitIgnoredModules );
                 checkstyleExecutor.executeCheckstyle( request );
 
             }

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleExecutorRequest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleExecutorRequest.java?rev=1796441&r1=1796440&r2=1796441&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleExecutorRequest.java
(original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleExecutorRequest.java
Sat May 27 19:40:30 2017
@@ -122,7 +122,12 @@ public class CheckstyleExecutorRequest
      * @since 2.12.1
      */
     private List<Artifact> configurationArtifacts;
-    
+
+    /**
+     * @since 3.0.0
+     */
+    private boolean omitIgnoredModules;
+
     /**
      * Constructor.
      */
@@ -383,9 +388,10 @@ public class CheckstyleExecutorRequest
         return propertiesLocation;
     }
 
-    public void setPropertiesLocation( String propertiesLocation )
+    public CheckstyleExecutorRequest setPropertiesLocation( String propertiesLocation )
     {
         this.propertiesLocation = propertiesLocation;
+        return this;
     }
 
     /**
@@ -505,4 +511,24 @@ public class CheckstyleExecutorRequest
         this.includeTestResources = includeTestResources;
         return this;
     }
+
+    /**
+     * Returns true if ignored modules (modules with severity 'ignore') should be omitted.
+     *
+     * @return <code>true</code> if ignored modules should be omitted.
+     */
+    public boolean isOmitIgnoredModules()
+    {
+        return omitIgnoredModules;
+    }
+
+    /**
+     * @param omitIgnoredModules Whether to omit ignored modules (modules with severity 'ignore').
+     * @return This object.
+     */
+    public CheckstyleExecutorRequest setOmitIgnoredModules( boolean omitIgnoredModules )
+    {
+        this.omitIgnoredModules = omitIgnoredModules;
+        return this;
+    }
 }

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java?rev=1796441&r1=1796440&r2=1796441&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
(original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
Sat May 27 19:40:30 2017
@@ -373,8 +373,9 @@ public class DefaultCheckstyleExecutor
             Thread.currentThread().setContextClassLoader( checkstyleClassLoader );
             String configFile = getConfigFile( request );
             Properties overridingProperties = getOverridingProperties( request );
-            Configuration config = ConfigurationLoader
-                .loadConfiguration( configFile, new PropertiesExpander( overridingProperties
) );
+            Configuration config =
+                ConfigurationLoader.loadConfiguration( configFile, new PropertiesExpander(
overridingProperties ),
+                                                       request.isOmitIgnoredModules() );
             String effectiveEncoding = StringUtils.isNotEmpty( request.getEncoding() ) ?
request.getEncoding() : System
                 .getProperty( "file.encoding", "UTF-8" );
             



Mime
View raw message