-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Incorrect autocorrect for Rails/FindBy
cop
#1234
Comments
ymap
added a commit
to ymap/rubocop-rails
that referenced
this issue
Feb 1, 2024
Fixes rubocop#1234. This PR fixes an incorrect autocorrect for `Rails/FindBy` when using multi-line leading dot method calls.
9 tasks
ymap
added a commit
to ymap/rubocop-rails
that referenced
this issue
Feb 1, 2024
Fixes rubocop#1234. This PR fixes an incorrect autocorrect for `Rails/FindBy` when using multi-line leading dot method calls.
koic
added a commit
that referenced
this issue
Feb 1, 2024
…ails_find_by [Fix #1234] Fix an incorrect autocorrect for `Rails/FindBy`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've noticed an issue with the
Rails/FindBy
cop where it incorrectly leaves a redundant newline when autocorrecting an invocation oftake
orfirst
. This occurs when these methods are called on a separate line with a leading dot. This issue results in a syntax error if there's another method call following it, as illustrated below.Expected behavior
After autocorrection, the code should appear as follows, without any additional newlines:
Actual behavior
However, the autocorrection currently results in an unnecessary newline, causing a syntax error:
Steps to reproduce the problem
example.rb
.bundle exec rubocop --only Rails/FindBy -a example.rb
.RuboCop version
The text was updated successfully, but these errors were encountered: