New Code Style Proposal
See original GitHub issueThe code style guide we made in 2014 was a step in the right direction, but it didn’t really work out perfectly because I could never get Eclipse and IntelliJ to format the same as each other nor was there a way to format from the command line for people not using those IDEs.
In #2443 , the proposed solution is to use the fmt-maven-plugin
plugin, which formats your code using google-java-format, which also has Eclipse and IntelliJ plugins.
If we switch to this system, the diff files will be much easier to read for me, which I’m having to do a lot these days (5+ PRs per day sometimes).
formatting
mvn com.coveo:fmt-maven-plugin:format
Formats your code using google-java-format which follows Google’s code styleguide.
If you want your IDE to stick to the same format, check out the available configuration plugins:
Eclipse
Download google-java-format-eclipse-plugin_*.jar
and place in /Applications/Eclipse Java.app/Contents/Eclipse/dropins
. Select the plugin in Preferences > Java > Code Style > Formatter > Formatter Implementation
. Restart Eclipse.
IntelliJ
In the plugins section in IntelliJ search for google-java-format
and install the plugin. Restart IntelliJ.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (10 by maintainers)
Top GitHub Comments
I’d agree with the proposal to permit but not mandate lombok.
https://github.com/timmolter/XChange/wiki/Code-Style