Skip to content

Commit

Permalink
Switch from deprecated Cop.all API to Rubocop v1 Registry.all
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfb committed Jul 12, 2024
1 parent f82b3f7 commit 9d15146
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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
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 9d15146

Please sign in to comment.