Skip to content

Commit

Permalink
Fix Cop deprecations and upgrade dependencies (#70)
Browse files Browse the repository at this point in the history
* All cops should inherit from `RuboCop::Cop::Base`
* All specs should use `expect_offense` instead of `inspect_source`
* Use latest version of all `rubocop-*` gems, except `rubocop-rspec`
which I've pinned to the latest version of the `2.x` series. There are
some larger changes that need to be addressed in another PR.
* Fixes a few RuboCop violations
  • Loading branch information
rzane authored Jan 28, 2025
1 parent 99537f8 commit 2e5d673
Show file tree
Hide file tree
Showing 35 changed files with 340 additions and 487 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['3.0', 3.1, 3.2]
ruby: ['3.0', '3.1', '3.2', '3.3']
gemfile:
- Gemfile

Expand Down
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ require:
AllCops:
NewCops: enable
TargetRubyVersion: 3.0

Rails:
Enabled: false
26 changes: 1 addition & 25 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 99999 --no-auto-gen-timestamp`
# using RuboCop version 1.56.0.
# using RuboCop version 1.71.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 13
InternalAffairs/InheritDeprecatedCopClass:
Exclude:
- 'lib/rubocop/cop/betterment/active_job_performable.rb'
- 'lib/rubocop/cop/betterment/allowlist_blocklist.rb'
- 'lib/rubocop/cop/betterment/authorization_in_controller.rb'
- 'lib/rubocop/cop/betterment/dynamic_params.rb'
- 'lib/rubocop/cop/betterment/implicit_redirect_type.rb'
- 'lib/rubocop/cop/betterment/memoization_with_arguments.rb'
- 'lib/rubocop/cop/betterment/non_standard_actions.rb'
- 'lib/rubocop/cop/betterment/server_error_assertion.rb'
- 'lib/rubocop/cop/betterment/site_prism_loaded.rb'
- 'lib/rubocop/cop/betterment/spec_helper_required_outside_spec_dir.rb'
- 'lib/rubocop/cop/betterment/timeout.rb'
- 'lib/rubocop/cop/betterment/unsafe_job.rb'
- 'lib/rubocop/cop/betterment/unscoped_find.rb'

# Offense count: 17
# This cop supports safe autocorrection (--autocorrect).
InternalAffairs/NodeMatcherDirective:
Expand All @@ -48,10 +31,3 @@ InternalAffairs/NumblockHandler:
Performance/MapMethodChain:
Exclude:
- 'lib/rubocop/cop/betterment/server_error_assertion.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/NegateInclude:
Exclude:
- 'lib/rubocop/cop/betterment/non_standard_actions.rb'
- 'lib/rubocop/cop/betterment/unscoped_find.rb'
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ source 'https://rubygems.org'

gemspec

# These pins are necessary for Ruby 3.0
gem 'activesupport', '~> 7.1.5'
gem 'nokogiri', '~> 1.17.2'
gem 'securerandom', '~> 0.3.2'
gem 'zeitwerk', '~> 2.6.18'

group :development do
gem 'pry'
gem 'bundler'
Expand Down
201 changes: 107 additions & 94 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,191 +1,200 @@
PATH
remote: .
specs:
betterlint (1.17.0)
rubocop (~> 1.62.0)
rubocop-graphql (~> 1.5.0)
rubocop-performance (~> 1.21.0)
rubocop-rails (~> 2.24.0)
rubocop-rake (~> 0.6.0)
rubocop-rspec (~> 2.28.0)
betterlint (1.18.0)
rubocop (~> 1.71)
rubocop-graphql (~> 1.5)
rubocop-performance (~> 1.23)
rubocop-rails (~> 2.29)
rubocop-rake (~> 0.6)
rubocop-rspec (~> 2.29)

GEM
remote: https://rubygems.org/
specs:
actionpack (7.1.4.1)
actionview (= 7.1.4.1)
activesupport (= 7.1.4.1)
actionpack (7.1.5.1)
actionview (= 7.1.5.1)
activesupport (= 7.1.5.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actionview (7.1.4.1)
activesupport (= 7.1.4.1)
actionview (7.1.5.1)
activesupport (= 7.1.5.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activesupport (7.1.4.1)
activesupport (7.1.5.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
securerandom (>= 0.3)
tzinfo (~> 2.0)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.8)
benchmark (0.4.0)
bigdecimal (3.1.9)
builder (3.3.0)
coderay (1.1.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
crass (1.0.6)
diff-lcs (1.5.0)
date (3.4.1)
diff-lcs (1.5.1)
drb (2.2.1)
erubi (1.13.0)
i18n (1.14.6)
erubi (1.13.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-console (0.7.1)
irb (1.11.0)
rdoc
reline (>= 0.3.8)
json (2.7.1)
language_server-protocol (3.17.0.3)
io-console (0.8.0)
irb (1.15.1)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.9.1)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
loofah (2.22.0)
logger (1.6.5)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
method_source (1.0.0)
minitest (5.25.1)
mutex_m (0.2.0)
nokogiri (1.16.7-arm64-darwin)
method_source (1.1.0)
minitest (5.25.4)
mutex_m (0.3.0)
nokogiri (1.17.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
nokogiri (1.17.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
nokogiri (1.17.2-x86_64-linux)
racc (~> 1.4)
parallel (1.24.0)
parser (3.3.0.5)
parallel (1.26.3)
parser (3.3.7.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.1.2)
psych (5.2.3)
date
stringio
racc (1.8.1)
rack (3.1.8)
rack-session (2.0.0)
rack-session (2.1.0)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack-test (2.2.0)
rack (>= 1.3)
rackup (2.1.0)
rackup (2.2.1)
rack (>= 3)
webrick (~> 1.8)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.4.1)
actionpack (= 7.1.4.1)
activesupport (= 7.1.4.1)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (7.1.5.1)
actionpack (= 7.1.5.1)
activesupport (= 7.1.5.1)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.1.0)
rdoc (6.6.3.1)
rake (13.2.1)
rdoc (6.11.0)
psych (>= 4.0.0)
regexp_parser (2.9.0)
reline (0.4.1)
regexp_parser (2.10.0)
reline (0.6.0)
io-console (~> 0.5)
rexml (3.3.6)
strscan
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.1.0)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.12)
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.62.1)
rspec-support (~> 3.13.0)
rspec-rails (7.1.0)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.2)
rubocop (1.71.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.19.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-graphql (1.5.1)
rubocop (>= 0.90, < 2)
rubocop-performance (1.21.0)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-graphql (1.5.4)
rubocop (>= 1.50, < 2)
rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.24.1)
rubocop-rails (2.29.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.28.0)
rubocop-rspec (2.31.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.2)
rubocop (~> 1.40)
rubocop-rspec_rails (2.29.1)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
standard (1.35.1)
securerandom (0.3.2)
standard (1.35.0.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.62.0)
rubocop (~> 1.62)
standard-custom (~> 1.0.0)
standard-performance (~> 1.3)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.4.0)
standard-performance (1.6.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
stringio (3.1.0)
strscan (3.1.0)
thor (1.3.0)
rubocop-performance (~> 1.23.0)
stringio (3.1.2)
thor (1.3.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
webrick (1.8.2)
zeitwerk (2.6.12)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
zeitwerk (2.6.18)

PLATFORMS
arm64-darwin-22
Expand All @@ -194,12 +203,16 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
activesupport (~> 7.1.5)
betterlint!
bundler
nokogiri (~> 1.17.2)
pry
rake (>= 12.3.3)
rspec-rails
securerandom (~> 0.3.2)
standard
zeitwerk (~> 2.6.18)

BUNDLED WITH
2.4.22
Loading

0 comments on commit 2e5d673

Please sign in to comment.