Skip to content

Commit

Permalink
fix crash with RuboCop >= 1.41.0 when there are no corrections
Browse files Browse the repository at this point in the history
rubocop/rubocop#11264 did optimisations
to not set RuboCop::Cop::Base::InvestigationReport#corrector
when there are no corrections.
  • Loading branch information
ashkulz committed Jan 20, 2023
1 parent 6e1703c commit a9346f1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/pronto/rubocop/offense_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def message_text
def suggestion_text
return unless patch_cop.runner.pronto_rubocop_config['suggestions']
return if corrections_count.zero?
return if corrector.nil? # possible after optimisation in https://github.com/rubocop/rubocop/pull/11264
return if differing_lines_count != corrections_count

@suggestion_text ||= corrected_lines[offense.line - 1]
Expand Down

0 comments on commit a9346f1

Please sign in to comment.