Fix rubocop issues

This commit is contained in:
Luis Ramos
2020-06-22 16:36:40 +01:00
parent 1e5975c6e2
commit 0ba1642bd2
6 changed files with 13 additions and 24 deletions

View File

@@ -112,17 +112,6 @@ Naming/MemoizedInstanceVariableName:
- 'app/mailers/producer_mailer.rb'
- 'lib/open_food_network/address_finder.rb'
# Offense count: 6
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
Naming/MethodParameterName:
Exclude:
- 'app/helpers/spree/base_helper_decorator.rb'
- 'lib/open_food_network/reports/bulk_coop_report.rb'
- 'lib/open_food_network/xero_invoices_report.rb'
- 'spec/lib/open_food_network/reports/report_spec.rb'
- 'spec/mailers/producer_mailer_spec.rb'
# Offense count: 19
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
# NamePrefix: is_, has_, have_

View File

@@ -2,8 +2,8 @@ module Spree
module BaseHelper
# human readable list of variant options
# Override: Do not show out of stock text
def variant_options(v, _options = {})
v.options_text
def variant_options(variant, _options = {})
variant.options_text
end
# Overriden to eager-load :states

View File

@@ -54,12 +54,12 @@ module OpenFoodNetwork::Reports
end
end
def scaled_final_weight_volume(li)
(li.final_weight_volume || 0) / (li.product.variant_unit_scale || 1)
def scaled_final_weight_volume(line_item)
(line_item.final_weight_volume || 0) / (line_item.product.variant_unit_scale || 1)
end
def scaled_unit_value(v)
(v.unit_value || 0) / (v.product.variant_unit_scale || 1)
def scaled_unit_value(variant)
(variant.unit_value || 0) / (variant.product.variant_unit_scale || 1)
end
end
end

View File

@@ -175,8 +175,8 @@ module OpenFoodNetwork
adjustment.adjustable.is_a?(Spree::Order) ? adjustment.adjustable : nil
end
def invoice_number_for(order, i)
@opts[:initial_invoice_number] ? @opts[:initial_invoice_number].to_i + i : order.number
def invoice_number_for(order, idx)
@opts[:initial_invoice_number] ? @opts[:initial_invoice_number].to_i + idx : order.number
end
def total_untaxable_products(order)

View File

@@ -34,13 +34,13 @@ module OpenFoodNetwork::Reports
class HelperReport < Report
columns do
column { |o| my_helper(o) }
column { |obj| my_helper(obj) }
end
private
def self.my_helper(o)
o[:one]
def self.my_helper(obj)
obj[:one]
end
end

View File

@@ -116,8 +116,8 @@ describe ProducerMailer, type: :mailer do
private
def body_lines_including(mail, s)
mail.body.to_s.lines.select { |line| line.include? s }
def body_lines_including(mail, str)
mail.body.to_s.lines.select { |line| line.include? str }
end
def body_as_html(mail)