DEV: Hand-pick Rails/WhereNot autofixes (#35117)

We can't enable `Rails/WhereNot` lint/autofix, because it would break
code that uses mini_sql instead of AR (which rubocop, and tbh also we,
can't easily differentiate)

Those are safe because they either:
* are executed in AR model scope definitions
* are clearly chained starting from a AR model
* are less-clearly chained, but still can be traced to a AR model/scope

---------

Co-authored-by: Loïc Guitaut <loic@discourse.org>
This commit is contained in:
Jarek Radosz
2025-10-03 13:29:22 +02:00
committed by GitHub
co-authored by Loïc Guitaut
parent e5ca38d2be
commit a54e3208cb
62 changed files with 128 additions and 146 deletions
+1 -1
View File
@@ -258,7 +258,7 @@ class BulkImport::Base
@last_upload_id = last_id(Upload)
@user_ids_by_username_lower = User.unscoped.pluck(:id, :username_lower).to_h
@usernames_by_id = User.unscoped.pluck(:id, :username).to_h
@user_full_names_by_id = User.unscoped.where("name IS NOT NULL").pluck(:id, :name).to_h
@user_full_names_by_id = User.unscoped.where.not(name: nil).pluck(:id, :name).to_h
puts "Loading categories indexes..."
@last_category_id = last_id(Category)