Skip to content

Unexpected Indentation #96

Description

@veracosta

I've found some unexpected indentations such as following examples.

Example 1

Before

foo = "bar"
if /^.*(foo)/.match("foo")
case foo
when /1/
puts "foo"
when /2/
puts "bar"
end
end

After

foo = "bar"
if /^.*(foo)/.match("foo")
case foo # Not indented.
when /1/
  puts "foo"
  when /2/  # Not unindented.
  puts "bar"  # Not indented.
end
end

Example 2

Before

foo = "bar"
if /^.*(foo)/.match("foo")
case foo
when 1
puts "foo"
when 2
puts "bar"
end
end

In this case, no indent will be executed.

Example 3

Meanwhile, it will be indented correctly if the codes are as following.

Before

foo = "bar"
if /^.*(foo)bar/.match("foo") # Added a string after parentheses
case foo
when 1
puts "foo"
when 2
puts "bar"
end
end

After

foo = "bar"
if /^.*(foo)bar/.match("foo")
  case foo
  when 1
    puts "foo"
  when 2
    puts "bar"
  end
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions