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

Style/BisectedAttrAccessor AutoCorrect fails when multiple variables are defined #9622

Closed
jondavid-schober-sp opened this issue Mar 19, 2021 · 0 comments · Fixed by #9634
Closed
Assignees
Labels

Comments

@jondavid-schober-sp
Copy link

When using the Style/BisectedAttrAccessor Auto Correct function when multiple variables are defined, it only corrects the first variable, and deletes the other variables


Expected behavior

  # Bad
   attr_writer :name, :limit, :size
   attr_reader :name, :limit, :size
 
 # Good
   attr_accessor :name, :limit, :size

Actual behavior

  # Bad
   attr_writer :name, :limit, :size
   attr_reader :name, :limit, :size
 
  # Good
   attr_accessor :name

Notice the lack of :limit and :size

Steps to reproduce the problem

Run rubocop against the #Bad code

RuboCop version

1.9.1 (using Parser 3.0.0.0, rubocop-ast 1.4.1, running on ruby 2.7.2 x86_64-darwin19)
  - rubocop-rails 2.9.1
  - rubocop-rspec 2.2.0
@koic koic added the bug label Mar 19, 2021
@dvandersluis dvandersluis self-assigned this Mar 22, 2021
dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Mar 24, 2021
…to handle multiple bisected attrs in the same macro.
bbatsov pushed a commit that referenced this issue Mar 24, 2021
…le multiple bisected attrs in the same macro.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants