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

Cop idea: don't divide .where.not into two lines #1051

Closed
ydakuka opened this issue Jul 21, 2023 · 2 comments
Closed

Cop idea: don't divide .where.not into two lines #1051

ydakuka opened this issue Jul 21, 2023 · 2 comments

Comments

@ydakuka
Copy link

ydakuka commented Jul 21, 2023

Actual behavior

# frozen_string_literal: true

module ApplicationHelper
  def user_ids
    User.where
        .not(id: [1, 2, 3])
        .ids
  end
end

I run rubocop and don't get any offences:

ydakuka@yauhenid:~/Work/project$ bin/rails_docker rubocop app/helpers/application_helper.rb
Inspecting 1 file
.

1 file inspected, no offenses detected

Expected behavior

I expected to receive the following code:

# frozen_string_literal: true

module ApplicationHelper
  def user_ids
    User.where.not(id: [1, 2, 3])
        .ids
  end
end
@koic
Copy link
Member

koic commented Aug 14, 2023

I'm not sure how much value there is in treating only not as special. IMHO, I find it difficult to be accepted because it doesn't look like a general rule. If you're still interested, try opening a suggestion to the Rails style guide first:
https://github.com/rubocop/rails-style-guide

Thank you.

@koic koic closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2023
@ydakuka
Copy link
Author

ydakuka commented Aug 14, 2023

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

No branches or pull requests

2 participants