]> source.dussan.org Git - redmine.git/commitdiff
Fix RuboCop Style/MultilineIfModifier in ReportsHelper by using safe navigation opera...
authorGo MAEDA <maeda@farend.jp>
Sun, 27 Oct 2024 06:30:10 +0000 (06:30 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 27 Oct 2024 06:30:10 +0000 (06:30 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@23166 e93f8b46-1217-0410-a6f0-8f06a7374b81

.rubocop_todo.yml
app/helpers/reports_helper.rb

index 09f5388f08631de7419707ca89d488019864d579..0f316a54b7df344f4ff49a06a907030fbcdbeb82 100644 (file)
@@ -950,7 +950,6 @@ Style/MultilineIfModifier:
     - 'app/helpers/attachments_helper.rb'
     - 'app/helpers/custom_fields_helper.rb'
     - 'app/helpers/projects_helper.rb'
-    - 'app/helpers/reports_helper.rb'
     - 'app/helpers/repositories_helper.rb'
     - 'app/helpers/search_helper.rb'
     - 'app/models/issue_query.rb'
index d49b43f4e04c873775801703d3abe1f92bb29ef9..6390ecbdb3db1cf6a3de43826e22261049134ebd 100644 (file)
 module ReportsHelper
   def aggregate(data, criteria)
     a = 0
-    data.each do |row|
+    data&.each do |row|
       match = 1
-      criteria.each do |k, v|
+      criteria&.each do |k, v|
         unless (row[k].to_s == v.to_s) ||
                  (k == 'closed' &&
                    (v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
           match = 0
         end
-      end unless criteria.nil?
+      end
       a = a + row["total"].to_i if match == 1
-    end unless data.nil?
+    end
     a
   end