From 5dc3a7e2f7d58e8e0f915e658cb49c882bddbbf5 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Tue, 8 Nov 2022 00:25:29 +1030 Subject: [PATCH] Rubocop --- .rubocop_todo.yml | 13 ------------- app/models/photo_association.rb | 6 +++--- lib/haml/filters/growstuff_markdown.rb | 8 ++++---- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index aeb12cb02..6bd1a06b1 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -546,13 +546,6 @@ Style/GlobalStdStream: - 'config/environments/production.rb' - 'lib/tasks/openfarm.rake' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. -Style/GuardClause: - Exclude: - - 'app/models/photo_association.rb' - # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: @@ -623,12 +616,6 @@ Style/RedundantFetchBlock: Exclude: - 'config/puma.rb' -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantFreeze: - Exclude: - - 'lib/haml/filters/growstuff_markdown.rb' - # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowModifier. diff --git a/app/models/photo_association.rb b/app/models/photo_association.rb index 81477d78f..6e9ad47e7 100644 --- a/app/models/photo_association.rb +++ b/app/models/photo_association.rb @@ -33,8 +33,8 @@ class PhotoAssociation < ApplicationRecord end def crop_present - if %w(Planting Seed Harvest).include?(photographable_type) - errors.add(:crop_id, "failed to calculate crop") if crop_id.blank? - end + return unless %w(Planting Seed Harvest).include?(photographable_type) + + errors.add(:crop_id, "failed to calculate crop") if crop_id.blank? end end diff --git a/lib/haml/filters/growstuff_markdown.rb b/lib/haml/filters/growstuff_markdown.rb index e84465be1..88037fac2 100644 --- a/lib/haml/filters/growstuff_markdown.rb +++ b/lib/haml/filters/growstuff_markdown.rb @@ -15,10 +15,10 @@ module Haml::Filters private - CROP_REGEX = /(?