From 9c43e6386d89874721f9e1823cd5bad31d14413f Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Fri, 8 Jul 2022 10:50:09 +0800 Subject: [PATCH 01/10] chore: fix pmd violations --- ceresdb-protocol/src/main/java/com/ceresdb/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ceresdb-protocol/src/main/java/com/ceresdb/Utils.java b/ceresdb-protocol/src/main/java/com/ceresdb/Utils.java index a3bffae..11f0964 100644 --- a/ceresdb-protocol/src/main/java/com/ceresdb/Utils.java +++ b/ceresdb-protocol/src/main/java/com/ceresdb/Utils.java @@ -196,7 +196,7 @@ public static Result toResult(final Storage.WriteResponse resp, // final int failed = resp.getFailed(); if (code == Result.SUCCESS) { - final Set metrics = (rows != null && WriteOk.isCollectWroteDetail()) + final Set metrics = rows != null && WriteOk.isCollectWroteDetail() ? rows.stream() .map(Rows::getMetric) .collect(Collectors.toSet()) From 2358530dd4ea161adf5081a198105558f5a8a880 Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Sat, 9 Jul 2022 06:47:30 +0800 Subject: [PATCH 02/10] chore: optimize eclipse java dev environment --- .gitignore | 3 +++ ceresdb-http/pom.xml | 1 - ceresdb-rpc/pom.xml | 1 - ceresdb-sql/pom.xml | 1 - pom.xml | 56 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d1a7d0a..0a53632 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ target # dev tools .idea +.classpath +.project +.settings diff --git a/ceresdb-http/pom.xml b/ceresdb-http/pom.xml index 1995e38..10525ad 100644 --- a/ceresdb-http/pom.xml +++ b/ceresdb-http/pom.xml @@ -38,5 +38,4 @@ gson - diff --git a/ceresdb-rpc/pom.xml b/ceresdb-rpc/pom.xml index c69e07d..7cabea4 100644 --- a/ceresdb-rpc/pom.xml +++ b/ceresdb-rpc/pom.xml @@ -16,5 +16,4 @@ - diff --git a/ceresdb-sql/pom.xml b/ceresdb-sql/pom.xml index 15ba49a..4b2c300 100644 --- a/ceresdb-sql/pom.xml +++ b/ceresdb-sql/pom.xml @@ -38,5 +38,4 @@ test - diff --git a/pom.xml b/pom.xml index 30f2a53..ee5d280 100644 --- a/pom.xml +++ b/pom.xml @@ -244,6 +244,62 @@ + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + com.mycila + license-maven-plugin + [3.0,) + + remove + format + + + + + + + + + com.github.ekryd.sortpom + sortpom-maven-plugin + [2.4.0,) + + sort + + + + + + + + + com.googlecode.maven-java-formatter-plugin + maven-java-formatter-plugin + [0.4,) + + format + + + + + + + + + + + + org.apache.maven.plugins From fb0e4c1c4de4c24db28e1ae831944003c79c383c Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Sun, 10 Jul 2022 01:02:57 +0800 Subject: [PATCH 03/10] feat: optimize code format for enum --- tools/codestyle/formatter.xml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tools/codestyle/formatter.xml b/tools/codestyle/formatter.xml index c7289dd..8ff7ba4 100644 --- a/tools/codestyle/formatter.xml +++ b/tools/codestyle/formatter.xml @@ -33,7 +33,6 @@ - @@ -49,18 +48,15 @@ - - - @@ -70,7 +66,6 @@ - @@ -84,7 +79,6 @@ - @@ -104,7 +98,6 @@ - @@ -118,7 +111,6 @@ - @@ -129,9 +121,7 @@ - - @@ -142,7 +132,6 @@ - @@ -174,7 +163,6 @@ - @@ -184,7 +172,6 @@ - @@ -193,11 +180,9 @@ - - @@ -205,11 +190,9 @@ - - @@ -243,8 +226,6 @@ - - @@ -269,7 +250,6 @@ - From 35cbddd62082c1ce927012f6dc3e42eac310f52c Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Sun, 10 Jul 2022 01:06:42 +0800 Subject: [PATCH 04/10] feat: set new formatter for this project --- pom.xml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ee5d280..7f716e8 100644 --- a/pom.xml +++ b/pom.xml @@ -314,7 +314,7 @@ - + + + + net.revelc.code.formatter + formatter-maven-plugin + 2.15.0 + + + ${main.user.dir}/tools/codestyle/formatter.xml + ${project.encoding} + From aed4f59e5d3626d8405e2a484922c99219ddf6fb Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Sun, 10 Jul 2022 03:12:58 +0800 Subject: [PATCH 05/10] feat: fix wrong args --- tools/codestyle/formatter.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/codestyle/formatter.xml b/tools/codestyle/formatter.xml index 8ff7ba4..ecabc49 100644 --- a/tools/codestyle/formatter.xml +++ b/tools/codestyle/formatter.xml @@ -59,7 +59,7 @@ - + From 6babd55def3ddc89b12f7fbab33248c9231e0615 Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Sun, 10 Jul 2022 14:50:33 +0800 Subject: [PATCH 06/10] feat: code formatter scan dir --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index 7f716e8..75af00f 100644 --- a/pom.xml +++ b/pom.xml @@ -348,6 +348,9 @@ ${main.user.dir}/tools/codestyle/formatter.xml ${project.encoding} + + ${main.user.dir}/ceresdb-sql-javacc + From b2f9cabce3ac92e6bffa10920195cf7ef9a584d6 Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Fri, 22 Jul 2022 02:04:58 +0800 Subject: [PATCH 07/10] fix: exclude the generated codes for the formatter --- pom.xml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 75af00f..35efe2f 100644 --- a/pom.xml +++ b/pom.xml @@ -348,9 +348,19 @@ ${main.user.dir}/tools/codestyle/formatter.xml ${project.encoding} - - ${main.user.dir}/ceresdb-sql-javacc - + + **/ServiceLoader.java + **/UnsafeUtil.java + **/proto/* + **/sql/AbstractCharStream.java + **/sql/CeresDBxSqlParser.java + **/sql/CeresDBxSqlParserConstants.java + **/sql/CeresDBxSqlParserTokenManager.java + **/sql/ParseException.java + **/sql/SimpleCharStream.java + **/sql/Token.java + **/sql/TokenMgrException.java + From f5a9a2232acb45396fdb17b53db3848b13da0201 Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Fri, 22 Jul 2022 02:07:26 +0800 Subject: [PATCH 08/10] chore: remove the deprecated code formatter --- pom.xml | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/pom.xml b/pom.xml index 35efe2f..912c8c4 100644 --- a/pom.xml +++ b/pom.xml @@ -281,19 +281,6 @@ - - - com.googlecode.maven-java-formatter-plugin - maven-java-formatter-plugin - [0.4,) - - format - - - - - - @@ -313,23 +300,6 @@ true - - net.revelc.code.formatter From abd21130506ca4226aa1fcdb6e05438b2b1cd870 Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Fri, 22 Jul 2022 02:10:16 +0800 Subject: [PATCH 09/10] chore: rename internal name of the code formatter --- tools/codestyle/formatter.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/codestyle/formatter.xml b/tools/codestyle/formatter.xml index ecabc49..354c46d 100644 --- a/tools/codestyle/formatter.xml +++ b/tools/codestyle/formatter.xml @@ -1,6 +1,6 @@ - + From 7d2f294a2b94adb96107db37ec41d5e1c294cd25 Mon Sep 17 00:00:00 2001 From: Arthur Chern Date: Mon, 25 Jul 2022 16:26:41 +0800 Subject: [PATCH 10/10] chore: add IDEA formatter settings and modify the eclipse formatter settings to be consistent with the IDEA formatter --- tools/codestyle/IDEA-formatter.xml | 31 ++++++++++++++++++++++++++++++ tools/codestyle/formatter.xml | 20 ++++++++++--------- 2 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 tools/codestyle/IDEA-formatter.xml diff --git a/tools/codestyle/IDEA-formatter.xml b/tools/codestyle/IDEA-formatter.xml new file mode 100644 index 0000000..1971e42 --- /dev/null +++ b/tools/codestyle/IDEA-formatter.xml @@ -0,0 +1,31 @@ + + + + + + \ No newline at end of file diff --git a/tools/codestyle/formatter.xml b/tools/codestyle/formatter.xml index 354c46d..981f35f 100644 --- a/tools/codestyle/formatter.xml +++ b/tools/codestyle/formatter.xml @@ -7,6 +7,7 @@ + @@ -28,7 +29,8 @@ - + + @@ -41,7 +43,7 @@ - + @@ -53,7 +55,7 @@ - + @@ -79,7 +81,7 @@ - + @@ -137,7 +139,7 @@ - + @@ -152,12 +154,12 @@ - + - + @@ -170,7 +172,7 @@ - + @@ -206,7 +208,7 @@ - +