mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:57:25 +08:00
DEV: Fix Lint/ShadowingOuterLocalVariable
(#32036)
unblocks a rubocop update
This commit is contained in:
@ -18,9 +18,7 @@ module CategoryHashtag
|
||||
slug_path = split_slug_path(slug)
|
||||
next if slug_path.blank?
|
||||
|
||||
if SiteSetting.slug_generation_method == "encoded"
|
||||
slug_path.map! { |slug| CGI.escape(slug) }
|
||||
end
|
||||
slug_path.map! { CGI.escape(_1) } if SiteSetting.slug_generation_method == "encoded"
|
||||
parent_slug, child_slug = slug_path.last(2)
|
||||
|
||||
# Category slugs can be in the parent:child format, if there
|
||||
|
@ -68,7 +68,7 @@ module Middleware
|
||||
body = response.body
|
||||
body = [body] if String === body
|
||||
rack_response = [response.status, response.headers, body]
|
||||
app = lambda { |env| rack_response }
|
||||
app = lambda { |_| rack_response }
|
||||
EXCEPTION_RESPONSE_MIDDLEWARES.each { |middleware| app = middleware.new(app) }
|
||||
return app.call(env)
|
||||
end
|
||||
|
@ -324,7 +324,7 @@ module SvgSprite
|
||||
cache
|
||||
.defer_get_set_bulk(
|
||||
Theme.transform_ids(theme_id),
|
||||
lambda { |theme_id| "theme_svg_sprites_#{theme_id}" },
|
||||
lambda { |_theme_id| "theme_svg_sprites_#{_theme_id}" },
|
||||
) do |theme_ids|
|
||||
theme_field_uploads =
|
||||
ThemeField.where(
|
||||
@ -344,12 +344,15 @@ module SvgSprite
|
||||
end
|
||||
|
||||
theme_sprites
|
||||
.map do |(theme_id, upload_id, sprite)|
|
||||
.map do |(_theme_id, upload_id, sprite)|
|
||||
begin
|
||||
[theme_id, symbols_for("theme_#{theme_id}_#{upload_id}.svg", sprite, strict: false)]
|
||||
[
|
||||
_theme_id,
|
||||
symbols_for("theme_#{_theme_id}_#{upload_id}.svg", sprite, strict: false),
|
||||
]
|
||||
rescue => e
|
||||
Rails.logger.warn(
|
||||
"Bad XML in custom sprite in theme with ID=#{theme_id}. Error info: #{e.inspect}",
|
||||
"Bad XML in custom sprite in theme with ID=#{_theme_id}. Error info: #{e.inspect}",
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -325,7 +325,6 @@ task "plugin:create", [:name] do |t, args|
|
||||
|
||||
abort("Plugin directory, " + plugin_path + ", already exists.") if File.directory?(plugin_path)
|
||||
|
||||
failures = []
|
||||
repo = "https://github.com/discourse/discourse-plugin-skeleton"
|
||||
begin
|
||||
attempts ||= 1
|
||||
@ -333,7 +332,7 @@ task "plugin:create", [:name] do |t, args|
|
||||
system("git clone --quiet #{repo} #{plugin_path}", exception: true)
|
||||
rescue StandardError
|
||||
if attempts == 3
|
||||
failures << repo
|
||||
STDOUT.puts "Failed to clone #{repo}"
|
||||
abort
|
||||
end
|
||||
|
||||
@ -341,7 +340,6 @@ task "plugin:create", [:name] do |t, args|
|
||||
attempts += 1
|
||||
retry
|
||||
end
|
||||
failures.each { |repo| STDOUT.puts "Failed to clone #{repo}" } if failures.present?
|
||||
|
||||
Dir.chdir(plugin_path) do # rubocop:disable Discourse/NoChdir
|
||||
puts "Initializing git repository..."
|
||||
|
@ -83,8 +83,7 @@ class TopicsFilter
|
||||
when "views-max"
|
||||
filter_by_number_of_views(max: filter_values)
|
||||
else
|
||||
if custom_filter =
|
||||
DiscoursePluginRegistry.custom_filter_mappings.find { |hash| hash.key?(filter) }
|
||||
if custom_filter = DiscoursePluginRegistry.custom_filter_mappings.find { _1.key?(filter) }
|
||||
@scope = custom_filter[filter].call(@scope, filter_values, @guardian) || @scope
|
||||
end
|
||||
end
|
||||
|
@ -73,14 +73,14 @@ module DiscourseAutomation
|
||||
end
|
||||
end
|
||||
|
||||
def placeholder(name = nil, triggerable: nil, &block)
|
||||
def placeholder(placeholder_name = nil, triggerable: nil, &block)
|
||||
if block_given?
|
||||
result = yield(@automation.serialized_fields, @automation)
|
||||
Array(result).each do |name|
|
||||
@placeholders << { name: name.to_sym, triggerable: triggerable&.to_sym }
|
||||
end
|
||||
elsif name
|
||||
@placeholders << { name: name.to_sym, triggerable: triggerable&.to_sym }
|
||||
elsif placeholder_name
|
||||
@placeholders << { name: placeholder_name.to_sym, triggerable: triggerable&.to_sym }
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user