Guard::Rubocop allows you to automatically check Ruby code style with RuboCop when files are modified.
Tested on MRI 1.9, MRI 2.0, JRuby and Rubinius in 1.9 modes.
Please make sure to have Guard installed before continue.
Add guard-rubocop
to your Gemfile
:
group :development do
gem 'guard-rubocop'
end
and then execute:
$ bundle install
or install it yourself as:
$ gem install guard-rubocop
Add the default Guard::Rubocop definition to your Guardfile
by running:
$ guard init rubocop
Please read the Guard usage documentation.
You can pass some options in Guardfile
like the following example:
guard :rubocop, all_on_start: false, cli: ['--format', 'clang', '--rails'] do
# ...
end
all_on_start: true # Check all files at Guard startup.
# default: true
cli: ['--rails'] # Pass arbitrary RuboCop CLI arguments.
# An array or string is acceptable.
# default: nil
keep_failed: true # Keep failed files until they pass.
# default: true
notification: :failed # Display Growl notification after each run.
# true - Always notify
# false - Never notify
# :failed - Notify only when failed
# default: :failed
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request