Sashité RuboCop

Version Ruby documentation Ruby RuboCop License

Shared RuboCop config used by Sashité's Ruby projects 👮🏾

About

At Sashité, many of our services are built on Ruby.

To keep the code base consistent across projects, we have collected here the common style rules we use to improve readability and maintainability.

A chessboard, with a cop, a pawn and some Ruby

Installation

Add this line to your application's Gemfile:

gem "sashite-rubocop"

And then execute:

bundle install

Or install it yourself as:

gem install sashite-rubocop

Usage

There are 2 ways we can add these configs to your project.

Inherit from Gem

# .rubocop.yml
inherit_gem:
  sashite-rubocop:
    - config/rubocop.yml
    - config/rubocop/performance.yml
    - config/rubocop/rails.yml
    - config/rubocop/rake.yml
    - config/rubocop/rspec.yml
    - config/rubocop/sequel.yml
    - config/rubocop/thread_safety.yml

# Some files define `Exclude` for same cops. To merge the `Exclude` rules, add:
inherit_mode:
  merge:
    - Exclude

Inherit from Remote URL

The example below assumes you want to fetch from the latest config (i.e., from main branch).

This is recommended if you prefer not to install any gem. RuboCop will download and cache copies of these config files locally.

For more details, please see the RuboCop document: https://rubocop.readthedocs.io/en/latest/configuration/#inheriting-configuration-from-a-remote-url

Add these lines to your .rubocop.yml:

# .rubocop.yml
inherit_from:
  - https://raw.githubusercontent.com/sashite/sashite-rubocop.rb/main/config/rubocop.yml
  - https://raw.githubusercontent.com/sashite/sashite-rubocop.rb/main/config/rubocop/performance.yml
  - https://raw.githubusercontent.com/sashite/sashite-rubocop.rb/main/config/rubocop/rails.yml
  - https://raw.githubusercontent.com/sashite/sashite-rubocop.rb/main/config/rubocop/rake.yml
  - https://raw.githubusercontent.com/sashite/sashite-rubocop.rb/main/config/rubocop/rspec.yml
  - https://raw.githubusercontent.com/sashite/sashite-rubocop.rb/main/config/rubocop/sequel.yml
  - https://raw.githubusercontent.com/sashite/sashite-rubocop.rb/main/config/rubocop/thread_safety.yml

Versioning

Sashité RuboCop uses Semantic Versioning 2.0.0

License

The gem is available as open source under the terms of the MIT License.