Skip to content

Commit ec06bcb

Browse files
committed
Don't mess with heredoc indentation.
1 parent 698d59d commit ec06bcb

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/rubocop/socketry/layout/consistent_blank_line_indentation.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,9 @@ def walk_ast_for_indentation(node, deltas)
114114
when :dstr
115115
if location = node.location
116116
if location.is_a?(Parser::Source::Map::Heredoc) and body = location.heredoc_body
117-
if location.expression.source.start_with?("<<~")
118-
# Squiggly heredoc - indentation is significant, add deltas
119-
deltas[body.line] += 1
120-
deltas[body.last_line] -= 1
121-
else
122-
# Non-squiggly heredoc - ignore indentation on these lines
123-
(body.line..body.last_line).each do |line|
124-
deltas[line] = nil
125-
end
117+
# Don't touch the indentation of heredoc bodies:
118+
(body.line..body.last_line).each do |line|
119+
deltas[line] = nil
126120
end
127121
end
128122
end

test/rubocop/socketry/layout/consistent_blank_line_indentation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@
396396
investigator = RuboCop::Cop::Commissioner.new([cop], [], raise_error: true)
397397
report = investigator.investigate(processed_source)
398398
offenses = report.offenses
399-
expect(offenses).not.to be(:empty?)
399+
expect(offenses).to be(:empty?)
400400
end
401401
end
402402

0 commit comments

Comments
 (0)