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

Conflict between Layout/EmptyLinesAroundAccessModifier and Layout/EmptyLinesAroundClassBody #8524

Closed
natematykiewicz opened this issue Aug 11, 2020 · 0 comments · Fixed by #8551
Labels

Comments

@natematykiewicz
Copy link

natematykiewicz commented Aug 11, 2020

Layout/EmptyLinesAroundClassBody:
  EnforcedStyle: empty_lines_special
Layout/EmptyLinesAroundAccessModifier:
  EnforcedStyle: only_before
class Foo

private
  def bar
  end

end

Expected behavior

This code is valid.

Actual behavior

This code is impossible to validate because one of the following two offenses is triggered.

Layout/EmptyLinesAroundClassBody: Empty line missing before first def definition

Layout/EmptyLinesAroundAccessModifier: Remove a blank line after private.

My belief is that the code as-is should be valid and satisfy both rules. But I also believe that Layout/EmptyLinesAroundClassBody shouldn't be relevant if the first method is after an access modifier (the new line above private satisfies this rule, in my opinion).

RuboCop 0.89.1

Attempting to autocorrect this code sends the autocorrecter into an infinite loop.

@koic koic added the bug label Aug 11, 2020
dmytro-savochkin pushed a commit to dmytro-savochkin/rubocop that referenced this issue Aug 17, 2020
…/EmptyLinesAroundModuleBody` to handle access modifier
koic added a commit that referenced this issue Aug 17, 2020
[Fix #8524] Fix `Layout/EmptyLinesAroundClassBody` and `Layout/EmptyLinesAroundModuleBody` to handle access modifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants