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

Catch-22 with class containing nothing but protected or private methods #600

Closed
lee-dohm opened this issue Nov 3, 2013 · 1 comment
Closed
Assignees

Comments

@lee-dohm
Copy link

lee-dohm commented Nov 3, 2013

I have a subclass in my current Rails project that looks approximately like so:

# Test class.
class Foo
  private

  def bar
    puts 'bar'
  end
end

For which I now (on master: 7b8e9ab ) get the warning:

C: Keep a blank line before and after private.

But if I do as it says and add the blank line before private, I get the following message:

C: Extra blank line detected at body beginning.

I think the EmptyLinesAroundAccessModifier cop should be relaxed by not requiring a blank line before the access modifier if it is the first semantic element in the class body.

@bbatsov
Copy link
Collaborator

bbatsov commented Nov 3, 2013

Yeah, that's a bug in the check for empty lines around access modifiers. I knew this would be problematic, but it took some time before some complained about it. :-) I'll have that fixed.

@ghost ghost assigned bbatsov Nov 3, 2013
@bbatsov bbatsov closed this as completed in a9c6d57 Nov 4, 2013
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

No branches or pull requests

2 participants