Browse Source

[Improvement][style] Improve checkstyle import order and code style importer (#3368)

* [Improvement][style] Add code import style automatic formatter

* Update checkstyle.xml

* Update checkstyle.xml

* [Improvement][api] Improve the code style and checkstyle of ds

* Update checkstyle.xml
pull/3/MERGE
Yichao Yang 4 years ago committed by GitHub
parent
commit
db39f1f385
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 63
      style/checkstyle.xml
  2. 16
      style/intellij-java-code-style.xml

63
style/checkstyle.xml

@ -186,19 +186,51 @@
</module>
<module name="Indentation">
<property name="basicOffset" value="2"/>
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="2"/>
<property name="throwsIndent" value="4"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="2"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="2"/>
<property name="arrayInitIndent" value="4"/>
</module>
<module name="UnusedImports"/>
<module name="IllegalImport">
<property name="regexp" value="true"/>
<property name="illegalPkgs"
value="^com\.google\.api\.client\.repackaged,
^avro\.shaded, ^org\.apache\.hadoop\.hbase\.shaded,
^org\.apache\.hadoop\.shaded,
^javax\.ws\.rs\.ext,
^cc\.concurrent\.mango\.util\.concurrent,
^org\.apache\.curator-test\.shaded,
^com\.sun\.istack,
^org\.apache\.commons\.lang,
^org\.jetbrains\.annotations,
^jline\.internal,
^com\.cronutils\.utils,
^javax\.ws\.rs\.ext,
^org\.jboss\.netty\.util\.internal,
^com\.sun\.javafx,
^io\.reactivex\.annotations,
^org\.codehaus\.jackson"/>
<property name="illegalClasses"
value="^java\.util\.logging\.Logging,
^sun\.misc\.BASE64Encoder,
^sun\.misc\.BASE64Decoder,
^jdk\.internal\.jline\.internal\.Nullable"/>
</module>
<module name="RedundantImport"/>
<module name="MethodParamPad"/>
<module name="UnusedImports"/>
<module name="ImportOrder">
<property name="groups" value="org.apache.dolphinscheduler,org.apache,java,javax,org,com"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="top"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens" value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
@ -233,11 +265,6 @@
<module name="CommentsIndentation"/>
<module name="IllegalImport">
<property name="illegalPkgs" value="org.apache.commons"/>
<property name="illegalClasses" value="java.util.Optional, com.google.common.base.Optional"/>
</module>
<module name="EmptyStatement">
<property name="severity" value="error"/>
</module>
@ -249,16 +276,6 @@
<property name="allowMissingParamTags" value="true"/>
</module>
<module name="ImportOrder">
<property name="groups" value="org.apache.dolphinscheduler, *, javax, java, scala"/>
<property name="separated" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
<property name="option" value="bottom"/>
<property name="tokens" value="STATIC_IMPORT, IMPORT"/>
<message key="import.ordering"
value="Import {0} appears after other imports that it should precede"/>
</module>
<module name="AvoidStarImport"/>
</module>

16
style/intellij-java-code-style.xml

@ -37,8 +37,24 @@
</option>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="org.apache.dolphinscheduler" withSubpackages="true" static="true" />
<emptyLine />
<package name="org.apache" withSubpackages="true" static="true" />
<emptyLine />
<package name="java" withSubpackages="true" static="true" />
<emptyLine />
<package name="javax" withSubpackages="true" static="true" />
<emptyLine />
<package name="org" withSubpackages="true" static="true" />
<emptyLine />
<package name="com" withSubpackages="true" static="true" />
<emptyLine />
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="org.apache.dolphinscheduler" withSubpackages="true" static="false" />
<emptyLine />
<package name="org.apache" withSubpackages="true" static="false" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />

Loading…
Cancel
Save