Skip to content

Commit

Permalink
remove newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
mfittko committed Nov 4, 2024
1 parent 0ff2020 commit 849d8bb
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions rdjson_formatter/rdjson_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,11 @@ def build_suggestions(offense)
return [] unless offense.correctable? && offense.corrector

source_buffer = offense.location.source_buffer

corrections = offense.corrector.as_replacements
return [] if corrections.empty?

min_begin_pos = corrections.map { |range, _| range.begin_pos }.min
max_end_pos = corrections.map { |range, _| range.end_pos }.max

merged_range = Parser::Source::Range.new(source_buffer, min_begin_pos, max_end_pos)

corrected_text = ''
Expand All @@ -111,9 +109,7 @@ def build_suggestions(offense)
next if range.end_pos <= min_begin_pos || range.begin_pos >= max_end_pos

corrected_text += source_buffer.source[current_pos...range.begin_pos] if current_pos < range.begin_pos

corrected_text += replacement_text

current_pos = range.end_pos
end

Expand Down

0 comments on commit 849d8bb

Please sign in to comment.