chore: rubocop
chore: fix api test conventions chore: rubocop -A spec/ chore: more rubocop -A fix failing test rubocop fixes removes helper methods that are in my opinion dead code more rubocop fixes rubocop -a --auto-gen-config
This commit is contained in:
parent
f6fb804bbe
commit
fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions
|
|
@ -10,7 +10,7 @@ module CustomFields
|
|||
end
|
||||
|
||||
after_save do
|
||||
self.settings.custom_fields = custom_fields if custom_fields
|
||||
settings.custom_fields = custom_fields if custom_fields
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ module FindEachWithOrder
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
class_methods do
|
||||
def find_each_with_order(options = {})
|
||||
def find_each_with_order(options = {}, &block)
|
||||
find_in_batches_with_order(options) do |records|
|
||||
records.each { |record| yield record }
|
||||
records.each(&block)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ module LocalizeInput
|
|||
return input unless input.is_a? String
|
||||
|
||||
Rails.logger.debug { "Input: #{input.inspect}" }
|
||||
separator = I18n.t("separator", scope: "number.format")
|
||||
delimiter = I18n.t("delimiter", scope: "number.format")
|
||||
input.gsub!(delimiter, "") if input.match(/\d+#{Regexp.escape(delimiter)}+\d+#{Regexp.escape(separator)}+\d+/) # Remove delimiter
|
||||
input.gsub!(separator, ".") # Replace separator with db compatible character
|
||||
separator = I18n.t('separator', scope: 'number.format')
|
||||
delimiter = I18n.t('delimiter', scope: 'number.format')
|
||||
input.gsub!(delimiter, '') if input.match(/\d+#{Regexp.escape(delimiter)}+\d+#{Regexp.escape(separator)}+\d+/) # Remove delimiter
|
||||
input.gsub!(separator, '.') # Replace separator with db compatible character
|
||||
input
|
||||
rescue
|
||||
rescue StandardError
|
||||
Rails.logger.warn "Can't localize input: #{input}"
|
||||
input
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ module MarkAsDeletedWithName
|
|||
|
||||
def mark_as_deleted
|
||||
# get maximum length of name
|
||||
max_length = 100000
|
||||
max_length = 100_000
|
||||
if lenval = self.class.validators_on(:name).detect { |v| v.is_a?(ActiveModel::Validations::LengthValidator) }
|
||||
max_length = lenval.options[:maximum]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ module PriceCalculation
|
|||
private
|
||||
|
||||
def add_percent(value, percent)
|
||||
(value * (percent * 0.01 + 1)).round(2)
|
||||
(value * ((percent * 0.01) + 1)).round(2)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue