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

Rubocop disable AccessModifierDeclarations? #370

Closed
Fryguy opened this issue Aug 16, 2019 · 7 comments · Fixed by #431
Closed

Rubocop disable AccessModifierDeclarations? #370

Fryguy opened this issue Aug 16, 2019 · 7 comments · Fixed by #431
Assignees
Labels

Comments

@Fryguy
Copy link
Member

Fryguy commented Aug 16, 2019

See https://rubydoc.info/gems/rubocop/0.69.0/RuboCop/Cop/Style/AccessModifierDeclarations

tl;dr

# group (default)
class Foo
  def method0
  end

  private

  def method1
  end

  def method2
  end
end

# inline
class Foo
  def method0
  end

  private def method1
  end

  private def method2
  end
end

I would like to disable this cop. I like inline modifiers, but this new cop is enforcing the group style. I don't think we have a preference collectively, so I'd like to disable it and allow for inline in addition to group.

Please vote with what you think.

👍 - allow developers to do both group and inline (disable the cop)
👎 - only support group, do not allow inline (leave it as is)
🚀 - only support inline, do not allow group (opposite than currently)

@Fryguy Fryguy added the vote label Aug 16, 2019
@NickLaMuro
Copy link
Member

NickLaMuro commented Aug 16, 2019

@Fryguy This will make it more complicated, but this is also an option for individual declaration that I prefer over inline declaration:

class Foo
  def method0
  end
  private :method0
end

Not sure if this is something that is affected by this rule.

@Fryguy
Copy link
Member Author

Fryguy commented Aug 16, 2019

That style is part of group

@NickLaMuro
Copy link
Member

That style is part of group

Oh, then in that case, I guess I am going to be "that guy"... sorry

¯\_(ツ)_/¯

@Fryguy
Copy link
Member Author

Fryguy commented Aug 16, 2019

Oh I'm sorry...I'm completely wrong...that is part of inline

class Blah
  def foo

  end
  private :foo
end
blah.rb:5:3: C: Style/AccessModifierDeclarations: private should not be inlined in method definitions.
  private :foo
  ^^^^^^^

@NickLaMuro
Copy link
Member

NickLaMuro commented Aug 16, 2019

Geez... now you make me look bad... thanks.... so offended...

And now I look like I am just one of the 🐑 ...

@ghost
Copy link

ghost commented Aug 30, 2019

And finally, what's the decision ?

@Fryguy
Copy link
Member Author

Fryguy commented Sep 13, 2019

Looks like disable is the choice...I'll send up a PR for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants