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-norb
or 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-norb
Alternatively, use the following array notation when specifying multiple extensions.
require:
- rubocop-other-extension
- rubocop-norb
Now you can run rubocop
and it will automatically load the RuboCop Norb
cops together with the standard cops.
rubocop --require rubocop-norb
RuboCop::RakeTask.new do |task|
task.requires << 'rubocop-norb'
end
All 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/**/*.rb
Checkout 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.