summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-10-28 07:50:11 +0000
committerGo MAEDA <maeda@farend.jp>2022-10-28 07:50:11 +0000
commitee1476f802d34ee31d1e1c990165165338867ff6 (patch)
treed7848fddb34b876dbe05864d0b04ec98d5db8893 /app
parent6a55e94cd2ac8ed2462aa8b80ab9a96a8d43e25b (diff)
downloadredmine-ee1476f802d34ee31d1e1c990165165338867ff6.tar.gz
redmine-ee1476f802d34ee31d1e1c990165165338867ff6.zip
Fix RuboCop offense Rails/Pluck (#37248).
git-svn-id: https://svn.redmine.org/redmine/trunk@21928 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/helpers/versions_helper.rb2
-rw-r--r--app/models/changeset.rb2
-rw-r--r--app/models/query.rb2
-rw-r--r--app/models/repository/git.rb2
4 files changed, 4 insertions, 4 deletions
diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb
index ffaa54675..ef4bb9d04 100644
--- a/app/helpers/versions_helper.rb
+++ b/app/helpers/versions_helper.rb
@@ -75,7 +75,7 @@ module VersionsHelper
sorted_keys.collect do |k|
{:group => k, :total => h[k][0], :open => h[k][1], :closed => (h[k][0] - h[k][1])}
end
- max = counts.collect {|c| c[:total]}.max
+ max = counts.pluck(:total).max
render :partial => 'issue_counts', :locals => {:version => version, :criteria => criteria, :counts => counts, :max => max}
end
diff --git a/app/models/changeset.rb b/app/models/changeset.rb
index 4e04e4965..b4501b19e 100644
--- a/app/models/changeset.rb
+++ b/app/models/changeset.rb
@@ -129,7 +129,7 @@ class Changeset < ActiveRecord::Base
ref_keywords_any = ref_keywords.delete('*')
# keywords used to fix issues
- fix_keywords = Setting.commit_update_keywords_array.map {|r| r['keywords']}.flatten.compact
+ fix_keywords = Setting.commit_update_keywords_array.pluck('keywords').flatten.compact
kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw)}.join("|")
referenced_issues = []
diff --git a/app/models/query.rb b/app/models/query.rb
index 9f7de57c7..e18b06805 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -542,7 +542,7 @@ class Query < ActiveRecord::Base
if has_filter?(field) || !filter.remote
options[:values] = filter.values
if options[:values] && values_for(field)
- missing = Array(values_for(field)).select(&:present?) - options[:values].map{|v| v[1]}
+ missing = Array(values_for(field)).select(&:present?) - options[:values].pluck(1)
if missing.any? && respond_to?(method = "find_#{field}_filter_values")
options[:values] += send(method, missing)
end
diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb
index bd160b3e5..a19f38f2a 100644
--- a/app/models/repository/git.rb
+++ b/app/models/repository/git.rb
@@ -232,7 +232,7 @@ class Repository::Git < Repository
def heads_from_branches_hash
h = extra_info&.dup || {}
h["branches"] ||= {}
- h['branches'].map{|br, hs| hs['last_scmid']}
+ h['branches'].map{|br, hs| hs['last_scmid']} # rubocop:disable Rails/Pluck
end
def latest_changesets(path, rev, limit=10)