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
Style/AccessModifierDeclarations reporting private attr_readers #6004
Comments
I guess attr_reader :greeting
private :greeting See also #5953 (duplicate?) |
@wata727 @brandonweiss I understand the idea but it would mean a lot more code to write like
That seems a bit cumbersome. |
@simonc I think that’s really the point of it. Using a “mixed” style gets extremely fiddly. I’m not necessarily concerned about the complexity of the logic to do the check, I’d be more concerned about the ability for people to understand when/how to follow the rule. I think if someone wants a mixed style they basically just want to disable the cop entirely. |
I don't entirely agree. Yes you're adding Anyway, I guess you're right, I'll just disable the cop and move on ^^ Thanks |
Hi,
I'm facing an issue with
Style/AccessModifierDeclarations
when choosing theinline
mode while declaring private accessors in a class. I understand it is a tricky situation but I had to disable the cop since it was reporting false positives.Expected behavior
This is the style we use is something like this since
attr_…
returnsnil
:(I know this code makes no sense, it's just for the sake of the example)
Here is our .rubocop.yml
I would expect not to get any offense reported since there is not
def
involved after theprivate
call.Actual behavior
Rubocop reports this offense as follows
Steps to reproduce the problem
Run rubocop with the above config on a file containing the above code.
RuboCop version
The text was updated successfully, but these errors were encountered: