Commit 6e99f8ee7ab69b52a63e8b987d3c988b12d4e6c2
1 parent
7cd5df5c
Exists in
master
and in
1 other branch
Rubocop: use proc over Proc.new
Showing
3 changed files
with
3 additions
and
10 deletions
Show diff stats
.rubocop_todo.yml
| ... | ... | @@ -207,13 +207,6 @@ Style/PercentLiteralDelimiters: |
| 207 | 207 | - 'app/controllers/problems_searcher.rb' |
| 208 | 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 | 210 | # Offense count: 1 |
| 218 | 211 | # Configuration parameters: Methods. |
| 219 | 212 | Style/SingleLineBlockParams: | ... | ... |
app/models/notice.rb
| ... | ... | @@ -28,7 +28,7 @@ class Notice |
| 28 | 28 | |
| 29 | 29 | scope :ordered, -> { order_by(:created_at.asc) } |
| 30 | 30 | scope :reverse_ordered, -> { order_by(:created_at.desc) } |
| 31 | - scope :for_errs, Proc.new { |errs| | |
| 31 | + scope :for_errs, -> (errs) { | |
| 32 | 32 | where(:err_id.in => errs.all.map(&:id)) |
| 33 | 33 | } |
| 34 | 34 | ... | ... |
app/models/problem.rb
| ... | ... | @@ -12,8 +12,8 @@ class Problem |
| 12 | 12 | user_agents: :user_agent_string |
| 13 | 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 | 17 | field :last_deploy_at, :type => Time |
| 18 | 18 | field :resolved, :type => Boolean, :default => false |
| 19 | 19 | field :resolved_at, :type => Time | ... | ... |