From efd1aa3016eb91e01c1195998ea73a6dc087318d Mon Sep 17 00:00:00 2001 From: Mingyu Chen Date: Tue, 7 Nov 2023 16:37:24 +0800 Subject: [PATCH] [Revert](code-style) revert FE code-format #25033 and #26488 (#26505) --- .../{codestyle.yaml => checkstyle.yaml} | 8 +- .../developer-guide/java-format-code.md | 12 +- .../developer-guide/java-format-code.md | 20 +- .../checkstyle-apache-header.txt} | 3 +- fe/check/checkstyle/checkstyle.xml | 22 +- fe/check/checkstyle/import-control.xml | 5 +- fe/check/checkstyle/suppressions.xml | 8 +- fe/pom.xml | 463 ++++++++---------- 8 files changed, 256 insertions(+), 285 deletions(-) rename .github/workflows/{codestyle.yaml => checkstyle.yaml} (90%) rename fe/check/{spotless/copyright.txt => checkstyle/checkstyle-apache-header.txt} (97%) diff --git a/.github/workflows/codestyle.yaml b/.github/workflows/checkstyle.yaml similarity index 90% rename from .github/workflows/codestyle.yaml rename to .github/workflows/checkstyle.yaml index f2bd1bebf0..13ab46b2cd 100644 --- a/.github/workflows/codestyle.yaml +++ b/.github/workflows/checkstyle.yaml @@ -27,11 +27,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: persist-credentials: false submodules: recursive - fetch-depth: 0 - name: Paths Filter uses: ./.github/actions/paths-filter @@ -49,7 +48,8 @@ jobs: with: maven-version: 3.8.4 - - name: Run java spotless & checkstyle + - name: Run java checkstyle if: steps.filter.outputs.fe_changes == 'true' run: - cd fe && mvn clean spotless:check checkstyle:check + cd fe && mvn clean checkstyle:check + diff --git a/docs/en/community/developer-guide/java-format-code.md b/docs/en/community/developer-guide/java-format-code.md index 43d47515da..bad37cc7f1 100644 --- a/docs/en/community/developer-guide/java-format-code.md +++ b/docs/en/community/developer-guide/java-format-code.md @@ -1,7 +1,7 @@ --- { - "title": "Java Format Code", - "language": "en" + "title": "Java Format Code", + "language": "en" } --- @@ -89,13 +89,6 @@ After add the `build-support/IntelliJ-code-format.xml` file. Click `Code/Rearran ![](/images/idea-rearrange-code.png) -## Spotless Plugin - -An error was found when checking the project code through `mvn spotless:check`, and then used `mvn spotless:apply` to format the code; when checking again, the formatting error disappeared. - -Tip: We use incremental code formatting, spotless will apply only to files which have changed since `origin/master`. If a `No such reference` error is prompted, please calling `git fetch origin master` before you call Spotless. -Please refer to [how-can-i-enforce-formatting-gradually-aka-ratchet](https://github.com/diffplug/spotless/tree/main/plugin-maven#how-can-i-enforce-formatting-gradually-aka-ratchet) for details. - ## Remove unused header **CTRL + ALT + O --->** to remove the unused imports in windows. @@ -103,3 +96,4 @@ Please refer to [how-can-i-enforce-formatting-gradually-aka-ratchet](https://git Auto remove unused header and reorder according to configure xml: Click `Preferences->Editor->Auto Import->Optimize Imports on the Fly` + diff --git a/docs/zh-CN/community/developer-guide/java-format-code.md b/docs/zh-CN/community/developer-guide/java-format-code.md index 47056f5fa1..6fad1867ec 100644 --- a/docs/zh-CN/community/developer-guide/java-format-code.md +++ b/docs/zh-CN/community/developer-guide/java-format-code.md @@ -1,7 +1,7 @@ --- { - "title": "Java 代码格式化", - "language": "zh-CN" + "title": "Java 代码格式化", + "language": "zh-CN" } --- @@ -42,6 +42,13 @@ standard java package * 禁止使用 `import *` * 禁止使用 `import static` +## 编译时检查 + +现在,在使用`maven`进行编译时,会默认进行`CheckStyle`检查。此检查会略微降低编译速度。如果想跳过此检查,请使用如下命令进行编译 +``` +mvn clean install -DskipTests -Dcheckstyle.skip +``` + ## Checkstyle 插件 现在的 `CI` 之中会有 `formatter-check` 进行代码格式化检测。 @@ -80,17 +87,10 @@ Checkstyle 会按照 [Class and Interface Declarations](https://www.oracle.com/j ![](/images/idea-rearrange-code.png) -## Spotless 插件 - -通过 mvn spotless:check 检查项目代码时发现错误,接着使用 mvn spotless:apply 进行代码格式化;再次检查时,格式化错误消失。 - -提示:我们使用增量代码格式,spotless 仅适用于自“origin/master”以来已更改的文件。如果提示“No such reference”错误,请在调用 Spotless 之前调用“git fetch origin master”。 -请参考 [how-can-i-enforce-formatting-gradually-aka-ratchet](https://github.com/diffplug/spotless/tree/main/plugin-maven#how-can-i-enforce-formatting-gradually-aka-ratchet)。 - ## Remove unused header 默认快捷键 **CTRL + ALT + O --->** 仅仅删除未使用的导入。 自动移除并且 Reorder : -点击 `Preferences->Editor->General->Auto Import->Optimize Imports on the Fly` +点击 `Preferences->Editor->General->Auto Import->Optimize Imports on the Fly` \ No newline at end of file diff --git a/fe/check/spotless/copyright.txt b/fe/check/checkstyle/checkstyle-apache-header.txt similarity index 97% rename from fe/check/spotless/copyright.txt rename to fe/check/checkstyle/checkstyle-apache-header.txt index 5cd17fb5a6..6e778edd75 100644 --- a/fe/check/spotless/copyright.txt +++ b/fe/check/checkstyle/checkstyle-apache-header.txt @@ -13,5 +13,4 @@ // "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. - +// under the License. \ No newline at end of file diff --git a/fe/check/checkstyle/checkstyle.xml b/fe/check/checkstyle/checkstyle.xml index 34cce78e4f..5c308bcfd8 100644 --- a/fe/check/checkstyle/checkstyle.xml +++ b/fe/check/checkstyle/checkstyle.xml @@ -7,7 +7,9 @@ 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 @@ -42,9 +44,13 @@ under the License. + + + + - + @@ -93,6 +99,14 @@ under the License. + + + + + + + + + diff --git a/fe/check/checkstyle/import-control.xml b/fe/check/checkstyle/import-control.xml index 76bf5a691b..16371ce891 100644 --- a/fe/check/checkstyle/import-control.xml +++ b/fe/check/checkstyle/import-control.xml @@ -7,7 +7,9 @@ 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 @@ -38,4 +40,5 @@ under the License. - \ No newline at end of file + + diff --git a/fe/check/checkstyle/suppressions.xml b/fe/check/checkstyle/suppressions.xml index 06d8dcfb2f..d44bd6d3db 100644 --- a/fe/check/checkstyle/suppressions.xml +++ b/fe/check/checkstyle/suppressions.xml @@ -7,7 +7,9 @@ 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 @@ -17,8 +19,8 @@ under the License. --> + "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" + "https://checkstyle.org/dtds/suppressions_1_2.dtd"> @@ -61,4 +63,4 @@ under the License. - \ No newline at end of file + diff --git a/fe/pom.xml b/fe/pom.xml index 65948564af..d47dfa681d 100644 --- a/fe/pom.xml +++ b/fe/pom.xml @@ -17,7 +17,8 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.apache @@ -29,6 +30,157 @@ under the License. ${revision} pom Doris FE Project Parent POM + https://doris.apache.org/ + + + Apache 2.0 License + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + scm:git:https://git@github.com/apache/doris.git + scm:git:https://git@github.com/apache/doris.git + scm:git:https://git@github.com/apache/doris.git + HEAD + + + GitHub + https://github.com/apache/doris/issues + + + + Dev Mailing List + dev@doris.apache.org + dev-subscribe@doris.apache.org + dev-unsubscribe@doris.apache.org + + + Commits Mailing List + commits@doris.apache.org + commits-subscribe@doris.apache.org + commits-unsubscribe@doris.apache.org + + + + + + org.codehaus.mojo + flatten-maven-plugin + 1.2.5 + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.commonjava.maven.plugins + directory-maven-plugin + 0.1 + + + directories + + directory-of + + initialize + + fe.dir + + org.apache.doris + fe + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + org.codehaus.mojo + license-maven-plugin + 2.0.0 + + + add-third-party + + add-third-party + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + 1.2.5 + + true + bom + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + + com.puppycrawl.tools + checkstyle + 9.3 + + + + check/checkstyle/checkstyle.xml + check/checkstyle/suppressions.xml + UTF-8 + true + true + false + true + + **/apache/doris/thrift/*, + **/apache/parquet/**/* + + + + + validate + validate + + check + + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.9.1.2184 + + + + fe-common spark-dpp @@ -173,6 +325,46 @@ under the License. shade-format-flatbuffers 1.12.0 + + + general-env + + + !env.CUSTOM_MAVEN_REPO + + + + + central + central maven repo https + https://repo.maven.apache.org/maven2 + + + snapshots + apache snapshots maven repo https + https://repository.apache.org/content/repositories/snapshots/ + + + + + cloudera + https://repository.cloudera.com/artifactory/cloudera-repos/ + + + + + central + https://repo.maven.apache.org/maven2 + + + + + cloudera + https://repository.cloudera.com/artifactory/cloudera-repos/ + + + + @@ -534,12 +726,12 @@ under the License. - org.apache.httpcomponents httpclient + org.apache.httpcomponents - org.apache.httpcomponents httpcore + org.apache.httpcomponents @@ -589,8 +781,8 @@ under the License. io.netty netty - ${netty-3-test.version} test + ${netty-3-test.version} io.netty @@ -674,8 +866,8 @@ under the License. logback-classic - org.elasticsearch.client elasticsearch-rest-high-level-client + org.elasticsearch.client org.apache.hive @@ -900,13 +1092,13 @@ under the License. org.apache.spark spark-sql_2.12 ${spark.version} - provided org.apache.arrow arrow-vector + provided org.apache.spark @@ -921,16 +1113,16 @@ under the License. ${hadoop.version} - javax.servlet servlet-api + javax.servlet io.netty netty - com.fasterxml.jackson.core jackson-databind + com.fasterxml.jackson.core @@ -948,8 +1140,8 @@ under the License. log4j - javax.servlet servlet-api + javax.servlet @@ -1052,16 +1244,16 @@ under the License. ${hudi.version} - commons-httpclient commons-httpclient + commons-httpclient - io.netty netty-all + io.netty - log4j log4j + log4j org.apache.hive @@ -1241,8 +1433,8 @@ under the License. com.clickhouse clickhouse-jdbc ${clickhouse.version} - all provided + all @@ -1372,173 +1564,6 @@ under the License. - - - - - org.codehaus.mojo - flatten-maven-plugin - 1.2.5 - - true - bom - - - - flatten - - flatten - - process-resources - - - flatten.clean - - clean - - clean - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.2 - - check/checkstyle/checkstyle.xml - check/checkstyle/suppressions.xml - UTF-8 - true - true - false - true - **/apache/doris/thrift/*, - **/apache/parquet/**/* - - - - com.puppycrawl.tools - checkstyle - 9.3 - - - - - validate - - check - - validate - - - - - org.sonarsource.scanner.maven - sonar-maven-plugin - 3.9.1.2184 - - - com.diffplug.spotless - spotless-maven-plugin - 2.29.0 - - origin/master - - - 1.7 - - - - - ${maven.multiModuleProjectDirectory}/check/spotless/copyright.txt - - - - - org.apache.doris,org.apache,org,,javax,java,\# - - - - - UTF-8 - 4 - true - false - false - true - false - false - custom_1 - false - false - - - Leading blank line - --> - <project - --> - - <project - - - - - - - - - org.codehaus.mojo - flatten-maven-plugin - 1.2.5 - - - org.apache.maven.plugins - maven-dependency-plugin - - - org.commonjava.maven.plugins - directory-maven-plugin - 0.1 - - - directories - - directory-of - - initialize - - fe.dir - - org.apache.doris - fe - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - org.codehaus.mojo - license-maven-plugin - 2.0.0 - - - add-third-party - - add-third-party - - - - - - com.diffplug.spotless - spotless-maven-plugin - - - @@ -1547,87 +1572,15 @@ under the License. - https://doris.apache.org/ - - - Apache 2.0 License - https://www.apache.org/licenses/LICENSE-2.0.html - repo - - - - - Dev Mailing List - dev-subscribe@doris.apache.org - dev-unsubscribe@doris.apache.org - dev@doris.apache.org - - - Commits Mailing List - commits-subscribe@doris.apache.org - commits-unsubscribe@doris.apache.org - commits@doris.apache.org - - - - scm:git:https://git@github.com/apache/doris.git - scm:git:https://git@github.com/apache/doris.git - scm:git:https://git@github.com/apache/doris.git - HEAD - - - GitHub - https://github.com/apache/doris/issues - - - always - snapshots apache snapshots maven repo https https://repository.apache.org/content/repositories/snapshots/ + + always + - - - general-env - - - !env.CUSTOM_MAVEN_REPO - - - - - central - central maven repo https - https://repo.maven.apache.org/maven2 - - - snapshots - apache snapshots maven repo https - https://repository.apache.org/content/repositories/snapshots/ - - - - - cloudera - https://repository.cloudera.com/artifactory/cloudera-repos/ - - - - - central - https://repo.maven.apache.org/maven2 - - - - - cloudera - https://repository.cloudera.com/artifactory/cloudera-repos/ - - - -