Skip to content

Commit

Permalink
Adopt new rubocop rule defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
simi committed Jan 31, 2025
1 parent bea2cf2 commit f68e145
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/avo/concerns/auditable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def merge_changes!(changes, changes_to_save)
end
end

def in_audited_transaction(auditable:, admin_github_user:, action:, fields:, arguments:, models:, &blk) # rubocop:disable Metrics Naming/BlockForwarding
def in_audited_transaction(auditable:, admin_github_user:, action:, fields:, arguments:, models:, &) # rubocop:disable Metrics Naming/BlockForwarding
logger.debug { "Auditing changes to #{auditable}: #{fields}" }

User.transaction do
Expand All @@ -25,7 +25,7 @@ def in_audited_transaction(auditable:, admin_github_user:, action:, fields:, arg
merge_changes!((changed_records[record] ||= {}), record.attributes.transform_values { [nil, _1] }) if record.new_record?
merge_changes!((changed_records[record] ||= {}), record.changes_to_save)
end
end, "sql.active_record", &blk)
end, "sql.active_record", &)

case auditable
when :return
Expand Down
4 changes: 2 additions & 2 deletions app/avo/fields/array_of_field.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class Avo::Fields::ArrayOfField < Avo::Fields::BaseField
def initialize(name, field:, field_options: {}, **args, &block)
def initialize(name, field:, field_options: {}, **args, &)
super(name, **args, &nil)

@make_field = lambda do |id:, index: nil, value: nil|
items_holder = Avo::Resources::Items::Holder.new
items_holder.field(id, name: index&.to_s || self.name, as: field, required: -> { false }, value:, **field_options, &block)
items_holder.field(id, name: index&.to_s || self.name, as: field, required: -> { false }, value:, **field_options, &)
items_holder.items.sole.hydrate(view:, resource:)
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/concerns/avo_auditable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module AvoAuditable
prepend_around_action :unscope_users
end

def perform_action_and_record_errors(&blk)
def perform_action_and_record_errors(&)
super do
action = params.fetch(:action)
fields = action == "destroy" ? {} : cast_nullable(model_params)
Expand All @@ -23,7 +23,7 @@ def perform_action_and_record_errors(&blk)
fields: fields.reverse_merge(comment: action_name),
arguments: {},
models: [@record],
&blk
&
)
value
end
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/concerns/session_verifiable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module SessionVerifiable
extend ActiveSupport::Concern

class_methods do
def verify_session_before(**opts)
before_action :redirect_to_signin, **opts, unless: :signed_in?
before_action :redirect_to_new_mfa, **opts, if: :mfa_required_not_yet_enabled?
before_action :redirect_to_settings_strong_mfa_required, **opts, if: :mfa_required_weak_level_enabled?
before_action :redirect_to_verify, **opts, unless: :verified_session_active?
def verify_session_before(**)
before_action(:redirect_to_signin, **, unless: :signed_in?)
before_action(:redirect_to_new_mfa, **, if: :mfa_required_not_yet_enabled?)
before_action(:redirect_to_settings_strong_mfa_required, **, if: :mfa_required_weak_level_enabled?)
before_action(:redirect_to_verify, **, unless: :verified_session_active?)
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/gem_package_enumerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def filter_map(&)

private

def open_data_tar(&blk)
def open_data_tar(&)
@package.verify
@package.gem.with_read_io do |io|
Gem::Package::TarReader.new(io).seek("data.tar.gz") do |gem_entry|
@package.open_tar_gz(gem_entry, &blk)
@package.open_tar_gz(gem_entry, &)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/functional/api/v1/rubygems_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ def self.should_respond_to_show
end
end

def self.should_respond_to(format, &blk)
def self.should_respond_to(format, &)
context "with #{format.to_s.upcase} for a hosted gem" do
setup do
@rubygem = create(:rubygem)
create(:version, rubygem: @rubygem)
get :show, params: { id: @rubygem.slug }, format: format
end

should_respond_to_show(&blk)
should_respond_to_show(&)
end

context "with #{format.to_s.upcase} for a hosted gem with a period in its name" do
Expand All @@ -41,7 +41,7 @@ def self.should_respond_to(format, &blk)
get :show, params: { id: @rubygem.slug }, format: format
end

should_respond_to_show(&blk)
should_respond_to_show(&)
end
end

Expand Down

0 comments on commit f68e145

Please sign in to comment.