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

Rails/Delegate autocorrect deletes comments #1164

Open
maxnotarangelo opened this issue Oct 20, 2023 · 0 comments
Open

Rails/Delegate autocorrect deletes comments #1164

maxnotarangelo opened this issue Oct 20, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@maxnotarangelo
Copy link

When the Rails/Delegate cop autocorrects, it deletes comments inside the delegator method.

Original code

def bar
  # foo has the bar we want
  foo.bar
end

Expected autocorrected code

# foo has the bar we want
delegate :bar, to: :foo

Actual autocorrected code

delegate :bar, to: :foo

RuboCop version

$ bundle exec rubocop -V
1.57.1 (using Parser 3.2.2.4, rubocop-ast 1.29.0, running on ruby 3.2.2) [arm64-darwin22]
  - rubocop-performance 1.19.1
  - rubocop-rails 2.21.2
  - rubocop-rspec 2.24.1
@koic koic added the bug Something isn't working label Oct 21, 2023
masato-bkn pushed a commit to masato-bkn/rubocop-rails that referenced this issue Nov 18, 2023
This PR fixes bug where comments were removed during auto-correction in `Rails/Delegate`.
masato-bkn pushed a commit to masato-bkn/rubocop-rails that referenced this issue Nov 18, 2023
This PR fixes bug where comments were removed during auto-correction in `Rails/Delegate`.
masato-bkn pushed a commit to masato-bkn/rubocop-rails that referenced this issue Nov 18, 2023
masato-bkn pushed a commit to masato-bkn/rubocop-rails that referenced this issue Nov 18, 2023
masato-bkn pushed a commit to masato-bkn/rubocop-rails that referenced this issue Nov 18, 2023
masato-bkn pushed a commit to masato-bkn/rubocop-rails that referenced this issue Nov 18, 2023
masato-bkn pushed a commit to masato-bkn/rubocop-rails that referenced this issue Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants