No release in over 3 years
Pragmatic Ruby Styling for Projects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Project Readme

Pragmatic Ruby Styling for Projects

Gem Version CI Gem Downloads

Setting up a new project with Rubocop can take some time. There are several decisions to make and many plugins to consider. This gem attempts to alleviate some of this hassle by both curating a default set of plugins and a default set of config overrides. Rubocop's defaults are usually top notch, but there are a few areas where the cops might be considered a little too pedantic and/or strict. This gem attempts to find a reasonable and pragmatic middle ground to get a new project off the ground and running well with Ruby's favorite linter.

Installation

gem "rubocop-pragmatic", require: false, group: [:development]

Run bundle, then bundle binstubs rubocop.

Add a default .rubocop.yml file in the root of your Rails application with:

inherit_gem:
  rubocop-pragmatic: rails.yml

# Your own specialized rules go here

For a ruby gem or project (not using Rails):

inherit_gem:
  rubocop-pragmatic: ruby.yml

# Your own specialized rules go here

Or to customize your own combination:

inherit_gem:
  rubocop-pragmatic:
    - rubocop.yml
    - rubocop-factory_bot.yml
    - rubocop-md.yml
    - rubocop-minitest.yml
    - rubocop-performance.yml

inherit_mode:
  merge:
    - Exclude

# Your own specialized rules go here

rubocop-pragmatic is opionated about minitest, but offers the option to customize with rubocop-rspec and rubocop-rspec_rails:

inherit_gem:
  rubocop-pragmatic:
    - rails.yml
    - rubocop-rspec.yml
    - rubocop-rspec_rails.yml

Minitest:
  Enabled: false

# Your own specialized rules go here

Fail Level Recommendation

It's also recommended to set --fail-level=convention. Metrics and Performance cops run at the "refactor" severity level while all other cops run at the "convention" severity level by default. This is intentional as to not return a failure exit code for Metrics or Performance cops. e.g. Sometimes, these cops need to be ignored while dealing with hotfixes or emergency PRs etc.

This can be set on a project by adding a .rubocop file in the root of your project:

--fail-level=convention

License

MIT License