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

Fix a bug in Layout/ClosingParenthesisIndentation #6712

Merged

Conversation

bquorning
Copy link
Contributor

@bquorning bquorning commented Jan 27, 2019

ClosingParenthesisIndentation would complain about

block_adds_extra_indentation do
  some_method(a,
    x: 1,
    y: 2
  )
end

saying it should be indented as:

block_adds_extra_indentation do
  some_method(a,
    x: 1,
    y: 2
)
end

This issue appeared after the bugfix commit 1653112 in #6351.

  • I did not add an entry to the Changelog because the issue I’m fixing hasn’t been released yet.
  • The first commit in the PR is somewhat unrelated (moving one spec example to another section of the spec file), but I found it too small a change for a separate PR.

/cc @antonzaytsev


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@bquorning bquorning requested a review from Drenmi January 27, 2019 19:58
@bquorning bquorning force-pushed the closing-parenthesis-indentation-bugfix branch from 7ba7ff4 to ece8f68 Compare January 27, 2019 20:03
Copy link
Collaborator

@Drenmi Drenmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, and thank you! 🙇

source_indent = processed_source
.line_indentation(first_argument_line(elements))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did I add a blank line here? I’ll remove it as push again.

ClosingParenthesisIndentation would complain about

    block_adds_extra_indentation do
      some_method(a,
        x: 1,
        y: 2
      )
    end

saying it should be indented as:

    block_adds_extra_indentation do
      some_method(a,
        x: 1,
        y: 2
    )
    end

This issue appeared after the bugfix commit 1653112.
@bquorning bquorning force-pushed the closing-parenthesis-indentation-bugfix branch from ece8f68 to 85ba07b Compare January 28, 2019 08:58
@antonzaytsev
Copy link
Contributor

@bquorning thank you for fix and new test case to prevent such issue 👍

@bquorning bquorning merged commit b6cf0dd into rubocop:master Jan 28, 2019
@bquorning bquorning deleted the closing-parenthesis-indentation-bugfix branch January 28, 2019 09:15
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 this pull request may close these issues.

None yet

3 participants