Rails migrations analysis as a extension
of RuboCop. Heavily inspired
by rubocop-cask
which in turn is
inspired by rubocop-rspec
.
Just install the rubocop-migrations
gem
gem install rubocop-migrations
or if you use bundler put this in your Gemfile
gem 'rubocop-migrations'
You need to tell RuboCop to load the Migrations extension. There are three ways to do this:
Put this into your .rubocop.yml
:
require: rubocop/migrations
Now you can run rubocop
and it will automatically load the RuboCop Migrations
cops together with the standard cops.
rubocop --require rubocop/migrations
All cops are located
under lib/rubocop/cop/migrations
, and contain
examples/documentation.
In your .rubocop.yml
, you may treat the Cask cops just like any other cop. For
example:
Migrations/RemoveIndex:
Enabled: false
- 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
We use Appraisals in order to run the tests with different rubocop versions to ensure compatibility.
To run the specs with all supported rubocop versions first install the required dependencies with:
bundle exec appraisals install
Then run the specs by just running rake
it will run specs with all the
versions.
For more info just check the appraisals documentation https://github.com/thoughtbot/appraisal
rubocop-migrations
is MIT
licensed. See the accompanying file for the full text.