A RuboCop extension focused on enforcing NORB (None of Rails Business). An opinionated approach to separating business logic from Rails framework code.
Just install the rubocop-norb gem
gem install rubocop-norbor if you use bundler put this in your Gemfile
gem 'rubocop-norb'You need to tell RuboCop to load the Norb extension. There are three ways to do this:
Put this into your .rubocop.yml.
require: rubocop-norbAlternatively, use the following array notation when specifying multiple extensions.
require:
- rubocop-other-extension
- rubocop-norbNow you can run rubocop and it will automatically load the RuboCop Norb
cops together with the standard cops.
rubocop --require rubocop-norbRuboCop::RakeTask.new do |task|
task.requires << 'rubocop-norb'
endAll cops are located under
lib/rubocop/cop/norb, and contain
examples/documentation.
In your .rubocop.yml, you may treat the Norb cops just like any other
cop. For example:
Norb/BinaryOperation:
Include:
- app/controllers/**/*.rbCheckout the contribution guidelines.
rubocop-norb is MIT licensed. See the accompanying file for
the full text.
Credit goes to Bozhidar Batsov and other RuboCop contributors for the great Rubocop framework of this gem.