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
|
|
@ -2,6 +2,7 @@
|
|||
# have it shown in all other languages too
|
||||
I18n.available_locales.each do |locale|
|
||||
unless locale == I18n.default_locale
|
||||
I18n.backend.store_translations(locale, number: { currency: { format: { unit: nil } } })
|
||||
I18n.backend.store_translations(locale,
|
||||
number: { currency: { format: { unit: nil } } })
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ Doorkeeper.configure do
|
|||
# http://tools.ietf.org/html/rfc6819#section-4.4.2
|
||||
# http://tools.ietf.org/html/rfc6819#section-4.4.3
|
||||
#
|
||||
grant_flows %w(authorization_code implicit password)
|
||||
grant_flows %w[authorization_code implicit password]
|
||||
|
||||
# Under some circumstances you might want to have applications auto-approved,
|
||||
# so that the user skips the authorization step.
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ ExceptionNotification.configure do |config|
|
|||
|
||||
# Adds a condition to decide when an exception must be ignored or not.
|
||||
# The ignore_if method can be invoked multiple times to add extra conditions.
|
||||
config.ignore_if do |exception, options|
|
||||
config.ignore_if do |_exception, _options|
|
||||
Rails.env.development? || Rails.env.test?
|
||||
end
|
||||
|
||||
|
|
@ -23,9 +23,9 @@ ExceptionNotification.configure do |config|
|
|||
# Email notifier sends notifications by email.
|
||||
if notification = FoodsoftConfig[:notification]
|
||||
config.add_notifier :email, {
|
||||
:email_prefix => notification[:email_prefix],
|
||||
:sender_address => notification[:sender_address],
|
||||
:exception_recipients => notification[:error_recipients],
|
||||
email_prefix: notification[:email_prefix],
|
||||
sender_address: notification[:sender_address],
|
||||
exception_recipients: notification[:error_recipients]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
class String
|
||||
# remove comma from decimal inputs
|
||||
def self.delocalized_decimal(string)
|
||||
if !string.blank? and string.is_a?(String)
|
||||
if string.present? and string.is_a?(String)
|
||||
BigDecimal(string.sub(',', '.'))
|
||||
else
|
||||
string
|
||||
|
|
@ -13,6 +13,6 @@ end
|
|||
class Array
|
||||
def cumulative_sum
|
||||
csum = 0
|
||||
self.map { |val| csum += val }
|
||||
map { |val| csum += val }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
|
||||
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
|
||||
# notations and behaviors.
|
||||
Rails.application.config.filter_parameters += [
|
||||
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
||||
Rails.application.config.filter_parameters += %i[
|
||||
passw secret token _key crypt salt certificate otp ssn
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# Increase key space for post request.
|
||||
# Warning, this is dangerous. See http://stackoverflow.com/questions/12243694/getting-error-exceeded-available-parameter-key-space
|
||||
Rack::Utils.key_space_limit = 262144
|
||||
Rack::Utils.key_space_limit = 262_144
|
||||
|
|
|
|||
|
|
@ -2,28 +2,28 @@
|
|||
|
||||
if defined? RubyUnits
|
||||
RubyUnits::Unit.redefine!('liter') do |unit|
|
||||
unit.aliases += %w{ltr}
|
||||
unit.aliases += %w[ltr]
|
||||
end
|
||||
|
||||
RubyUnits::Unit.redefine!('kilogram') do |unit|
|
||||
unit.aliases += %w{KG}
|
||||
unit.aliases += %w[KG]
|
||||
end
|
||||
|
||||
RubyUnits::Unit.redefine!('gram') do |unit|
|
||||
unit.aliases += %w{gr}
|
||||
unit.aliases += %w[gr]
|
||||
end
|
||||
|
||||
RubyUnits::Unit.define('piece') do |unit|
|
||||
unit.definition = RubyUnits::Unit.new('1 each')
|
||||
unit.aliases = %w{pc pcs piece pieces} # locale: en
|
||||
unit.aliases += %w{st stuk stuks} # locale: nl
|
||||
unit.aliases = %w[pc pcs piece pieces] # locale: en
|
||||
unit.aliases += %w[st stuk stuks] # locale: nl
|
||||
unit.kind = :counting
|
||||
end
|
||||
|
||||
RubyUnits::Unit.define('bag') do |unit|
|
||||
unit.definition = RubyUnits::Unit.new('1 each')
|
||||
unit.aliases = %w{bag bags blt sachet sachets} # locale: en
|
||||
unit.aliases += %w{zak zakken zakje zakjes} # locale: nl
|
||||
unit.aliases = %w[bag bags blt sachet sachets] # locale: en
|
||||
unit.aliases += %w[zak zakken zakje zakjes] # locale: nl
|
||||
unit.kind = :counting
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ Foodsoft::Application.config.secret_key_base = begin
|
|||
if (token = ENV.fetch('SECRET_KEY_BASE', nil)).present?
|
||||
token
|
||||
elsif Rails.env.production? || Rails.env.staging?
|
||||
raise "You must set SECRET_KEY_BASE"
|
||||
raise 'You must set SECRET_KEY_BASE'
|
||||
elsif Rails.env.test?
|
||||
SecureRandom.hex(30) # doesn't really matter
|
||||
else
|
||||
sf = Rails.root.join('tmp', 'secret_key_base')
|
||||
if File.exists?(sf)
|
||||
if File.exist?(sf)
|
||||
File.read(sf)
|
||||
else
|
||||
puts "=> Generating initial SECRET_KEY_BASE in #{sf}"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
module ActionDispatch
|
||||
module Session
|
||||
class SlugCookieStore < CookieStore
|
||||
alias_method :orig_set_cookie, :set_cookie
|
||||
alias orig_set_cookie set_cookie
|
||||
|
||||
def set_cookie(request, session_id, cookie)
|
||||
if script_name = FoodsoftConfig[:script_name]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ SimpleForm.setup do |config|
|
|||
end
|
||||
end
|
||||
|
||||
config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
||||
config.wrappers :prepend, tag: 'div', class: 'control-group', error_class: 'error' do |b|
|
||||
b.use :html5
|
||||
b.use :placeholder
|
||||
b.use :label
|
||||
|
|
@ -24,7 +24,7 @@ SimpleForm.setup do |config|
|
|||
end
|
||||
end
|
||||
|
||||
config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
||||
config.wrappers :append, tag: 'div', class: 'control-group', error_class: 'error' do |b|
|
||||
b.use :html5
|
||||
b.use :placeholder
|
||||
b.use :label
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# config/initializers/zeitwerk.rb
|
||||
ActiveSupport::Dependencies
|
||||
.autoload_paths
|
||||
.delete("#{Rails.root}/app/controllers/concerns")
|
||||
|
||||
.delete(Rails.root.join('app/controllers/concerns').to_s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue