Skip to content

Commit

Permalink
Merge pull request #127 from github/set-previously-undeclared-cops-to…
Browse files Browse the repository at this point in the history
…-enabled-false

config/default: Upstream cop disables since this is the central place
  • Loading branch information
bensheldon authored Oct 28, 2022
2 parents e8e89e0 + d959ddd commit 6b630e3
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 39 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: bundler
directory: '/'
versioning-strategy: increase
schedule:
interval: weekly
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
inherit_from:
- ./config/default.yml
- ./config/rails.yml

Naming/FileName:
Enabled: true
Expand Down
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ If the Cop is **only applicable for GitHub**, then this is the right place to pr

## For Maintainers

### Updating Rubocop Dependencies

Rubocop regularly releases new versions with new cops. We want to keep up to date with the latest Rubocop releases, and keep these rules and styleguide in sync to reduce burden on consumers of this gem.

- Run `bundle update rubocop rubocop-performance rubocop-rails` to update the dependencies within this repository. Major updates will require updating the `.gemspec` file because of the pinned version constraints.
- Run `bundle exec rubocop`, and copy the output of newly introduced rules into `config/default_pending.yml` and `config/rails_pending.yml`. They should look like this:

```sh
Lint/DuplicateMagicComment: # new in 1.37
Enabled: true
Style/OperatorMethodCall: # new in 1.37
Enabled: true
Style/RedundantStringEscape: # new in 1.37
Enabled: true
```

- Run `bundle exec rubocop` again to ensure that it runs cleanly without any pending cops. Also run `bundle exec rake` to run the tests.
- Work through the pending cops, and copy them to `config/{default,rails}.yml` with an explicity `Enabled: true` or `Enabled: false` depending on your decision as to whether they should be part of our standard ruleset.

### Releasing a new version

1. Update `rubocop-github.gemspec` with the next version number
Expand Down
52 changes: 27 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ PATH
remote: .
specs:
rubocop-github (0.19.0)
rubocop (>= 1.0.0)
rubocop-performance
rubocop-rails
rubocop (>= 1.37)
rubocop-performance (>= 1.15)
rubocop-rails (>= 2.17)

GEM
remote: https://rubygems.org/
specs:
actionview (7.0.3)
activesupport (= 7.0.3)
actionview (7.0.4)
activesupport (= 7.0.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activesupport (7.0.3)
activesupport (7.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -24,53 +24,55 @@ GEM
builder (3.2.4)
concurrent-ruby (1.1.10)
crass (1.0.6)
erubi (1.10.0)
i18n (1.10.0)
erubi (1.11.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
loofah (2.18.0)
json (2.6.2)
loofah (2.19.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
minitest (5.16.1)
nokogiri (1.13.6-arm64-darwin)
minitest (5.16.3)
nokogiri (1.13.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.6-x86_64-darwin)
nokogiri (1.13.9-x86_64-darwin)
racc (~> 1.4)
parallel (1.22.1)
parser (3.1.2.0)
parser (3.1.2.1)
ast (~> 2.4.1)
racc (1.6.0)
rack (2.2.3.1)
rack (3.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.5.0)
regexp_parser (2.6.0)
rexml (3.2.5)
rubocop (1.31.0)
rubocop (1.37.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
rubocop-performance (1.14.2)
rubocop-performance (1.15.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.15.1)
rubocop-rails (2.17.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop (>= 1.33.0, < 2.0)
ruby-progressbar (1.11.0)
tzinfo (2.0.4)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unicode-display_width (2.2.0)
unicode-display_width (2.3.0)

PLATFORMS
arm64-darwin-21
Expand All @@ -84,4 +86,4 @@ DEPENDENCIES
rubocop-github!

BUNDLED WITH
2.2.33
2.3.24
21 changes: 21 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
inherit_from:
- ./default_pending.yml

require:
- rubocop-github
- rubocop-performance
Expand Down Expand Up @@ -446,6 +449,15 @@ Lint/EmptyConditionalBody:
Lint/EmptyEnsure:
Enabled: true

Lint/EmptyExpression:
Enabled: false

Lint/EmptyFile:
Enabled: false

Lint/EmptyWhen:
Enabled: false

Lint/EmptyInterpolation:
Enabled: true

Expand Down Expand Up @@ -599,6 +611,9 @@ Lint/RegexpAsCondition:
Lint/RequireParentheses:
Enabled: true

Lint/RequireRangeParentheses:
Enabled: false

Lint/RequireRelativeSelfPath:
Enabled: false

Expand Down Expand Up @@ -1120,6 +1135,9 @@ Style/EmptyCaseCondition:
Style/EmptyElse:
Enabled: false

Style/EmptyHeredoc:
Enabled: false

Style/EmptyLambdaParameter:
Enabled: false

Expand Down Expand Up @@ -1262,6 +1280,9 @@ Style/LambdaCall:
Style/LineEndConcatenation:
Enabled: false

Style/MagicCommentFormat:
Enabled: false

Style/MapCompactWithConditionalBlock:
Enabled: false

Expand Down
6 changes: 6 additions & 0 deletions config/default_pending.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Lint/DuplicateMagicComment: # new in 1.37
Enabled: false
Style/OperatorMethodCall: # new in 1.37
Enabled: false
Style/RedundantStringEscape: # new in 1.37
Enabled: false
3 changes: 3 additions & 0 deletions config/rails.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
inherit_from:
- ./rails_pending.yml

require:
- rubocop-github-rails
- rubocop-rails
Expand Down
9 changes: 0 additions & 9 deletions config/rails_cops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ GitHub/RailsControllerRenderShorthand:
Include:
- 'app/controllers/**/*.rb'

GitHub/RailsRenderInline:
Enabled: pending
StyleGuide: https://github.com/github/rubocop-github/blob/main/guides/rails-controller-render-inline.md
Include:
- 'app/controllers/**/*.rb'
- 'app/helpers/**/*.rb'
- 'app/view_models/**/*.rb'
- 'app/views/**/*.erb'

GitHub/RailsRenderObjectCollection:
Enabled: pending

Expand Down
20 changes: 20 additions & 0 deletions config/rails_pending.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Rails/ActionControllerFlashBeforeRender: # new in 2.16
Enabled: false
Rails/ActionOrder: # new in 2.17
Enabled: false
Rails/ActiveSupportOnLoad: # new in 2.16
Enabled: false
Rails/FreezeTime: # new in 2.16
Enabled: false
Rails/IgnoredColumnsAssignment: # new in 2.17
Enabled: false
Rails/RootPathnameMethods: # new in 2.16
Enabled: false
Rails/ToSWithArgument: # new in 2.16
Enabled: false
Rails/TopLevelHashWithIndifferentAccess: # new in 2.16
Enabled: false
Rails/WhereMissing: # new in 2.16
Enabled: false
Rails/WhereNotWithMultipleConditions: # new in 2.17
Enabled: false
2 changes: 0 additions & 2 deletions lib/rubocop-github-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

RuboCop::GitHub::Inject.rails_defaults!

require "rubocop/cop/github/rails_application_record"
require "rubocop/cop/github/rails_controller_render_action_symbol"
require "rubocop/cop/github/rails_controller_render_literal"
require "rubocop/cop/github/rails_controller_render_paths_exist"
require "rubocop/cop/github/rails_controller_render_shorthand"
require "rubocop/cop/github/rails_render_inline"
require "rubocop/cop/github/rails_render_object_collection"
require "rubocop/cop/github/rails_view_render_literal"
require "rubocop/cop/github/rails_view_render_paths_exist"
Expand Down
6 changes: 3 additions & 3 deletions rubocop-github.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Gem::Specification.new do |s|

s.files = Dir["README.md", "STYLEGUIDE.md", "LICENSE", "config/*.yml", "lib/**/*.rb", "guides/*.md"]

s.add_dependency "rubocop", ">= 1.0.0"
s.add_dependency "rubocop-performance"
s.add_dependency "rubocop-rails"
s.add_dependency "rubocop", ">= 1.37"
s.add_dependency "rubocop-performance", ">= 1.15"
s.add_dependency "rubocop-rails", ">= 2.17"

s.add_development_dependency "actionview"
s.add_development_dependency "minitest"
Expand Down

0 comments on commit 6b630e3

Please sign in to comment.