Enable Style/ZeroLengthPredicate

This commit is contained in:
gregoirenovel 2018-10-01 13:53:15 +02:00
parent 1b8e38253e
commit 1f4ef0074f
4 changed files with 4 additions and 4 deletions

View file

@ -1268,4 +1268,4 @@ Style/YodaCondition:
Enabled: false Enabled: false
Style/ZeroLengthPredicate: Style/ZeroLengthPredicate:
Enabled: false Enabled: true

View file

@ -20,7 +20,7 @@ module Carto
def convert_driver_result_to_full_address def convert_driver_result_to_full_address
result = JSON.parse(driver.call) result = JSON.parse(driver.call)
if result['features'].size == 0 if result['features'].empty?
Rails.logger.error "unable to find location for address #{@address}" Rails.logger.error "unable to find location for address #{@address}"
return [] return []
end end

View file

@ -19,7 +19,7 @@ module Carto
def convert_driver_result_to_point def convert_driver_result_to_point
result = JSON.parse(driver.call) result = JSON.parse(driver.call)
if result['features'].size == 0 if result['features'].empty?
Rails.logger.error "unable to find location for address #{@address}" Rails.logger.error "unable to find location for address #{@address}"
return nil return nil
end end

View file

@ -24,7 +24,7 @@ namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
def sanitize_name(name) # from https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/sanitized_file.rb#L323 def sanitize_name(name) # from https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/sanitized_file.rb#L323
name = name.gsub(/[^[:word:]\.\-\+]/,"_") name = name.gsub(/[^[:word:]\.\-\+]/,"_")
name = "_#{name}" if name.match?(/\A\.+\z/) name = "_#{name}" if name.match?(/\A\.+\z/)
name = "unnamed" if name.size == 0 name = "unnamed" if name.empty?
return name.mb_chars.to_s return name.mb_chars.to_s
end end