Skip to content

Commit

Permalink
Remove deprecated Cop.all usage (Shopify#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebarrie committed Jul 30, 2024
2 parents f82b3f7 + 38e1129 commit 0d39442
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 20 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [2.7, 3.0, 3.1, 3.2, 3.3, head]
gemfile: [rubocop-next, rubocop-old]
ruby: [3.1, 3.2, 3.3, head]
runs-on: ubuntu-latest
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: gemfiles/Gemfile.${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PATH
better_html (>= 2.0.1)
parser (>= 2.7.1.4)
rainbow
rubocop
rubocop (>= 1)
smart_properties

GEM
Expand Down Expand Up @@ -123,4 +123,4 @@ DEPENDENCIES
rubocop-shopify

BUNDLED WITH
2.3.16
2.4.20
2 changes: 1 addition & 1 deletion erb_lint.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |s|
s.add_dependency("better_html", ">= 2.0.1")
s.add_dependency("parser", ">= 2.7.1.4")
s.add_dependency("rainbow")
s.add_dependency("rubocop")
s.add_dependency("rubocop", ">= 1")
s.add_dependency("smart_properties")

s.add_development_dependency("rspec")
Expand Down
5 changes: 0 additions & 5 deletions gemfiles/Gemfile.rubocop-next

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/Gemfile.rubocop-old

This file was deleted.

4 changes: 2 additions & 2 deletions lib/erb_lint/linters/rubocop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ def rubocop_processed_source(content, filename)

def cop_classes
if @only_cops.present?
selected_cops = ::RuboCop::Cop::Cop.all.select { |cop| cop.match?(@only_cops) }
selected_cops = ::RuboCop::Cop::Registry.all.select { |cop| cop.match?(@only_cops) }
::RuboCop::Cop::Registry.new(selected_cops)
else
::RuboCop::Cop::Registry.new(::RuboCop::Cop::Cop.all)
::RuboCop::Cop::Registry.new(::RuboCop::Cop::Registry.all)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/erb_lint/linters/rubocop_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def descendant_nodes(parser)
end

def cop_classes
selected_cops = ::RuboCop::Cop::Cop.all.select { |cop| cop.match?(@only_cops) }
selected_cops = ::RuboCop::Cop::Registry.all.select { |cop| cop.match?(@only_cops) }

::RuboCop::Cop::Registry.new(selected_cops)
end
Expand Down

0 comments on commit 0d39442

Please sign in to comment.