mqliang commented on pull request #6807:
URL: https://github.com/apache/incubator-pinot/pull/6807#issuecomment-821780315


   @Jackie-Jiang 
   > Change the eclipse format to follow the current intellij format as much as 
possible (e.g. new line for exception, new space for array declaration etc.). 
We should not see almost all files reformatted
   
   Unfortunately, for "new line for exception", in Intellj, it's corresponding 
option is called "always wrap throws keyword":
   
![Jietu20210416-234504](https://user-images.githubusercontent.com/12423751/115104530-ee84bd80-9f0d-11eb-816a-c584dec50b81.jpg)
   
   Eclipse formatter does not has such a option, here is a complete list of 
Eclipse formatter options: 
https://github.com/eclipse/eclipse.jdt.core/blob/7e35bbd8b9cc36a449e562c61841f9968ec4bec3/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java#L122-L524
   
   For `new space for array declaration etc`, I have change the 
codestyle-eclipse.xml file to match IntellJ behavior.
   
   So, it's almost impossible to make the maven plugin be consistent with 
IntellJ behavior if we use eclipse formatter given that IntellJ/Eclipse provide 
different options. 
   
   If we wanner keep consistency across IntellJ IDE, Eclipse IDE and maven 
plugin, the only choice is [the google 
formatter](https://github.com/google/google-java-format), which has plugin for 
both IntellJ/Eclipse/Maven.
   
   The drawback is:
   * the tool enforces [Google Java style 
guide](https://google.github.io/styleguide/javaguide.html), which was [praised 
and recommended by the Oracle Java team as described in the Oracle Java 
magazine](https://alanzeichick.com/2016/11/wheres-best-java-coding-style-guide-not-oracle.html)
 though, the tool itself does not allow too much config by design. Copied form
   google-java-format project home page:
   ```
   Note: There is no configurability as to the formatter's algorithm for 
formatting. This is a deliberate design decision to unify 
   our code formatting on a single format.
   ```
   * The tool will mess up license header, see: 
https://github.com/diffplug/spotless/issues/843. If there is no 
solution/workaround, it's impossible to be used for pinot.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to