From 182c626226c50d82de99863ca0c04f0dd7d2d657 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 6 Dec 2017 14:23:12 +1300 Subject: [PATCH] Prefer if/unless modifier --- .rubocop_todo.yml | 8 -------- app/helpers/crops_helper.rb | 4 +--- config/initializers/geocoder.rb | 4 +--- lib/tasks/growstuff.rake | 4 +--- 4 files changed, 3 insertions(+), 17 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index bbde19b9d..d57bd5d99 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -108,14 +108,6 @@ Style/IdenticalConditionalBranches: Exclude: - 'app/controllers/follows_controller.rb' -# Cop supports --auto-correct. -# Configuration parameters: MaxLineLength. -Style/IfUnlessModifier: - Exclude: - - 'app/helpers/crops_helper.rb' - - 'config/initializers/geocoder.rb' - - 'lib/tasks/growstuff.rake' - # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. # SupportedStyles: line_count_dependent, lambda, literal diff --git a/app/helpers/crops_helper.rb b/app/helpers/crops_helper.rb index ea5003c3b..b99d687aa 100644 --- a/app/helpers/crops_helper.rb +++ b/app/helpers/crops_helper.rb @@ -8,9 +8,7 @@ module CropsHelper total_quantity += seed.quantity if seed.quantity end - if seeds.none? - return "You don't have any seeds of this crop." - end + return "You don't have any seeds of this crop." if seeds.none? if total_quantity != 0 "You have #{total_quantity} #{Seed.model_name.human(count: total_quantity)} of this crop." diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb index 67ce37799..afe41f574 100644 --- a/config/initializers/geocoder.rb +++ b/config/initializers/geocoder.rb @@ -11,6 +11,4 @@ Geocoder.configure( ) # This configuration takes precedence over environment/test.rb # Reported as https://github.com/alexreisner/geocoder/issues/509 -if Geocoder.config.lookup != :test - Geocoder.configure(lookup: :nominatim) -end +Geocoder.configure(lookup: :nominatim) if Geocoder.config.lookup != :test diff --git a/lib/tasks/growstuff.rake b/lib/tasks/growstuff.rake index 02827e126..03b2e3d0e 100644 --- a/lib/tasks/growstuff.rake +++ b/lib/tasks/growstuff.rake @@ -140,9 +140,7 @@ namespace :growstuff do puts "Giving each member an account record..." Member.all.each do |m| - unless m.account - Account.create(member_id: m.id) - end + Account.create(member_id: m.id) unless m.account end puts "Making Skud a staff account..."