armitage-rubocop · Gem Version


Configured rules:

  • Common (.rubocop.general.yml) (.rubocop.rails.yml) (.rubocop.rake.yml)
    • Bundler
    • Rake
    • Gemspec
    • Layout
    • Lint
    • Metrics
    • Migration
    • Naming
    • Performance
    • Rails (isn't included in .rubocop.general.yml)
    • Security
    • Style
    • Rake (isn't included in .rubocop.general.yml)
  • RSpec (.rubocop.rspec.yml) (.rubocop.rails.yml)
    • Capybara
    • FactoryBot
    • Rails
    • RSpec
  • RBS (.rubocop.rbs.yml)
    • Style
    • Lint
    • Layout

Installation

gem 'armitage-rubocop'
$ bundle install
# --- or ---
$ gem install 'armitage-rubocop'
require 'armitage-rubocop'

Usage

  • edit your .rubocop.yml file:
# --- vanilla ---
inherit_gem:
  armitage-rubocop:
    - lib/rubocop.general.yml
    - lib/rubocop.rspec.yml
    - lib/rubocop.rake.yml
    - lib/rubocop.rbs.yml # NOTE: if you use RBS

# NOTE: (!for RBS file inclusion!)
#   - add your rbs files location to <AllCops:Include:> directly
#     cuz `RBS` department has no working `Include` option at the moment :dunno-why:
AllCops:
  Include:
    - "**/*.rbs" # add your path our use this global default
# --- rails ---
inherit_gem:
  # rails-specific cops + general + rspec
  armitage-rubocop:
    - lib/rubocop.rails.yml
    - lib/rubocop.rbs.yml # NOTE: if you use RBS

Build

# --- full build ---
bundle exec rake armitage_rubocop:build

# --- validate code style ---
bundle exec rake rubocop

# --- validate yaml files ---
bundle exec rake armitage_rubocop:validation:valid_yamls

# --- validate rubocop cops (existence and params) ---
bundle exec rake armitage_rubocop:validation:recognizable_cops