Skip to content

Commit

Permalink
Fix Cop/LayoutPosition autocorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeo authored and bbatsov committed Oct 8, 2020
1 parent f123d7c commit 0efca36
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/rubocop/cop/layout/dot_position.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ class DotPosition < Base
def on_send(node)
return unless node.dot? || ampersand_dot?(node)

if proper_dot_position?(node)
correct_style_detected
else
return unless opposite_style_detected
return correct_style_detected if proper_dot_position?(node)

dot = node.loc.dot
message = message(dot)
opposite_style_detected
dot = node.loc.dot
message = message(dot)

add_offense(dot, message: message) do |corrector|
autocorrect(corrector, dot, node)
end
add_offense(dot, message: message) do |corrector|
autocorrect(corrector, dot, node)
end
end
alias on_csend on_send
Expand Down

0 comments on commit 0efca36

Please sign in to comment.