Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve autocorrect deprecations #378

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/erb_lint/corrector.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

require "rubocop/cop/legacy/corrector"

module ERBLint
class Corrector
attr_reader :processed_source, :offenses, :corrected_content

def initialize(processed_source, offenses)
@processed_source = processed_source
@offenses = offenses
corrector = RuboCop::Cop::Corrector.new(@processed_source.source_buffer)
correct!(corrector)
@corrected_content = corrector.rewrite
end

Expand All @@ -18,8 +18,10 @@ def corrections
end.compact
end

def corrector
::RuboCop::Cop::Legacy::Corrector.new(@processed_source.source_buffer, corrections)
def correct!(corrector)
corrections.each do |correction|
correction.call(corrector)
end
end
end
end
Loading