Repository: knox Updated Branches: refs/heads/master e9016eb80 -> ced350642
KNOX-1478 - Support running checkstyle from submodules Signed-off-by: Kevin Risden <kris...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/ced35064 Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/ced35064 Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/ced35064 Branch: refs/heads/master Commit: ced350642dd0afe0c550c87af7486eceb58b34c8 Parents: e9016eb Author: Kevin Risden <kris...@apache.org> Authored: Fri Sep 28 21:43:07 2018 -0400 Committer: Kevin Risden <kris...@apache.org> Committed: Fri Sep 28 22:28:05 2018 -0400 ---------------------------------------------------------------------- build-tools/pom.xml | 58 ++++++++++++ .../build-tools/checkstyle/checker.xml | 95 ++++++++++++++++++++ .../build-tools/checkstyle/suppressions.xml | 27 ++++++ .../resources/build-tools/spotbugs-filter.xml | 69 ++++++++++++++ pom.xml | 17 +++- src/checkstyle/checker.xml | 95 -------------------- src/checkstyle/suppressions.xml | 27 ------ src/spotbugs-filter.xml | 69 -------------- 8 files changed, 263 insertions(+), 194 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/ced35064/build-tools/pom.xml ---------------------------------------------------------------------- diff --git a/build-tools/pom.xml b/build-tools/pom.xml new file mode 100644 index 0000000..fb8f312 --- /dev/null +++ b/build-tools/pom.xml @@ -0,0 +1,58 @@ +<?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</groupId> + <artifactId>apache</artifactId> + <version>21</version> + </parent> + + <groupId>org.apache.knox</groupId> + <artifactId>build-tools</artifactId> + <version>1.2.0-SNAPSHOT</version> + + <name>build-tools</name> + <description>The Apache Knox Project Build Tools</description> + <url>https://knox.apache.org/</url> + + <scm> + <connection>scm:git:git://git.apache.org/knox.git</connection> + <developerConnection>scm:git:git://git.apache.org/knox.git</developerConnection> + <url>http://git-wip-us.apache.org/repos/asf/knox.git</url> + </scm> + + <mailingLists> + <mailingList> + <name>Apache Knox User List</name> + <subscribe>user-subscr...@knox.apache.org</subscribe> + <unsubscribe>user-unsubscr...@knox.apache.org</unsubscribe> + <post>u...@knox.apache.org</post> + <archive>https://mail-archives.apache.org/mod_mbox/knox-user/</archive> + </mailingList> + <mailingList> + <name>Apache Knox Development List</name> + <subscribe>dev-subscr...@knox.apache.org</subscribe> + <unsubscribe>dev-unsubscr...@knox.apache.org</unsubscribe> + <post>d...@knox.apache.org</post> + <archive>https://mail-archives.apache.org/mod_mbox/knox-dev/</archive> + </mailingList> + </mailingLists> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/knox/blob/ced35064/build-tools/src/main/resources/build-tools/checkstyle/checker.xml ---------------------------------------------------------------------- diff --git a/build-tools/src/main/resources/build-tools/checkstyle/checker.xml b/build-tools/src/main/resources/build-tools/checkstyle/checker.xml new file mode 100644 index 0000000..3798001 --- /dev/null +++ b/build-tools/src/main/resources/build-tools/checkstyle/checker.xml @@ -0,0 +1,95 @@ +<?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. +--> + +<!-- + This version of checkstyle is based on the Apache Calcite checkstyle + configuration, which in turn is based on Giraph, Hadoop, and + common-math configurations. + + The documentation for checkstyle is available at + + http://checkstyle.sourceforge.net +--> + +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" + "http://www.puppycrawl.com/dtds/configuration_1_1.dtd"> + +<!-- Calcite customization of default Checkstyle behavior --> +<module name="Checker"> + <property name="localeLanguage" value="en"/> + + <!-- Checks for whitespace (tree walker) --> + <!-- See http://checkstyle.sf.net/config_whitespace.html --> + <!-- No tabs allowed! --> + <module name="FileTabCharacter"/> + + <!-- Checks for headers --> + <!-- See http://checkstyle.sf.net/config_header.html --> + <!-- Verify that EVERY source file has the appropriate license --> + <module name="Header"> + <property name="header" value="/*\n"/> + <property name="fileExtensions" value="java"/> + </module> + + <module name="TreeWalker"> + <property name="cacheFile" value="target/checkstyle-cachefile"/> + + <!-- Checks for blocks. You know, those {}'s --> + <!-- See http://checkstyle.sf.net/config_blocks.html --> + <!-- No empty blocks (i.e. catch); must contain at least a comment --> + <module name="EmptyBlock"> + <property name="option" value="text"/> + </module> + <module name="AvoidNestedBlocks"> + <property name="allowInSwitchCase" value="true"/> + </module> + + <!-- Checks for common coding problems --> + <!-- See http://checkstyle.sf.net/config_coding.html --> + <module name="EmptyStatement"/> + <!-- Require hash code override when equals is --> + <module name="EqualsHashCode"/> + <!-- Disallow unnecessary instantiation of Boolean, String --> + <!--<module name="IllegalInstantiation"> + <property name="classes" value="java.lang.Boolean, java.lang.String"/> + </module>--> + <!-- Switch statements should be complete and with independent cases --> + <!--<module name="FallThrough"/>--> + <module name="SimplifyBooleanExpression"/> + <module name="SimplifyBooleanReturn"/> + <!-- Only one statement per line allowed --> + <!--<module name="OneStatementPerLine"/>--> + <!-- Don't add up parentheses when they are not required --> + <!--<module name="UnnecessaryParentheses"/>--> + <!-- Don't use = or != for string comparisons --> + <module name="StringLiteralEquality"/> + <!-- Don't declare multiple variables in the same statement --> + <!--<module name="MultipleVariableDeclarations"/>--> + + <!-- Checks for imports --> + <!-- See http://checkstyle.sf.net/config_import.html --> + <module name="RedundantImport"/> + <!-- Import should be explicit, and only from pure java packages. + But we allow imports that are only used in javadoc. --> + <module name="UnusedImports"> + <property name="processJavadoc" value="true"/> + </module> + <module name="IllegalImport"/> + <module name="AvoidStarImport"/> + </module> +</module> http://git-wip-us.apache.org/repos/asf/knox/blob/ced35064/build-tools/src/main/resources/build-tools/checkstyle/suppressions.xml ---------------------------------------------------------------------- diff --git a/build-tools/src/main/resources/build-tools/checkstyle/suppressions.xml b/build-tools/src/main/resources/build-tools/checkstyle/suppressions.xml new file mode 100644 index 0000000..43f7677 --- /dev/null +++ b/build-tools/src/main/resources/build-tools/checkstyle/suppressions.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.1//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> +<!-- +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. +--> +<suppressions> + <suppress checks="Header" files=".*.properties"/> + <suppress checks=".*" files="log4j.properties"/> + + <!-- Suppress JavadocPackage in the test packages --> + <suppress checks="JavadocPackage" files="src[/\\]test[/\\]java[/\\]"/> +</suppressions> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/knox/blob/ced35064/build-tools/src/main/resources/build-tools/spotbugs-filter.xml ---------------------------------------------------------------------- diff --git a/build-tools/src/main/resources/build-tools/spotbugs-filter.xml b/build-tools/src/main/resources/build-tools/spotbugs-filter.xml new file mode 100644 index 0000000..c779bac --- /dev/null +++ b/build-tools/src/main/resources/build-tools/spotbugs-filter.xml @@ -0,0 +1,69 @@ +<?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. +--> +<FindBugsFilter + xmlns="https://github.com/spotbugs/filter/3.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd"> + + <Match> + <Class name="org.apache.knox.gateway.i18n.messages.loggers.sout.SoutMessageLoggerFactory" /> + <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" /> + </Match> + + <Match> + <Class name="org.apache.knox.gateway.i18n.messages.loggers.test.TestMessageLoggerFactory" /> + <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" /> + </Match> + + <Match> + <Class name="org.apache.knox.gateway.security.ldap.SimpleLdapDirectoryServer" /> + <Bug pattern="PATH_TRAVERSAL_IN" /> + </Match> + + <Match> + <Class name="org.apache.knox.gateway.services.security.impl.X509CertificateUtil" /> + <Method name="writeCertificateToJKS" /> + <Bug pattern="HARD_CODE_PASSWORD" /> + </Match> + + <Match> + <Class name="org.apache.knox.gateway.GatewayForwardingServlet" /> + <Bug pattern="REQUESTDISPATCHER_FILE_DISCLOSURE" /> + </Match> + + <Match> + <Class name="org.apache.knox.gateway.provider.federation.jwt.filter.SSOCookieFederationFilter" /> + <Bug pattern="UNVALIDATED_REDIRECT" /> + </Match> + + <Match> + <Class name="org.apache.knox.gateway.filter.RedirectToUrlFilter" /> + <Bug pattern="UNVALIDATED_REDIRECT" /> + </Match> + + <Match> + <Class name="org.apache.knox.gateway.service.knoxsso.WebSSOResource" /> + <Bug pattern="UNVALIDATED_REDIRECT" /> + </Match> + + <Match> + <Class name="~org.apache.hadoop.gateway..*" /> + <Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" /> + </Match> + +</FindBugsFilter> http://git-wip-us.apache.org/repos/asf/knox/blob/ced35064/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 878538b..dc84f2e 100644 --- a/pom.xml +++ b/pom.xml @@ -124,6 +124,7 @@ <module>gateway-shell-release</module> <module>gateway-test-release-utils</module> <module>gateway-service-nifi</module> + <module>build-tools</module> </modules> <properties> @@ -374,7 +375,7 @@ <configuration> <threshold>High</threshold> <failOnError>true</failOnError> - <excludeFilterFile>${session.executionRootDirectory}/src/spotbugs-filter.xml</excludeFilterFile> + <excludeFilterFile>build-tools/spotbugs-filter.xml</excludeFilterFile> <plugins> <plugin> <groupId>com.h3xstream.findsecbugs</groupId> @@ -391,6 +392,11 @@ </execution> </executions> <dependencies> + <dependency> + <groupId>org.apache.knox</groupId> + <artifactId>build-tools</artifactId> + <version>${project.version}</version> + </dependency> <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs --> <dependency> <groupId>com.github.spotbugs</groupId> @@ -436,8 +442,8 @@ <id>validate</id> <phase>validate</phase> <configuration> - <configLocation>${session.executionRootDirectory}/src/checkstyle/checker.xml</configLocation> - <suppressionsLocation>${session.executionRootDirectory}/src/checkstyle/suppressions.xml</suppressionsLocation> + <configLocation>build-tools/checkstyle/checker.xml</configLocation> + <suppressionsLocation>build-tools/checkstyle/suppressions.xml</suppressionsLocation> <consoleOutput>true</consoleOutput> <failOnViolation>true</failOnViolation> <includeTestSourceDirectory>true</includeTestSourceDirectory> @@ -449,6 +455,11 @@ </executions> <dependencies> <dependency> + <groupId>org.apache.knox</groupId> + <artifactId>build-tools</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> <version>${checkstyle.version}</version> http://git-wip-us.apache.org/repos/asf/knox/blob/ced35064/src/checkstyle/checker.xml ---------------------------------------------------------------------- diff --git a/src/checkstyle/checker.xml b/src/checkstyle/checker.xml deleted file mode 100644 index 3798001..0000000 --- a/src/checkstyle/checker.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?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. ---> - -<!-- - This version of checkstyle is based on the Apache Calcite checkstyle - configuration, which in turn is based on Giraph, Hadoop, and - common-math configurations. - - The documentation for checkstyle is available at - - http://checkstyle.sourceforge.net ---> - -<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" - "http://www.puppycrawl.com/dtds/configuration_1_1.dtd"> - -<!-- Calcite customization of default Checkstyle behavior --> -<module name="Checker"> - <property name="localeLanguage" value="en"/> - - <!-- Checks for whitespace (tree walker) --> - <!-- See http://checkstyle.sf.net/config_whitespace.html --> - <!-- No tabs allowed! --> - <module name="FileTabCharacter"/> - - <!-- Checks for headers --> - <!-- See http://checkstyle.sf.net/config_header.html --> - <!-- Verify that EVERY source file has the appropriate license --> - <module name="Header"> - <property name="header" value="/*\n"/> - <property name="fileExtensions" value="java"/> - </module> - - <module name="TreeWalker"> - <property name="cacheFile" value="target/checkstyle-cachefile"/> - - <!-- Checks for blocks. You know, those {}'s --> - <!-- See http://checkstyle.sf.net/config_blocks.html --> - <!-- No empty blocks (i.e. catch); must contain at least a comment --> - <module name="EmptyBlock"> - <property name="option" value="text"/> - </module> - <module name="AvoidNestedBlocks"> - <property name="allowInSwitchCase" value="true"/> - </module> - - <!-- Checks for common coding problems --> - <!-- See http://checkstyle.sf.net/config_coding.html --> - <module name="EmptyStatement"/> - <!-- Require hash code override when equals is --> - <module name="EqualsHashCode"/> - <!-- Disallow unnecessary instantiation of Boolean, String --> - <!--<module name="IllegalInstantiation"> - <property name="classes" value="java.lang.Boolean, java.lang.String"/> - </module>--> - <!-- Switch statements should be complete and with independent cases --> - <!--<module name="FallThrough"/>--> - <module name="SimplifyBooleanExpression"/> - <module name="SimplifyBooleanReturn"/> - <!-- Only one statement per line allowed --> - <!--<module name="OneStatementPerLine"/>--> - <!-- Don't add up parentheses when they are not required --> - <!--<module name="UnnecessaryParentheses"/>--> - <!-- Don't use = or != for string comparisons --> - <module name="StringLiteralEquality"/> - <!-- Don't declare multiple variables in the same statement --> - <!--<module name="MultipleVariableDeclarations"/>--> - - <!-- Checks for imports --> - <!-- See http://checkstyle.sf.net/config_import.html --> - <module name="RedundantImport"/> - <!-- Import should be explicit, and only from pure java packages. - But we allow imports that are only used in javadoc. --> - <module name="UnusedImports"> - <property name="processJavadoc" value="true"/> - </module> - <module name="IllegalImport"/> - <module name="AvoidStarImport"/> - </module> -</module> http://git-wip-us.apache.org/repos/asf/knox/blob/ced35064/src/checkstyle/suppressions.xml ---------------------------------------------------------------------- diff --git a/src/checkstyle/suppressions.xml b/src/checkstyle/suppressions.xml deleted file mode 100644 index 43f7677..0000000 --- a/src/checkstyle/suppressions.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE suppressions PUBLIC - "-//Puppy Crawl//DTD Suppressions 1.1//EN" - "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> -<!-- -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. ---> -<suppressions> - <suppress checks="Header" files=".*.properties"/> - <suppress checks=".*" files="log4j.properties"/> - - <!-- Suppress JavadocPackage in the test packages --> - <suppress checks="JavadocPackage" files="src[/\\]test[/\\]java[/\\]"/> -</suppressions> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/knox/blob/ced35064/src/spotbugs-filter.xml ---------------------------------------------------------------------- diff --git a/src/spotbugs-filter.xml b/src/spotbugs-filter.xml deleted file mode 100644 index c779bac..0000000 --- a/src/spotbugs-filter.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?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. ---> -<FindBugsFilter - xmlns="https://github.com/spotbugs/filter/3.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd"> - - <Match> - <Class name="org.apache.knox.gateway.i18n.messages.loggers.sout.SoutMessageLoggerFactory" /> - <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" /> - </Match> - - <Match> - <Class name="org.apache.knox.gateway.i18n.messages.loggers.test.TestMessageLoggerFactory" /> - <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" /> - </Match> - - <Match> - <Class name="org.apache.knox.gateway.security.ldap.SimpleLdapDirectoryServer" /> - <Bug pattern="PATH_TRAVERSAL_IN" /> - </Match> - - <Match> - <Class name="org.apache.knox.gateway.services.security.impl.X509CertificateUtil" /> - <Method name="writeCertificateToJKS" /> - <Bug pattern="HARD_CODE_PASSWORD" /> - </Match> - - <Match> - <Class name="org.apache.knox.gateway.GatewayForwardingServlet" /> - <Bug pattern="REQUESTDISPATCHER_FILE_DISCLOSURE" /> - </Match> - - <Match> - <Class name="org.apache.knox.gateway.provider.federation.jwt.filter.SSOCookieFederationFilter" /> - <Bug pattern="UNVALIDATED_REDIRECT" /> - </Match> - - <Match> - <Class name="org.apache.knox.gateway.filter.RedirectToUrlFilter" /> - <Bug pattern="UNVALIDATED_REDIRECT" /> - </Match> - - <Match> - <Class name="org.apache.knox.gateway.service.knoxsso.WebSSOResource" /> - <Bug pattern="UNVALIDATED_REDIRECT" /> - </Match> - - <Match> - <Class name="~org.apache.hadoop.gateway..*" /> - <Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" /> - </Match> - -</FindBugsFilter>