Skip to content

Commit

Permalink
Fix Rubocop deprecated method warnings
Browse files Browse the repository at this point in the history
* `Cop.all` is deprecated. Use `Registry.all` instead.
* `inspect_file` is deprecated. Use `investigate` instead.
  • Loading branch information
ramil350 committed Aug 14, 2024
1 parent 5fcb08d commit 44bdd26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/pronto/rubocop/patch_cop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def processed_source
end

def registry
@registry ||= ::RuboCop::Cop::Registry.new(RuboCop::Cop::Cop.all)
@registry ||= ::RuboCop::Cop::Registry.new(RuboCop::Cop::Registry.all)
end

def rubocop_config
Expand Down Expand Up @@ -59,7 +59,8 @@ def path

def offenses
team
.inspect_file(processed_source)
.investigate(processed_source)
.offenses
.sort
.reject(&:disabled?)
end
Expand Down
3 changes: 2 additions & 1 deletion spec/pronto/rubocop/patch_cop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
let(:runner) { double :runner }
let(:ast) { double :ast, each_node: nil }
let(:processed_source) { double :processed_source, ast: ast }
let(:team) { double :team, inspect_file: [offense] }
let(:team) { double :team, investigate: offenses }
let(:offenses) { double :offenses, offenses: [offense] }
let(:offense_location) { double :location, first_line: 42, last_line: 43 }
let(:offense) { double :offense, disabled?: false, location: offense_location }
let(:offense_line) { double :offense_line, message: 'Err' }
Expand Down

0 comments on commit 44bdd26

Please sign in to comment.