Skip to content

Code Style Guide

Jan Motl edited this page Sep 27, 2016 · 1 revision

Indentation

Use spaces, not tabs.

Why? SQL code is difficult to indent with tabs. And combination of tabs and spaces is, I think we can agree, worse than just spaces or just tabs.

On Linux, Mac, etc.:

find . -type f -name "*.java" -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;

Eliminate all trailing whitespace

On Linux, Mac, etc.:

find . -type f -name "*.java" -exec perl -p -i -e "s/[ \t]$//g" {} \;

Unix (LF), not DOS (CRLF) line endings

On Linux, Mac, etc.:

find . -type f -name "*.java" -exec perl -p -i -e 's/\r\n|\n|\r/\n/g' {} \;

Clone this wiki locally