RuboCop Migrations
Rails migrations analysis as a extension
of RuboCop. Heavily inspired
by rubocop-cask which in turn is
inspired by rubocop-rspec.
Installation
Just install the rubocop-migrations gem
gem install rubocop-migrationsor if you use bundler put this in your Gemfile
gem 'rubocop-migrations'Usage
You need to tell RuboCop to load the Migrations extension. There are three ways to do this:
RuboCop configuration file
Put this into your .rubocop.yml:
require: rubocop/migrationsNow you can run rubocop and it will automatically load the RuboCop Migrations
cops together with the standard cops.
Command line
rubocop --require rubocop/migrationsThe Cop
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: falseContributing
- 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
Running the tests
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 installThen 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
License
rubocop-migrations is MIT
licensed. See the accompanying file for the full text.