Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update code formatter and its settings #18

Merged
merged 11 commits into from
Jul 25, 2022
37 changes: 20 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,19 +281,6 @@
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
<artifactId>maven-java-formatter-plugin</artifactId>
<versionRange>[0.4,)</versionRange>
<goals>
<goal>format</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
Expand All @@ -313,21 +300,37 @@
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<!-- formatter -->
<!-- formatter refer to: https://code.revelc.net/formatter-maven-plugin/examples.html -->
<plugin>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
<artifactId>maven-java-formatter-plugin</artifactId>
<version>0.4</version>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.15.0</version>
<!--
<executions>
<execution>
<goals>
<goal>format</goal>
<goal>validate</goal>
</goals>
</execution>
</executions>
-->
<configuration>
<configFile>${main.user.dir}/tools/codestyle/formatter.xml</configFile>
<encoding>${project.encoding}</encoding>
<excludes>
<exclude>**/ServiceLoader.java</exclude>
<exclude>**/UnsafeUtil.java</exclude>
<exclude>**/proto/*</exclude>
<exclude>**/sql/AbstractCharStream.java</exclude>
<exclude>**/sql/CeresDBxSqlParser.java</exclude>
<exclude>**/sql/CeresDBxSqlParserConstants.java</exclude>
<exclude>**/sql/CeresDBxSqlParserTokenManager.java</exclude>
<exclude>**/sql/ParseException.java</exclude>
<exclude>**/sql/SimpleCharStream.java</exclude>
<exclude>**/sql/Token.java</exclude>
<exclude>**/sql/TokenMgrException.java</exclude>
</excludes>
</configuration>
</plugin>
<!-- sort pom -->
Expand Down
31 changes: 31 additions & 0 deletions tools/codestyle/IDEA-formatter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<code_scheme name="CeresDB Convention" version="173">
<JavaCodeStyleSettings>
<option name="ENABLE_JAVADOC_FORMATTING" value="false" />
</JavaCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
<option name="ALIGN_GROUP_FIELD_DECLARATIONS" value="true" />
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true" />
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
</codeStyleSettings>
</code_scheme>
Loading