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/ActionOrder leaves comments behind in autocorrecting #837

Closed
jkr2255 opened this issue Oct 26, 2022 · 1 comment · Fixed by #857
Closed

Rails/ActionOrder leaves comments behind in autocorrecting #837

jkr2255 opened this issue Oct 26, 2022 · 1 comment · Fixed by #857
Labels
bug Something isn't working

Comments

@jkr2255
Copy link

jkr2255 commented Oct 26, 2022

Using autocorrect for Rails/ActionOrder leaves comments behind, and making misplaced comments.

It seems comments just before methods (with no empty line) should move with following methods.


Expected behavior

# frozen_string_literal: true

class TestController < BaseController
  def index
  end

  # comment for edit
  def edit
  end
end

Actual behavior

# frozen_string_literal: true

class TestController < BaseController
  # comment for edit
  def index
  end

  def edit
  end
end

Steps to reproduce the problem

rubocop -a for following file

# frozen_string_literal: true

class TestController < BaseController
  # comment for edit
  def edit
  end

  def index
  end
end

RuboCop version

$ [bundle exec] rubocop -V
1.37.1 (using Parser 3.1.2.1, rubocop-ast 1.23.0, running on ruby 2.7.6) [x86_64-linux]
  - rubocop-rails 2.17.1
@koic koic added the bug Something isn't working label Oct 26, 2022
@dmarcoux
Copy link

I can also reproduce this.

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

Successfully merging a pull request may close this issue.

3 participants