Enable Lint/ShadowingOuterLocalVariable for Rubocop.

This commit is contained in:
Guo Xiang Tan
2018-09-04 10:16:21 +08:00
parent 2f5c21e28c
commit 8dc1463ab3
16 changed files with 70 additions and 59 deletions

View File

@@ -20,12 +20,12 @@ module ActiveSupport
uncached = "#{method_name}_without_cache"
alias_method uncached, method_name
define_method(method_name) do |*args|
define_method(method_name) do |*arguments|
# this avoids recursive locks
found = true
data = cache.fetch(args) { found = false }
data = cache.fetch(arguments) { found = false }
unless found
cache[args] = data = send(uncached, *args)
cache[arguments] = data = send(uncached, *arguments)
end
# so cache is never corrupted
data.dup
@@ -45,9 +45,10 @@ module ActiveSupport
args.each do |method_name|
orig = "#{method_name}_without_clear_memoize"
alias_method orig, method_name
define_method(method_name) do |*args|
define_method(method_name) do |*arguments|
ActiveSupport::Inflector.clear_memoize!
send(orig, *args)
send(orig, *arguments)
end
end
end

View File

@@ -41,9 +41,11 @@ module I18n
I18n.backend.load_translations(I18n.load_path.grep(/\.rb$/))
# load plural rules from plugins
DiscoursePluginRegistry.locales.each do |locale, options|
DiscoursePluginRegistry.locales.each do |plugin_locale, options|
if options[:plural]
I18n.backend.store_translations(locale, i18n: { plural: options[:plural] })
I18n.backend.store_translations(plugin_locale,
i18n: { plural: options[:plural] }
)
end
end
end