Commit 6e99f8ee7ab69b52a63e8b987d3c988b12d4e6c2

Authored by Laust Rud Jacobsen
1 parent 7cd5df5c
Exists in master and in 1 other branch production

Rubocop: use proc over Proc.new

.rubocop_todo.yml
@@ -207,13 +207,6 @@ Style/PercentLiteralDelimiters: @@ -207,13 +207,6 @@ Style/PercentLiteralDelimiters:
207 - 'app/controllers/problems_searcher.rb' 207 - 'app/controllers/problems_searcher.rb'
208 - 'spec/models/notice_spec.rb' 208 - 'spec/models/notice_spec.rb'
209 209
210 -# Offense count: 3  
211 -# Cop supports --auto-correct.  
212 -Style/Proc:  
213 - Exclude:  
214 - - 'app/models/notice.rb'  
215 - - 'app/models/problem.rb'  
216 -  
217 # Offense count: 1 210 # Offense count: 1
218 # Configuration parameters: Methods. 211 # Configuration parameters: Methods.
219 Style/SingleLineBlockParams: 212 Style/SingleLineBlockParams:
app/models/notice.rb
@@ -28,7 +28,7 @@ class Notice @@ -28,7 +28,7 @@ class Notice
28 28
29 scope :ordered, -> { order_by(:created_at.asc) } 29 scope :ordered, -> { order_by(:created_at.asc) }
30 scope :reverse_ordered, -> { order_by(:created_at.desc) } 30 scope :reverse_ordered, -> { order_by(:created_at.desc) }
31 - scope :for_errs, Proc.new { |errs| 31 + scope :for_errs, -> (errs) {
32 where(:err_id.in => errs.all.map(&:id)) 32 where(:err_id.in => errs.all.map(&:id))
33 } 33 }
34 34
app/models/problem.rb
@@ -12,8 +12,8 @@ class Problem @@ -12,8 +12,8 @@ class Problem
12 user_agents: :user_agent_string 12 user_agents: :user_agent_string
13 }.freeze 13 }.freeze
14 14
15 - field :last_notice_at, :type => ActiveSupport::TimeWithZone, :default => Proc.new { Time.zone.now }  
16 - field :first_notice_at, :type => ActiveSupport::TimeWithZone, :default => Proc.new { Time.zone.now } 15 + field :last_notice_at, :type => ActiveSupport::TimeWithZone, :default => proc { Time.zone.now }
  16 + field :first_notice_at, :type => ActiveSupport::TimeWithZone, :default => proc { Time.zone.now }
17 field :last_deploy_at, :type => Time 17 field :last_deploy_at, :type => Time
18 field :resolved, :type => Boolean, :default => false 18 field :resolved, :type => Boolean, :default => false
19 field :resolved_at, :type => Time 19 field :resolved_at, :type => Time