RuboCop Bridgetown

A RuboCop extension to enforce a common code style in the Bridgetown ecosystem and beyond.

Gem Version RuboCop Support

Installation

Just add the rubocop-bridgetown gem to your Gemfile.

# Gemfile

gem "rubocop-bridgetown", "~> 0.3"
# <plugin>.gemspec

spec.add_development_dependency "rubocop-bridgetown", "~> 0.3"

and run bundle install

Usage

You need to tell RuboCop to load the extension and inherit the custom RuboCop configuration advocated by Bridgetown.

Place the following at the top of your .rubocop.yml.

require: rubocop-bridgetown
inherit_gem:
  rubocop-bridgetown: .rubocop.yml

Running bundle exec rubocop will now automatically load the rubocop-bridgetown cops together with the standard cops.

You can also add a rubocop task to your Rakefile.

# Rakefile

require "rubocop/rake_task"

RuboCop::RakeTask.new

Exclude Folders List

Currently it seems Rubocop doesn't inherit the Excludes folder list from the gem configuration, so you may want to add it manually to your .rubocop.yml file:

AllCops:
  Exclude:
    - bin/**/*
    - exe/**/*
    - benchmark/**/*
    - node_modules/**/*
    - script/**/*
    - vendor/**/*
    - tmp/**/*

Customization

You can override any settings inherited from the extension by subsequently redefining the concerned parameters.