This is an automated email from the ASF dual-hosted git repository. adangel pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
The following commit(s) were added to refs/heads/master by this push: new a7d7d69 [MPMD-243] excludeFromFailureFile configuration does not work a7d7d69 is described below commit a7d7d69820ecfeb294c55dfccea704876940f9d1 Author: Andreas Dangel <adan...@apache.org> AuthorDate: Tue Jan 9 08:27:14 2018 +0100 [MPMD-243] excludeFromFailureFile configuration does not work Add integration test --- .../config/pmd-exclude.properties | 18 ++++++ .../config/ruleset.xml | 30 ++++++++++ .../invoker.properties | 19 ++++++ src/it/MPMD-243-excludeFromFailureFile/pom.xml | 70 ++++++++++++++++++++++ .../src/main/java/com/example/A.java | 28 +++++++++ .../com/example/ClassWithLotsOfStaticImports.java | 34 +++++++++++ .../MPMD-243-excludeFromFailureFile/verify.groovy | 23 +++++++ 7 files changed, 222 insertions(+) diff --git a/src/it/MPMD-243-excludeFromFailureFile/config/pmd-exclude.properties b/src/it/MPMD-243-excludeFromFailureFile/config/pmd-exclude.properties new file mode 100644 index 0000000..c1cf9f0 --- /dev/null +++ b/src/it/MPMD-243-excludeFromFailureFile/config/pmd-exclude.properties @@ -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. + +com.example.ClassWithLotsOfStaticImports=TooManyStaticImports diff --git a/src/it/MPMD-243-excludeFromFailureFile/config/ruleset.xml b/src/it/MPMD-243-excludeFromFailureFile/config/ruleset.xml new file mode 100644 index 0000000..c337933 --- /dev/null +++ b/src/it/MPMD-243-excludeFromFailureFile/config/ruleset.xml @@ -0,0 +1,30 @@ +<?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. +--> +<ruleset name="Ruleset for MPMD-243" + xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"> + + <description> + MPMD-243 + </description> + + <rule ref="rulesets/java/imports.xml/TooManyStaticImports"/> +</ruleset> diff --git a/src/it/MPMD-243-excludeFromFailureFile/invoker.properties b/src/it/MPMD-243-excludeFromFailureFile/invoker.properties new file mode 100644 index 0000000..1e595ef --- /dev/null +++ b/src/it/MPMD-243-excludeFromFailureFile/invoker.properties @@ -0,0 +1,19 @@ +# 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 pmd:check +invoker.maven.version = 3+ diff --git a/src/it/MPMD-243-excludeFromFailureFile/pom.xml b/src/it/MPMD-243-excludeFromFailureFile/pom.xml new file mode 100644 index 0000000..a9fa11b --- /dev/null +++ b/src/it/MPMD-243-excludeFromFailureFile/pom.xml @@ -0,0 +1,70 @@ +<?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.plugin.pmd.its</groupId> + <artifactId>MPMD-243-excludeFromFailureFile</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <description> + Test that the option excludeFromFailureFile is actually honored + </description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + + <build> + <plugins> + <plugin> + <groupId>@project.groupId@</groupId> + <artifactId>@project.artifactId@</artifactId> + <version>@project.version@</version> + <configuration> + <verbose>true</verbose> + <skipPmdError>false</skipPmdError> + <failOnViolation>true</failOnViolation> +<!-- <printFailingErrors>true</printFailingErrors> --> + <rulesets> + <ruleset>${basedir}/config/ruleset.xml</ruleset> + </rulesets> + </configuration> + <executions> + <execution> + <id>default-cli</id> + <goals> + <goal>check</goal> + </goals> + <configuration> + <excludeFromFailureFile>${basedir}/config/pmd-exclude.properties</excludeFromFailureFile> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/src/it/MPMD-243-excludeFromFailureFile/src/main/java/com/example/A.java b/src/it/MPMD-243-excludeFromFailureFile/src/main/java/com/example/A.java new file mode 100644 index 0000000..7386d42 --- /dev/null +++ b/src/it/MPMD-243-excludeFromFailureFile/src/main/java/com/example/A.java @@ -0,0 +1,28 @@ +package com.example; + +/* + * 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 A { + public static final int A = 1; + public static final int B = 1; + public static final int C = 1; + public static final int D = 1; + public static final int E = 1; +} diff --git a/src/it/MPMD-243-excludeFromFailureFile/src/main/java/com/example/ClassWithLotsOfStaticImports.java b/src/it/MPMD-243-excludeFromFailureFile/src/main/java/com/example/ClassWithLotsOfStaticImports.java new file mode 100644 index 0000000..f3d3969 --- /dev/null +++ b/src/it/MPMD-243-excludeFromFailureFile/src/main/java/com/example/ClassWithLotsOfStaticImports.java @@ -0,0 +1,34 @@ +package com.example; + +/* + * 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 static com.example.A.A; +import static com.example.A.B; +import static com.example.A.C; +import static com.example.A.D; +import static com.example.A.E; // Too much ! + +public class ClassWithLotsOfStaticImports +{ + public static void main( String[] args ) + { + System.out.println( A + B + C + D + E ); + } +} diff --git a/src/it/MPMD-243-excludeFromFailureFile/verify.groovy b/src/it/MPMD-243-excludeFromFailureFile/verify.groovy new file mode 100644 index 0000000..418f435 --- /dev/null +++ b/src/it/MPMD-243-excludeFromFailureFile/verify.groovy @@ -0,0 +1,23 @@ +/* + * 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. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() +assert buildLog.text.contains( "PMD Warning: com.example.ClassWithLotsOfStaticImports" ) +assert buildLog.text.contains( "You have 1 warning. For more details see" ) -- To stop receiving notification emails like this one, please contact ['"commits@maven.apache.org" <commits@maven.apache.org>'].