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 #8406] Improve Style/AccessorGrouping's auto-correction #8410

Merged

Conversation

koic
Copy link
Member

@koic koic commented Jul 28, 2020

Summary

Fixes #8406.

This PR improves Style/AccessorGrouping's auto-correction to remove redundant blank lines.

Other Information

This PR doesn't update to Cop::Base to make it clear the difference between the changes. Will be updated with other Style cops in different PR.


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.

## Summary

Fixes rubocop#8406.

This PR improves `Style/AccessorGrouping`'s auto-correction to remove
redundant blank lines.

## Other Information

This PR doesn't update to `Cop::Base` to make it clear the difference
between the changes. Will be updated with other `Style` cops in different PR.
@marcandre
Copy link
Contributor

marcandre commented Jul 28, 2020

Nice. I'm curious though: what happens to any comment that would be in those lines?

@koic
Copy link
Member Author

koic commented Jul 29, 2020

If an accessor is with a comment, it will not be grouped. So it will be no problem :-)
https://github.com/rubocop-hq/rubocop/blob/v0.88.0/spec/rubocop/cop/style/accessor_grouping_spec.rb#L127

@marcandre
Copy link
Contributor

If an accessor is with a comment, it will not be grouped. So it will be no problem :-)
https://github.com/rubocop-hq/rubocop/blob/v0.88.0/spec/rubocop/cop/style/accessor_grouping_spec.rb#L127

Ah, great, perfect.

I think this will be another cop that will get simplified if converted to Cop::Base

@koic
Copy link
Member Author

koic commented Jul 29, 2020

Yeah, completely agree. On the other hand, this PR focuses on bug fixes, so I'd like to convert it to Cop::Base in another PR (Maybe update with some other cops of Style department).

@marcandre
Copy link
Contributor

Yeah, completely agree. On the other hand, this PR focuses on bug fixes, so I'd like to convert it to Cop::Base in another PR (Maybe update with some other cops of Style department).

Yes, that's what I figured 👍

@koic koic merged commit 242701f into rubocop:master Jul 29, 2020
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/AccessorGrouping autocorrect leaves behind empty lines
2 participants