Style Guide

Check out the community Ruby Style Guide for complete reference.



Remove trailing whitespaces at the end of line or after line-break.
Consecutive whitespaces should be removed as well.

Ruby hash syntax

Prefer Ruby new hash syntax

foo: :bar
instead of
:foo => bar

Missing space after comment

Insert one single whitespace after comment.

# comment goes here

Escape javascript

Prefer the shortcut

over the full syntax

Model validations


validates_presence_of :name
instead of
validates :name, presence: true

Mixed double and single quotes

Mixed double and single quotes in file.

Space inside { missing

Add a space after {

Space inside } missing

Add a space before }

Surrounding space missing for operator '='

Add space before and after operator '='

Extra blank line detected

Remove extra line at end of file

Line length

Allow for a maximum of 100 characters before line break. Official style guide sets it to 80 only.