diff --git a/.github/actions/action-checkstyle b/.github/actions/action-checkstyle new file mode 160000 index 00000000000000..9eb107730361c5 --- /dev/null +++ b/.github/actions/action-checkstyle @@ -0,0 +1 @@ +Subproject commit 9eb107730361c56564c02b2912828d0036e4f18f diff --git a/.github/workflows/checkstyle.yaml b/.github/workflows/checkstyle.yaml new file mode 100644 index 00000000000000..01e5428ebae70b --- /dev/null +++ b/.github/workflows/checkstyle.yaml @@ -0,0 +1,41 @@ +# 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. +# +--- +name: FE Code Style Checker +on: + pull_request: +jobs: + java-checkstyle: + name: "CheckStyle" + runs-on: ubuntu-latest + steps: + - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" + uses: actions/checkout@v2 + with: + persist-credentials: false + submodules: recursive + - name: "Run java checkstyle" + uses: ./.github/actions/action-checkstyle + with: + checkstyle_config: fe/check/checkstyle/checkstyle.xml + checkstyle_version: 9.3 + workdir: "./fe" + reporter: 'github-pr-review' + github_token: ${{ secrets.GITHUB_TOKEN }} + fail_on_error: true + diff --git a/.gitmodules b/.gitmodules index 9fe03a6f6a331e..bb902b43f880b4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule ".github/actions/clang-format-lint-action"] path = .github/actions/clang-format-lint-action url = https://github.com/DoozyX/clang-format-lint-action.git +[submodule ".github/actions/action-checkstyle"] + path = .github/actions/action-checkstyle + url = https://github.com/dbelyaev/action-checkstyle.git diff --git a/fe/checkstyle-apache-header.txt b/fe/check/checkstyle/checkstyle-apache-header.txt similarity index 100% rename from fe/checkstyle-apache-header.txt rename to fe/check/checkstyle/checkstyle-apache-header.txt diff --git a/fe/check/checkstyle/checkstyle.xml b/fe/check/checkstyle/checkstyle.xml new file mode 100644 index 00000000000000..87aade2148c431 --- /dev/null +++ b/fe/check/checkstyle/checkstyle.xml @@ -0,0 +1,410 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fe/checkstyle.xml b/fe/checkstyle.xml deleted file mode 100644 index 7eba1555fa2a13..00000000000000 --- a/fe/checkstyle.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/fe/fe-common/pom.xml b/fe/fe-common/pom.xml index 36731a83e7cc8f..6eeca8bf382e00 100644 --- a/fe/fe-common/pom.xml +++ b/fe/fe-common/pom.xml @@ -162,29 +162,6 @@ under the License. true - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - checkstyle.xml - UTF-8 - true - true - false - **/jmockit/**/* - - - - validate - validate - - check - - - - diff --git a/fe/fe-core/pom.xml b/fe/fe-core/pom.xml index 1514a1019379d1..2da7e9ce4c7e63 100644 --- a/fe/fe-core/pom.xml +++ b/fe/fe-core/pom.xml @@ -786,28 +786,6 @@ under the License. - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - checkstyle.xml - UTF-8 - true - true - false - - - - validate - validate - - check - - - - maven-clean-plugin diff --git a/fe/hive-udf/pom.xml b/fe/hive-udf/pom.xml index 68caad2f643d5a..9bf08cad8e8709 100644 --- a/fe/hive-udf/pom.xml +++ b/fe/hive-udf/pom.xml @@ -102,29 +102,6 @@ under the License. true - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - checkstyle.xml - UTF-8 - true - true - false - **/jmockit/**/* - - - - validate - validate - - check - - - - diff --git a/fe/java-udf/pom.xml b/fe/java-udf/pom.xml index e1433d15f1bccc..04d8755b7de19e 100644 --- a/fe/java-udf/pom.xml +++ b/fe/java-udf/pom.xml @@ -82,30 +82,6 @@ under the License. - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - checkstyle.xml - UTF-8 - true - true - false - **/jmockit/**/* - - - - validate - validate - - check - - - - diff --git a/fe/pom.xml b/fe/pom.xml index f5b610029c797b..ae593bbcf9796f 100644 --- a/fe/pom.xml +++ b/fe/pom.xml @@ -110,6 +110,63 @@ under the License. + + com.diffplug.spotless + spotless-maven-plugin + 2.22.2 + + + + **/jmockit/**/* + + + + + true + 4 + + + check/checkstyle/checkstyle-apache-header.txt + \npackage + + + \\#,org.apache.doris,,java + + + UTF-8 + UNIX + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + + com.puppycrawl.tools + checkstyle + 9.3 + + + + check/checkstyle/checkstyle.xml + UTF-8 + true + true + false + **/jmockit/**/* + + + + validate + validate + + check + + + + org.sonarsource.scanner.maven sonar-maven-plugin @@ -874,10 +931,6 @@ under the License. org.apache.maven.plugins maven-checkstyle-plugin - 3.1.0 - - checkstyle.xml - diff --git a/fe/spark-dpp/pom.xml b/fe/spark-dpp/pom.xml index 540d5439d2fb88..9a2a3d3c4e0bb3 100644 --- a/fe/spark-dpp/pom.xml +++ b/fe/spark-dpp/pom.xml @@ -211,28 +211,6 @@ under the License. - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - checkstyle.xml - UTF-8 - true - true - false - - - - validate - validate - - check - - - - maven-clean-plugin