Skip to content

Transform between braces & do/end when reflowing blocks? #120

Closed
@xeger

Description

@xeger

I was rather surprised to see Syntax Tree make the following choice:

          expect(
            resulting_items.map { |i|
              { amount: i.amount }
            },
          ).to match(
            existing_model.fund.ownership_positions.current.map { |i|
              { amount: Float(i.id) }
            },
          )

It was preserving my choice of {} but when it reflowed the block to multiple lines, our convention normally would have been to switch to a do/end pair (and vice-versa).

As a workaround, I can Rubocop to auto-fix after formatting; it's a minor pain however. Is this a behavior that would be amenable to a Syntax Tree plugin? If so, perhaps I can work on contributing one to the core.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions