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 #8617] Style/HashAsLastArrayItem no longer flags hashes if all elements in an array are hashes #8635

Merged
merged 1 commit into from Sep 7, 2020

Conversation

dvandersluis
Copy link
Member

Fixes #8617.

Style/HashAsLastArrayItem currently changes arrays of hashes so that the final hash has no braces (if EnforcedStyle: no_braces is set). This PR changes that behaviour so that an array of all hashes is ignored.


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.

CHANGELOG.md Show resolved Hide resolved
@bbatsov
Copy link
Collaborator

bbatsov commented Sep 3, 2020

I think it's also a good idea to mention explicitly in the cop description that it will ignore such arrays.

@dvandersluis
Copy link
Member Author

@bbatsov made the requested changes! Please let me know if you want me to reword anything.

@bbatsov
Copy link
Collaborator

bbatsov commented Sep 4, 2020

The changes look good, but your branch has to be rebased on top of the current master branch due to merge conflicts.

@dvandersluis
Copy link
Member Author

@bbatsov rebased and updated the note!

Copy link
Collaborator

@bbatsov bbatsov left a comment

Choose a reason for hiding this comment

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

Looks good!

@bbatsov bbatsov merged commit 79ee786 into rubocop:master Sep 7, 2020
@dvandersluis dvandersluis deleted the hash-as-last-array-item-all branch January 18, 2021 20:34
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.

Style/HashAsLastArrayItem for array of hashes
2 participants