This commit is contained in:
Daniel O'Connor
2022-11-08 00:25:29 +10:30
parent d1f754a288
commit 5dc3a7e2f7
3 changed files with 7 additions and 20 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -15,10 +15,10 @@ module Haml::Filters
private
CROP_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(crop\)/.freeze
MEMBER_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(member\)/.freeze
MEMBER_AT_REGEX = /(?<!\\)(@\w+)/.freeze
MEMBER_ESCAPE_AT_REGEX = /(?<!\\)\\(?=@\w+)/.freeze
CROP_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(crop\)/
MEMBER_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(member\)/
MEMBER_AT_REGEX = /(?<!\\)(@\w+)/
MEMBER_ESCAPE_AT_REGEX = /(?<!\\)\\(?=@\w+)/
HOST = Rails.application.config.host
def expand_crops!