Skip to content

github/rubocop-github

Repository files navigation

RuboCop GitHubCI

This repository provides recommended RuboCop configuration and additional Cops for use on GitHub open source and internal Ruby projects, and is the home ofGitHub's Ruby Style Guide.

Usage

Addrubocop-githubto your Gemfile, along with its dependencies:

gem"rubocop-github",require:false
gem"rubocop-performance",require:false
gem"rubocop-rails",require:false

Inherit all of the stylistic rules and cops through an inheritance declaration in your.rubocop.yml:

#.rubocop.yml
inherit_gem:
rubocop-github:
-config/default.yml#generic Ruby rules and cops
-config/rails.yml#Rails-specific rules and cops

Alternatively, only require the additional custom cops in your.rubocop.ymlwithout inheriting/enabling the other stylistic rules:

#.rubocop.yml
require:
-rubocop-github#generic Ruby cops only
-rubocop-github-rails#Rails-specific cops only

💭 Looking forconfig/accessibility.ymland theGitHub/Accessibilityconfigs? They have been moved toa new gem.

For more granular control over which of RuboCop's rules are enabled for your project, both from this gem and your own configs, consider using theDisabledByDefault: trueoption underAllCopsin your project's.rubocop.ymlfile. This will disable all cops by default, and you can then explicitly enable the ones you want by settingEnabled: true.Seethe RuboCop docsfor more information.

Legacy usage

If you are using a rubocop version < 1.0.0, you can use rubocop-github version 0.16.2 (see the README from that version for more details).

Testing

bundle install
bundleexecraketest

The Cops

All cops are located underlib/rubocop/cop/github.