Code style checking for GitHub's Ruby projects
Перейти к файлу
Max Prokopiev 9b0765e7be Add test cop 2024-02-16 11:14:28 +01:00
.github Add Ruby 3.2 to test matrix; add .ruby-version; ensure Rubocop::Config is passed to test helper 2023-03-24 10:08:12 -07:00
config Add AvoidObjectSendWithDynamicMethod to config 2024-01-03 13:31:05 -06:00
guides Replace custom `RailsApplicationRecord` and `RailsRenderInline` cops with their upstream equivalent 2022-10-13 13:41:13 -07:00
lib Add test cop 2024-02-16 11:14:28 +01:00
test Add AvoidObjectSendWithDynamicMethod cop 2024-01-03 13:26:32 -06:00
.gitignore Add Gemfile.lock to version control 2022-01-14 16:17:10 -05:00
.rubocop.yml Pin versions, add Dependabot rules, update rubocop versions and create pending files 2022-10-28 10:17:54 -07:00
.ruby-version Add Ruby 3.2 to test matrix; add .ruby-version; ensure Rubocop::Config is passed to test helper 2023-03-24 10:08:12 -07:00
CHANGELOG.md Update changelog for v0.21.0 2024-01-03 13:31:45 -06:00
CODEOWNERS Update codeowners to `rubocop-reviewers` 2023-03-24 10:17:42 -07:00
CODE_OF_CONDUCT.md Add Contribution instructions, code of conduct, and codeowners 2022-10-13 14:03:21 -07:00
CONTRIBUTING.md Pin versions, add Dependabot rules, update rubocop versions and create pending files 2022-10-28 10:17:54 -07:00
Gemfile Fix for RuboCop 2018-09-13 09:58:59 -04:00
Gemfile.lock Bump gem version to 0.21.0 2024-01-03 13:31:35 -06:00
LICENSE Add LICENSE 2016-12-09 22:22:37 -08:00
README.md Fix usage documentation for Inheriting all of the stylistic rules and cops 2022-12-05 12:01:37 +00:00
Rakefile Fix for RuboCop 2018-09-13 09:58:59 -04:00
STYLEGUIDE.md STYLEGUIDE: `UnusedBlockArgument` is in `Lint` not `Style` 2022-10-27 12:16:15 +01:00
rubocop-github.gemspec Bump gem version to 0.21.0 2024-01-03 13:31:35 -06:00

README.md

RuboCop GitHub CI

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

Usage

Add rubocop-github to 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.yml without inheriting/enabling the other stylistic rules:

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

💭 Looking for config/accessibility.yml and the GitHub/Accessibility configs? They have been moved to a 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 the DisabledByDefault: true option under AllCops in your project's .rubocop.yml file. This will disable all cops by default, and you can then explicitly enable the ones you want by setting Enabled: true. See the RuboCop docs for 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
bundle exec rake test

The Cops

All cops are located under lib/rubocop/cop/github.