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