From 0ac254997a06ca0f5dad28ff5de48ce13baba665 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 23 Jan 2024 09:00:18 +0100 Subject: [PATCH] Refs #36998 - Fix Rails/Pick and Rails/IndexWith cops These did not show up when running Rubocop from the Foreman checkout, but do when executed directly from a Katello checkout. (cherry picked from commit 7f99691e986189a27f285cd02644effb06c932e9) --- app/mailers/katello/errata_mailer.rb | 6 +++--- app/models/katello/concerns/hostgroup_extensions.rb | 2 +- app/models/katello/concerns/organization_extensions.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/mailers/katello/errata_mailer.rb b/app/mailers/katello/errata_mailer.rb index 35204f37241..fee76db78d5 100644 --- a/app/mailers/katello/errata_mailer.rb +++ b/app/mailers/katello/errata_mailer.rb @@ -50,9 +50,9 @@ def promote_errata(options) def errata_counts(errata) counts = {:total => errata.count} - counts.merge(Hash[[:security, :bugfix, :enhancement].collect do |errata_type| - [errata_type, errata.send(errata_type).count] - end]) + counts.merge([:security, :bugfix, :enhancement].index_with do |errata_type| + errata.send(errata_type).count + end) end end end diff --git a/app/models/katello/concerns/hostgroup_extensions.rb b/app/models/katello/concerns/hostgroup_extensions.rb index 0d5e39ef2ed..e08b8d07ae2 100644 --- a/app/models/katello/concerns/hostgroup_extensions.rb +++ b/app/models/katello/concerns/hostgroup_extensions.rb @@ -123,7 +123,7 @@ def inherited_ancestry_attribute(attribute, facet) facet_model = Facets.registered_facets[facet].hostgroup_configuration.model value = facet_model.where.not(attribute => nil).joins(:hostgroup).merge( ::Hostgroup.where(id: self.ancestor_ids).reorder(ancestry: :desc) - ).limit(1).pluck(attribute).first + ).pick(attribute) end value end diff --git a/app/models/katello/concerns/organization_extensions.rb b/app/models/katello/concerns/organization_extensions.rb index 2a9022e1120..332f3a94d2b 100644 --- a/app/models/katello/concerns/organization_extensions.rb +++ b/app/models/katello/concerns/organization_extensions.rb @@ -79,7 +79,7 @@ def redhat_provider end def redhat_account_number - pools.upstream.pluck(:account_number).first + pools.upstream.pick(:account_number) end def active_pools_count