Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected formatting of block using curly-brace notation #461

Open
damolina-stripe opened this issue Feb 6, 2024 · 0 comments
Open

Unexpected formatting of block using curly-brace notation #461

damolina-stripe opened this issue Feb 6, 2024 · 0 comments

Comments

@damolina-stripe
Copy link

damolina-stripe commented Feb 6, 2024

  • Ruby version: 3.1
  • Rubyfmt git sha: (if unsure, redownload the latest version and run against that) Stripe's

Input file

    def foo(e)
      e.to_s.each_line(chomp: true) { 
        |l| X }
    end

In my repro, X was a long namespaced-method call so I was looking to learn whether rubyfmt would recommend to keep as a single line or else.

Rubyfmt's output

    def foo(e)
      e.to_s.each_line(chomp: true) { |
          l
        | X }
    end

This breaks because

Unexpected formatting, breaking variable declaration across multiple lines seems wrong

  1. Not to break the declaration of |l|
  2. Probably, leave as is, make a single line, or ?
    def foo(e)
      e.to_s.each_line(chomp: true) {  |l| X }
    end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant