Merge pull request #6106 from consuldemocracy/dependabot/bundler/rubocop-rails-2.33.4

Bump rubocop-rails from 2.29.1 to 2.33.4
This commit is contained in:
Javi Martín
2025-11-05 14:06:09 +01:00
committed by GitHub
17 changed files with 34 additions and 23 deletions

View File

@@ -2,9 +2,9 @@ plugins:
- rubocop-capybara
- rubocop-factory_bot
- rubocop-performance
- rubocop-rails
- rubocop-rspec
require:
- rubocop-rails
- rubocop-rspec_rails
AllCops:
@@ -441,6 +441,9 @@ Rails/FindBy:
Exclude:
- "config/initializers/ahoy.rb"
Rails/FindByOrAssignmentMemoization:
Enabled: true
Rails/FindEach:
Enabled: true
@@ -469,6 +472,9 @@ Rails/NotNullColumn:
Exclude:
- "db/migrate/201[5-7]*"
Rails/OrderArguments:
Enabled: true
Rails/OutputSafety:
Enabled: true
Severity: warning

View File

@@ -107,7 +107,7 @@ group :development do
gem "rubocop-capybara", "~> 2.22.1", require: false
gem "rubocop-factory_bot", "~> 2.27.1", require: false
gem "rubocop-performance", "~> 1.26.1", require: false
gem "rubocop-rails", "~> 2.29.1", require: false
gem "rubocop-rails", "~> 2.33.4", require: false
gem "rubocop-rspec", "~> 3.7.0", require: false
gem "rubocop-rspec_rails", "~> 2.30.0", require: false
gem "rvm1-capistrano3", "~> 1.4.0", require: false

View File

