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 Layout/EmptyLineBetweenDefs error with endless methods #9277

Merged
merged 1 commit into from
Dec 24, 2020

Conversation

dvandersluis
Copy link
Member

@dvandersluis dvandersluis commented Dec 22, 2020

Previously, Layout/EmptyLineBetweenDefs would error when encountering an endless method because node.loc.end is nil when endless. Now the end position for an endless method can be calculated. If AllowAdjacentOneLineDefs is true, endless methods are treated like single-line methods.


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 changed the title Add support for endless methods to Layout/EmptyLineBetweenDefs. Fix Layout/EmptyLineBetweenDefs error with endless methods Dec 23, 2020
Previously, `Layout/EmptyLineBetweenDefs` would error when encountering an endless method because `node.loc.end` is nil when endless. Now the end position for an endless method can be calculated. If `AllowAdjacentOneLineDefs` is `true`, endless methods are treated like single-line methods.
@dvandersluis
Copy link
Member Author

@bbatsov it’d be good to merge this before the “ruby 3” release cause this is an actual error raised by rubocop when endless methods are encountered.

@bbatsov bbatsov merged commit e9d5633 into rubocop:master Dec 24, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Dec 24, 2020

Done!

@dvandersluis dvandersluis deleted the fix/empty-line-between-defs branch January 18, 2021 20:43
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