Eclipse formatter and cleanup configuration - GoCodingGroup/MultiplicationTable GitHub Wiki

Eclipse allows users to share their code formatter and code cleanup settings. To make collaboration with git easier, it is best if all submitted code is formatted and cleaned equally. Commands like git diff will be guaranteed to show only the lines that were actually changed, not simply reformated by different eclipse settings.

Installation guide:

  • Check out the latest commit from the develop branch to get started.
  • Inside eclipse, go to "Window" -> "Preferences" and then under "Java" expand "Code Style.
  • Click on "Clean Up", then "Import..." and select the "GoCodingGroup_cleanup.xml" file inside "<MultiplicationTableGitDir/eclipse/>" on your machine.

What it should look like

  • Do the same for the "Formatter" option, only this time selecting "GoCodingGroup_formatter.xml" as your file.

What it should look like

  • Click "Organize Imports" and then replace both values "99" with a zero.

What it should look like

  • Finally, to prevent you from forgetting to apply the formatting before committing, Enable "Perform the selected actions on save" under "Java" -> "Editor" -> "Save Actions" in the settings pane. Make sure that "Format source code" -> "Format all lines" and "Organize imports" is selected.

What it should look like