Source code style checker for Ruby
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
spec
.gitignore
.rspec
.rstyle
.travis.yml
Gemfile
LICENSE
README.textile
Rakefile
rstyle.gemspec

README.textile

RStyle

Implements checks for some of the Ruby style guide items.

This tool is meant to be use as a pre-commit hook for git, to ensure the code is properly formatted. Run the following

cd .git/hooks
ln -s /path/to/bin/rstyle

and you’ll have to be compliant with the rstyle checks to be able to commit code to the repository.

It can also be used to check one or more ruby files in standalone mode:

rstyle /path/to/rubyfile.rb

Style checks

The style checker looks for the following:

  • line longer than 80 characters
  • empty line contains whitespace
  • line contains tab(s)
  • line ends with whitespace
  • no space after ,
  • space after ( and [ or before ) and ]
  • methods should be in snake_case
  • use two spaces before statement modifiers

It will also issue warnings for the following:

  • don’t use for/code> unless you know what you are doing