@@ -649,11 +649,12 @@ GEM
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.47.1, < 2.0)
rubocop-rails (2.29.1)
rubocop-rails (2.33.4)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
rubocop-rspec (3.7.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
@@ -891,7 +892,7 @@ DEPENDENCIES
rubocop-capybara (~> 2.22.1)
rubocop-factory_bot (~> 2.27.1)
rubocop-performance (~> 1.26.1)
rubocop-rails (~> 2.29.1)
rubocop-rails (~> 2.33.4)
rubocop-rspec (~> 3.7.0)
rubocop-rspec_rails (~> 2.30.0)
rvm1-capistrano3 (~> 1.4.0)

View File

@@ -35,11 +35,11 @@ class Admin::BudgetInvestments::SearchFormComponent < ApplicationComponent
end
def valuator_group_select_options
ValuatorGroup.order("name ASC").map { |g| [g.name, "group_#{g.id}"] }
ValuatorGroup.order(:name).map { |g| [g.name, "group_#{g.id}"] }
end
def valuator_select_options
budget.valuators.order("description ASC").order("users.email ASC").includes(:user)
budget.valuators.order(:description).order("users.email ASC").includes(:user)
.map { |v| [v.description_or_email, "valuator_#{v.id}"] }
end

View File

@@ -8,7 +8,7 @@ class Admin::MachineLearning::SettingComponent < ApplicationComponent
private
def setting
@setting ||= Setting.find_by(key: "machine_learning.#{kind}")
@setting ||= Setting.find_by!(key: "machine_learning.#{kind}")
end
def ml_info

View File

@@ -21,6 +21,6 @@ class Admin::HomepageController < Admin::BaseController
end
def load_feeds
@feeds = Widget::Feed.order("created_at")
@feeds = Widget::Feed.order(:created_at)
end
end

View File

@@ -3,7 +3,7 @@ class Admin::SiteCustomization::PagesController < Admin::SiteCustomization::Base
load_and_authorize_resource :page, class: "SiteCustomization::Page"
def index
@pages = SiteCustomization::Page.order("slug").page(params[:page])
@pages = SiteCustomization::Page.order(:slug).page(params[:page])
end
def create

View File

@@ -27,7 +27,9 @@ class Dashboard::SuccessfulSupportsController < Dashboard::BaseController
end
def successful_proposal
@successful_proposal ||= Proposal.find_by(id: Setting["proposals.successful_proposal_id"])
return @successful_proposal if defined?(@successful_proposal)
@successful_proposal = Proposal.find_by(id: Setting["proposals.successful_proposal_id"])
end
def days_diff

View File

@@ -69,8 +69,8 @@ class Budget
scope :sort_by_confidence_score, -> { reorder(confidence_score: :desc, id: :desc) }
scope :sort_by_ballots, -> { reorder(ballot_lines_count: :desc, id: :desc) }
scope :sort_by_price, -> { reorder(price: :desc, confidence_score: :desc, id: :desc) }
scope :sort_by_id, -> { order("id DESC") }
scope :sort_by_supports, -> { order("cached_votes_up DESC") }
scope :sort_by_id, -> { order(id: :desc) }
scope :sort_by_supports, -> { order(cached_votes_up: :desc) }
scope :valuation_open, -> { where(valuation_finished: false) }
scope :with_admin, -> { where.not(administrator_id: nil) }

View File

@@ -75,7 +75,7 @@ class Budget::Stats
def headings
groups = Hash.new(0)
budget.headings.order("id ASC").each do |heading|
budget.headings.order(:id).each do |heading|
groups[heading.id] = Hash.new(0).merge(calculate_heading_totals(heading))
end

View File

@@ -216,7 +216,7 @@ module Statisticable
end
def geozones
Geozone.order("name")
Geozone.order(:name)
end
def range_description(start, finish)

View File

@@ -19,7 +19,7 @@ class Legislation::DraftVersion < ApplicationRecord
validates_translation :body, presence: true
validates :status, presence: true, inclusion: { in: ->(*) { VALID_STATUSES }}
scope :published, -> { where(status: "published").order("id DESC") }
scope :published, -> { where(status: "published").order(id: :desc) }
def body_html
MarkdownConverter.new(body, with_toc_data: true).render

View File

@@ -27,7 +27,7 @@ class Legislation::Question < ApplicationRecord
validates :process, presence: true
validates_translation :title, presence: true
scope :sorted, -> { order("id ASC") }
scope :sorted, -> { order(:id) }
def next_question_id
@next_question_id ||= process.questions.where("id > ?", id).sorted.limit(1).ids.first

View File

@@ -12,7 +12,7 @@ class Poll::Question < ApplicationRecord
has_many :comments, as: :commentable, inverse_of: :commentable
has_many :answers, class_name: "Poll::Answer"
has_many :question_options, -> { order "given_order asc" },
has_many :question_options, -> { order :given_order },
class_name: "Poll::Question::Option",
inverse_of: :question,
dependent: :destroy

View File

@@ -13,8 +13,8 @@ class SiteCustomization::Page < ApplicationRecord
validates :status, presence: true, inclusion: { in: ->(*) { VALID_STATUSES }}
scope :published, -> { where(status: "published").sort_desc }
scope :sort_asc, -> { order("id ASC") }
scope :sort_desc, -> { order("id DESC") }
scope :sort_asc, -> { order(:id) }
scope :sort_desc, -> { order(id: :desc) }
scope :with_more_info_flag, -> { where(status: "published", more_info_flag: true).sort_asc }
scope :with_same_locale, -> { joins(:translations).locale }
scope :locale, -> { where("site_customization_page_translations.locale": I18n.locale) }

View File

@@ -11,7 +11,9 @@ class Verification::Management::Email
delegate :username, to: :user, allow_nil: true
def user
@user ||= User.find_by(email: email)
return @user if defined?(@user)
@user = User.find_by(email: email)
end
def user?

View File

@@ -29,6 +29,6 @@ class Widget::Feed < ApplicationRecord
end
def processes
Legislation::Process.open.published.order("created_at DESC").limit(limit)
Legislation::Process.open.published.order(created_at: :desc).limit(limit)
end
end