From 9081174dd785f4b5470121bb02976761d948eebc Mon Sep 17 00:00:00 2001 From: taitus Date: Thu, 13 Feb 2025 10:48:16 +0100 Subject: [PATCH] Add and apply Style/KeywordArgumentsMerging rubocop rule This rule was introduced in RuboCop 1.68 to encourage passing additional keyword arguments directly instead of using merge. --- .rubocop.yml | 3 +++ app/components/admin/allowed_table_actions_component.rb | 2 +- app/components/admin/table_actions_component.html.erb | 4 ++-- spec/support/matchers/have_avatar.rb | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index fd0d057bf..0f291bb99 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -743,6 +743,9 @@ Style/InvertibleUnlessCondition: :present?: :blank? :zero?: ~ +Style/KeywordArgumentsMerging: + Enabled: true + Style/LineEndConcatenation: Enabled: true diff --git a/app/components/admin/allowed_table_actions_component.rb b/app/components/admin/allowed_table_actions_component.rb index a237bde5c..53a5410c4 100644 --- a/app/components/admin/allowed_table_actions_component.rb +++ b/app/components/admin/allowed_table_actions_component.rb @@ -15,6 +15,6 @@ class Admin::AllowedTableActionsComponent < ApplicationComponent end def table_actions_component - @table_actions_component ||= Admin::TableActionsComponent.new(record, **options.merge(actions: actions)) + @table_actions_component ||= Admin::TableActionsComponent.new(record, **options, actions: actions) end end diff --git a/app/components/admin/table_actions_component.html.erb b/app/components/admin/table_actions_component.html.erb index 58c6b2763..1ccf0915e 100644 --- a/app/components/admin/table_actions_component.html.erb +++ b/app/components/admin/table_actions_component.html.erb @@ -2,10 +2,10 @@ <%= content %> <% if actions.include?(:edit) %> - <%= action(:edit, **edit_options.merge(text: edit_text, path: edit_path)) %> + <%= action(:edit, **edit_options, text: edit_text, path: edit_path) %> <% end %> <% if actions.include?(:destroy) %> - <%= action(:destroy, **destroy_options.merge(text: destroy_text, path: destroy_path)) %> + <%= action(:destroy, **destroy_options, text: destroy_text, path: destroy_path) %> <% end %> diff --git a/spec/support/matchers/have_avatar.rb b/spec/support/matchers/have_avatar.rb index f45895e84..c2a2a2289 100644 --- a/spec/support/matchers/have_avatar.rb +++ b/spec/support/matchers/have_avatar.rb @@ -1,6 +1,6 @@ RSpec::Matchers.define :have_avatar do |text, **options| match do |page| - page.has_css?("svg.initialjs-avatar", **{ exact_text: text }.merge(options)) + page.has_css?("svg.initialjs-avatar", **{ exact_text: text }, **options) end failure_message do