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 breaks code when "fixing" attr :name, true #2483

Closed
radiospiel opened this issue Dec 8, 2015 · 8 comments
Closed

rubocop breaks code when "fixing" attr :name, true #2483

radiospiel opened this issue Dec 8, 2015 · 8 comments
Labels

Comments

@radiospiel
Copy link

Rubocop replaces

attr :name, true

with

attr_reader :name, true

which is plain wrong. If it would replace that line at all, it should use

attr_writer :name

instead.

@jonas054
Copy link
Collaborator

There's not much documentation, but it looks like
attr :name, true is equivalent to attr_accessor :name
and
attr :name, false and attr :name are equivalent to attr_reader :name.
So we do have a bug here.

@jonas054 jonas054 added the bug label Dec 10, 2015
@bbatsov
Copy link
Collaborator

bbatsov commented Dec 10, 2015

Indeed. I had not idea about this behaviour. We should fix this.

@alexdowad
Copy link
Contributor

I see that @weh has created an updated spec... but no code to actually make the spec pass. The two should go together.

@alexdowad
Copy link
Contributor

@weh, would you like to write the code to fix this one?

@weh
Copy link
Contributor

weh commented Dec 10, 2015

yes, i was searching for a 24pullrequests issue to fix.

@weh
Copy link
Contributor

weh commented Dec 15, 2015

sorry for the mess with the issue references. lesson learned :)

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 15, 2015

Noticed one more issue in the code. And regarding the commit message - it should not end with . (titles don't have dots in them).

@alexdowad
Copy link
Contributor

@bbatsov, I like your thorough code reviews!

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

No branches or pull requests

5 participants