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

Layout/FirstHashElementLineBreak not applying to single element hash #9312

Closed
muirdm opened this issue Dec 30, 2020 · 0 comments · Fixed by #9313
Closed

Layout/FirstHashElementLineBreak not applying to single element hash #9312

muirdm opened this issue Dec 30, 2020 · 0 comments · Fixed by #9313

Comments

@muirdm
Copy link

muirdm commented Dec 30, 2020

FirstHashElementLineBreak doesn't apply to the below case:

{:foo => {
  :bar => "baz",
}}

I want it to produce:

{
  :foo => {
    :bar => "baz",
  },
}

FirstHashElementLineBreak skips the outer hash because it only has a single element. I think the outer hash still counts as "multi-line" even though it only has one element.

muirdm pushed a commit to retailnext/rubocop that referenced this issue Dec 30, 2020
…line hash

Fix Layout/FirstHashElementLineBreak to consider below as a multi-line
hash even though it only has one element:

    {:foo => {
      :bar => "baz",
    }}

Now FirstHashElementLineBreak will correct the above to:

    {
      :foo => {
        :bar => "baz",
      },
    }

Fixes rubocop#9312.
bbatsov pushed a commit that referenced this issue Jan 4, 2021
Fix Layout/FirstHashElementLineBreak to consider below as a multi-line
hash even though it only has one element:

    {:foo => {
      :bar => "baz",
    }}

Now FirstHashElementLineBreak will correct the above to:

    {
      :foo => {
        :bar => "baz",
      },
    }

Fixes #9312.
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

Successfully merging a pull request may close this issue.

1 participant