This repository contains style guides for code in my projects, to facilitate formatting with different IDEs for contributors and to maintain consistency in my code.
They are based in the Google Style Guide for Java, with the following changes (mandatory):
- Blocks of non-static imports ordering:
org.magicdgs.*- other packages in alphabetical order
java.*andjavax.*
- Indentation:
- +4 spaces for new blocks
- Double spacing for continuation blocks
- No alignment in multi-line statements
- Line-wrapping:
- Enum constants are always wrapped
- Annotations are always wrapped, but not the parameters even if they exceed the line limit
- Javadoc:
- At-clauses descriptions are aligned
- Blank lines after description, @param and @return
-
IntelliJ
- Go to "Preferences" -> "Coding Style".
- Import intellij-java-magicdgs-style.xml
-
Eclipse
- Go to "Window" -> "Preferences", then to "Java" -> "Code Style".
- In "Clean Up", click on "Import" and select the file eclipse-java-magicdgs-cleanUp.xml
- In "Formatter", click on "Import" and select the file eclipse-java-magicdgs-formatter.xml
- In "Organize Imports", click on "Import" and select the file eclipse-java-magicdgs.importorder
This files are licensed under the CC-By 3.0 License, as the starting templates from the Google styleguide repository.
