Java Format Code

The formatting of the Java part of the code in Doris is usually done automatically by the IDE. Only the general format rules are listed here. For developer, you need to set the corresponding code styles in different IDEs according to the format rules.

Import Order

  1. org.apache.doris
  2. <blank line>
  3. com
  4. <blank line>
  5. org
  6. <blank line>
  7. java
  8. <blank line>
  9. javax
  10. <blank line>
  • Do not use import *
  • Do not use import static

Checkstyle

Now we have formatter-check in CI to check the code format.

If you use IDEA to develop Java code, please install Checkstyle-IDEA plugin.

Setting the checkstyle.xml file in Tools->Checkstyle.

Click the plus sign under Configuration File, Select Use a local Checkstyle file, and select the fe/checkstyle.xml file.

If you use VS Code to develop Java code, please install Checkstyle for Java plugin, and config according to the documentJava Format Code - 图1 (opens new window) and the picture.