Coding Guidelines

Coding Style

Simplicity

Prefer simple instructions over complicated ones, even if that means using more lines or duplicating code.

Avoid one-liners, complicated conditions, language specificities and abstract/generic patterns.

If your code needs to be explained, comment it.. or even better, rewrite it in a simpler way.

Consistency

Adopt the coding style used in the project you’re contributing to.

This guarantees consistency between your new code and the existing code.

Indentation

In new projects or new files, do not use tabs. Use 4 space characters instead.

Trailing spaces

Do not leave trailing spaces in your code.

Hint

In Sublime, install the TrailingSpaces plugin to automatically highlight trailing spaces and give you the option to easily delete them.

Maximum Line length

Fit your code within 120 columns.

If a line of code is longer than 120 characters, break it into two or more lines.

Hint

In Sublime, select View ‣ Ruler ‣ 120 to show a ruler.