From f4203909db7f38688d5c9934ce3f03d6e1262642 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 00:20:06 +0000 Subject: [PATCH] Bump rubocop from 1.56.4 to 1.61.0 This version fixes false negatives for Lint/SymbolConversion when using string interpolation, for Style/RedundantArgument when using the safe navigation operator, for Style/RedundantParentheses when logical operators are involved and for Style/RedundantReturn with lambda ending with return. We're applying the new rules. Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.56.4 to 1.61.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.56.4...v1.61.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 9 ++++----- app/components/budgets/investments/votes_component.rb | 8 ++++---- .../admin/legislation/homepages_controller.rb | 2 +- .../admin/legislation/processes_controller.rb | 2 +- app/controllers/admin/poll/shifts_controller.rb | 2 +- app/controllers/concerns/commentable_actions.rb | 2 +- app/models/concerns/documentable.rb | 2 +- app/models/dashboard/action.rb | 4 ++-- app/models/image.rb | 2 +- app/models/setting.rb | 2 +- spec/support/common_actions/emails.rb | 6 +++--- spec/support/common_actions/notifications.rb | 6 +++--- 13 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Gemfile b/Gemfile index a875d737e..304689faf 100644 --- a/Gemfile +++ b/Gemfile @@ -99,7 +99,7 @@ group :development do gem "pronto-eslint", "~> 0.11.1", require: false gem "pronto-rubocop", "~> 0.11.5", require: false gem "pronto-scss", "~> 0.11.0", require: false - gem "rubocop", "~> 1.56.4", require: false + gem "rubocop", "~> 1.61.0", require: false gem "rubocop-capybara", "~> 2.20.0", require: false gem "rubocop-factory_bot", "~> 2.25.1", require: false gem "rubocop-performance", "~> 1.20.2", require: false diff --git a/Gemfile.lock b/Gemfile.lock index a6c0bd6c1..c7f0dfef3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -526,16 +526,15 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.56.4) - base64 (~> 0.1.1) + rubocop (1.61.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.31.2) @@ -758,7 +757,7 @@ DEPENDENCIES rinku (~> 2.0.6) ros-apartment (~> 2.11.0) rspec-rails (~> 6.1.2) - rubocop (~> 1.56.4) + rubocop (~> 1.61.0) rubocop-capybara (~> 2.20.0) rubocop-factory_bot (~> 2.25.1) rubocop-performance (~> 1.20.2) diff --git a/app/components/budgets/investments/votes_component.rb b/app/components/budgets/investments/votes_component.rb index a570c426b..9a8f68800 100644 --- a/app/components/budgets/investments/votes_component.rb +++ b/app/components/budgets/investments/votes_component.rb @@ -64,10 +64,10 @@ class Budgets::Investments::VotesComponent < ApplicationComponent t("votes.budget_investments.#{reason}", count: investment.group.max_votable_headings, verify_account: link_to_verify_account, - supported_headings: (current_user && current_user.headings_voted_within_group(investment.group) - .map(&:name) - .sort - .to_sentence)) + supported_headings: current_user && current_user.headings_voted_within_group(investment.group) + .map(&:name) + .sort + .to_sentence) end end end diff --git a/app/controllers/admin/legislation/homepages_controller.rb b/app/controllers/admin/legislation/homepages_controller.rb index 933793a8d..68d10285c 100644 --- a/app/controllers/admin/legislation/homepages_controller.rb +++ b/app/controllers/admin/legislation/homepages_controller.rb @@ -9,7 +9,7 @@ class Admin::Legislation::HomepagesController < Admin::Legislation::BaseControll def update if @process.update(process_params) link = legislation_process_path(@process) - redirect_back(fallback_location: (request.referer || root_path), + redirect_back(fallback_location: request.referer || root_path, notice: t("admin.legislation.processes.update.notice", link: link)) else flash.now[:error] = t("admin.legislation.processes.update.error") diff --git a/app/controllers/admin/legislation/processes_controller.rb b/app/controllers/admin/legislation/processes_controller.rb index 370236008..d35b7ca52 100644 --- a/app/controllers/admin/legislation/processes_controller.rb +++ b/app/controllers/admin/legislation/processes_controller.rb @@ -27,7 +27,7 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll def update if @process.update(process_params) link = legislation_process_path(@process) - redirect_back(fallback_location: (request.referer || root_path), + redirect_back(fallback_location: request.referer || root_path, notice: t("admin.legislation.processes.update.notice", link: link)) else flash.now[:error] = t("admin.legislation.processes.update.error") diff --git a/app/controllers/admin/poll/shifts_controller.rb b/app/controllers/admin/poll/shifts_controller.rb index 06b31efb7..2aa60ecbb 100644 --- a/app/controllers/admin/poll/shifts_controller.rb +++ b/app/controllers/admin/poll/shifts_controller.rb @@ -57,7 +57,7 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController def shift_params shift_params = params.require(:shift).permit(allowed_params) - shift_params.merge(date: shift_params[:date]["#{shift_params[:task]}_date".to_sym]) + shift_params.merge(date: shift_params[:date][:"#{shift_params[:task]}_date"]) end def allowed_params diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index 1bd7fcfa5..a4bc77a4d 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -75,7 +75,7 @@ module CommentableActions private def track_event - ahoy.track "#{resource_name}_created".to_sym, "#{resource_name}_id": resource.id + ahoy.track :"#{resource_name}_created", "#{resource_name}_id": resource.id end def tag_cloud diff --git a/app/models/concerns/documentable.rb b/app/models/concerns/documentable.rb index dd4aa531a..dc668f838 100644 --- a/app/models/concerns/documentable.rb +++ b/app/models/concerns/documentable.rb @@ -16,7 +16,7 @@ module Documentable end def accepted_content_types - Setting["uploads.documents.content_types"]&.split(" ") || ["application/pdf"] + Setting["uploads.documents.content_types"]&.split || ["application/pdf"] end end end diff --git a/app/models/dashboard/action.rb b/app/models/dashboard/action.rb index 6287adcab..159e3d91b 100644 --- a/app/models/dashboard/action.rb +++ b/app/models/dashboard/action.rb @@ -34,10 +34,10 @@ class Dashboard::Action < ApplicationRecord scope :resources, -> { where(action_type: 1) } scope :proposed_actions, -> { where(action_type: 0) } scope :by_proposal, lambda { |proposal| - return where(published_proposal: false) if proposal.draft? + where(published_proposal: false) if proposal.draft? } scope :by_published_proposal, lambda { |published| - return where(published_proposal: published) + where(published_proposal: published) } def self.active_for(proposal) diff --git a/app/models/image.rb b/app/models/image.rb index 1f541171b..10523e516 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -24,7 +24,7 @@ class Image < ApplicationRecord end def self.accepted_content_types - Setting["uploads.images.content_types"]&.split(" ") || ["image/jpeg"] + Setting["uploads.images.content_types"]&.split || ["image/jpeg"] end def self.humanized_accepted_content_types diff --git a/app/models/setting.rb b/app/models/setting.rb index ec26ae211..97fb97890 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -40,7 +40,7 @@ class Setting < ApplicationRecord end def accepted_content_types_for(group) - mime_content_types = Setting["uploads.#{group}.content_types"]&.split(" ") || [] + mime_content_types = Setting["uploads.#{group}.content_types"]&.split || [] Setting.mime_types[group].select { |_, content_type| mime_content_types.include?(content_type) }.keys end diff --git a/spec/support/common_actions/emails.rb b/spec/support/common_actions/emails.rb index 01c83c431..ad4d91995 100644 --- a/spec/support/common_actions/emails.rb +++ b/spec/support/common_actions/emails.rb @@ -18,9 +18,9 @@ module Emails def fill_in_newsletter_form(options = {}) select (options[:segment_recipient] || "All users"), from: "Recipients" - fill_in "Subject", with: (options[:subject] || "This is a different subject") + fill_in "Subject", with: options[:subject] || "This is a different subject" fill_in "E-mail address that will appear as sending the newsletter", - with: (options[:from] || "no-reply@consul.dev") - fill_in_ckeditor "Email content", with: (options[:body] || "This is a different body") + with: options[:from] || "no-reply@consul.dev" + fill_in_ckeditor "Email content", with: options[:body] || "This is a different body" end end diff --git a/spec/support/common_actions/notifications.rb b/spec/support/common_actions/notifications.rb index 38ca96502..3ac1a2838 100644 --- a/spec/support/common_actions/notifications.rb +++ b/spec/support/common_actions/notifications.rb @@ -61,8 +61,8 @@ module Notifications def fill_in_admin_notification_form(options = {}) select (options[:segment_recipient] || "All users"), from: :admin_notification_segment_recipient - fill_in "Title", with: (options[:title] || "This is the notification title") - fill_in "Text", with: (options[:body] || "This is the notification body") - fill_in :admin_notification_link, with: (options[:link] || "https://www.decide.madrid.es/vota") + fill_in "Title", with: options[:title] || "This is the notification title" + fill_in "Text", with: options[:body] || "This is the notification body" + fill_in :admin_notification_link, with: options[:link] || "https://www.decide.madrid.es/vota" end end