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

Update Style/SingleLineMethods to correct to an endless method definition if they are allowed #9295

Merged
merged 1 commit into from
Jan 7, 2021

Conversation

dvandersluis
Copy link
Member

Follows #9281.

If Style/EndlessMethod is enabled and not using the disallow style, single line methods will be corrected to endless methods instead. My rationale here is that if the user is allowing endless methods, they are a "smaller" correction for single line methods than replacing with a normal method definition.

I went back and forth about if this should be configured independently from the Style/EndlessMethod configuration. I think it makes sense to keep all the configuration for endless methods in one place, but if we'd rather have it specifically configured for Style/SingleLineMethods, I'd be happy to make that change.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • 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.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@dvandersluis dvandersluis force-pushed the single-line-endless branch 2 times, most recently from 043482c to 12818d3 Compare December 28, 2020 01:06
@dvandersluis
Copy link
Member Author

Once #9281 is merged I'll rebase its commit out of this PR, but it's needed to make the tests pass.

@bbatsov
Copy link
Collaborator

bbatsov commented Jan 6, 2021

@dvandersluis Please, take a moment to rebase this PR when you can.

@dvandersluis
Copy link
Member Author

@bbatsov definitely, done!

@bbatsov bbatsov merged commit 9eb5daf into rubocop:master Jan 7, 2021
@bbatsov
Copy link
Collaborator

bbatsov commented Jan 7, 2021

Thanks!

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

2 participants