Not initializing variable for looping if unused in loop
This commit is contained in:
parent
6cc8ec87b5
commit
6301a43d57
|
@ -48,7 +48,7 @@ class Admin::EmailController < Admin::AdminController
|
|||
|
||||
def delivery_settings
|
||||
action_mailer_settings
|
||||
.reject { |k, v| k == :password }
|
||||
.reject { |k, _| k == :password }
|
||||
.map { |k, v| { name: k, value: v }}
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ module Jobs
|
|||
|
||||
# Retrieve a header regardless of case sensitivity
|
||||
def self.header_for(head, name)
|
||||
header = head.headers.detect do |k, v|
|
||||
header = head.headers.detect do |k, _|
|
||||
name == k.downcase
|
||||
end
|
||||
header[1] if header
|
||||
|
@ -65,7 +65,7 @@ module Jobs
|
|||
return "" unless uri
|
||||
|
||||
result = ""
|
||||
streamer = lambda do |chunk, remaining_bytes, total_bytes|
|
||||
streamer = lambda do |chunk, _, _|
|
||||
result << chunk
|
||||
|
||||
# Using exceptions for flow control is really bad, but there really seems to
|
||||
|
|
|
@ -206,7 +206,7 @@ class Post < ActiveRecord::Base
|
|||
def has_host_spam?
|
||||
return false if acting_user.present? && acting_user.has_trust_level?(:basic)
|
||||
|
||||
total_hosts_usage.each do |host, count|
|
||||
total_hosts_usage.each do |_, count|
|
||||
return true if count >= SiteSetting.newuser_spam_host_threshold
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class PostAnalyzer
|
|||
def cook(*args)
|
||||
cooked = PrettyText.cook(*args)
|
||||
|
||||
result = Oneboxer.apply(cooked) do |url, elem|
|
||||
result = Oneboxer.apply(cooked) do |url, _|
|
||||
Oneboxer.invalidate(url) if args.last[:invalidate_oneboxes]
|
||||
Oneboxer.cached_onebox url
|
||||
end
|
||||
|
|
|
@ -105,8 +105,8 @@ class TopicLink < ActiveRecord::Base
|
|||
PrettyText
|
||||
.extract_links(post.cooked)
|
||||
.map{|u| [u, URI.parse(u.url)] rescue nil}
|
||||
.reject{|u,p| p.nil?}
|
||||
.uniq{|u,p| p}
|
||||
.reject{|_, p| p.nil?}
|
||||
.uniq{|_, p| p}
|
||||
.each do |link, parsed|
|
||||
begin
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ LEFT JOIN categories c on c.id = t.category_id
|
|||
# TODO there are conditions when this is called and user_id was already rolled back and is invalid.
|
||||
|
||||
# protect against dupes, for some reason this is failing in some cases
|
||||
action = self.find_by(hash.select { |k, v| required_parameters.include?(k) })
|
||||
action = self.find_by(hash.select { |k, _| required_parameters.include?(k) })
|
||||
return action if action
|
||||
|
||||
action = self.new(hash)
|
||||
|
|
|
@ -38,7 +38,7 @@ Discourse::Application.configure do
|
|||
|
||||
settings[:openssl_verify_mode] = GlobalSetting.smtp_openssl_verify_mode if GlobalSetting.smtp_openssl_verify_mode
|
||||
|
||||
config.action_mailer.smtp_settings = settings.reject{|x,y| y.nil?}
|
||||
config.action_mailer.smtp_settings = settings.reject{|_, y| y.nil?}
|
||||
else
|
||||
config.action_mailer.delivery_method = :sendmail
|
||||
config.action_mailer.sendmail_settings = {arguments: '-i'}
|
||||
|
|
|
@ -18,7 +18,7 @@ class AdminUserIndexQuery
|
|||
end
|
||||
|
||||
def filter_by_trust
|
||||
levels = trust_levels.map { |key, value| key.to_s }
|
||||
levels = trust_levels.map { |key, _| key.to_s }
|
||||
if levels.include?(params[:query])
|
||||
@query.where('trust_level = ?', trust_levels[params[:query].to_sym])
|
||||
end
|
||||
|
|
|
@ -63,7 +63,7 @@ class Autospec::Manager
|
|||
def ensure_all_specs_will_run
|
||||
puts "@@@@@@@@@@@@ ensure_all_specs_will_run" if @debug
|
||||
@runners.each do |runner|
|
||||
@queue << ['spec', 'spec', runner] unless @queue.any? { |f, s, r| s == "spec" && r == runner }
|
||||
@queue << ['spec', 'spec', runner] unless @queue.any? { |_, s, r| s == "spec" && r == runner }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -152,7 +152,7 @@ class Autospec::Manager
|
|||
end
|
||||
|
||||
Thread.start do
|
||||
Listen.to('.', options) do |modified, added, removed|
|
||||
Listen.to('.', options) do |modified, added, _|
|
||||
process_change([modified, added].flatten.compact)
|
||||
end
|
||||
end
|
||||
|
@ -187,7 +187,7 @@ class Autospec::Manager
|
|||
end
|
||||
end
|
||||
# special watcher for styles/templates
|
||||
Autospec::ReloadCss::WATCHERS.each do |k,v|
|
||||
Autospec::ReloadCss::WATCHERS.each do |k, _|
|
||||
matches = []
|
||||
matches << file if k.match(file)
|
||||
Autospec::ReloadCss.run_on_change(matches) if matches.present?
|
||||
|
@ -220,7 +220,7 @@ class Autospec::Manager
|
|||
puts "@@@@@@@@@@@@ #{@queue}" if @debug
|
||||
specs.each do |file, spec, runner|
|
||||
# make sure there's no other instance of this spec in the queue
|
||||
@queue.delete_if { |f, s, r| s.strip == spec.strip && r == runner }
|
||||
@queue.delete_if { |_, s, r| s.strip == spec.strip && r == runner }
|
||||
# deal with focused specs
|
||||
if @queue.first && @queue.first[0] == "focus"
|
||||
focus = @queue.shift
|
||||
|
|
|
@ -121,7 +121,7 @@ module Export
|
|||
end
|
||||
|
||||
def sidekiq_has_running_jobs?
|
||||
Sidekiq::Workers.new.each do |process_id, thread_id, worker|
|
||||
Sidekiq::Workers.new.each do |_, _, worker|
|
||||
payload = worker.try(:payload)
|
||||
return true if payload.try(:all_sites)
|
||||
return true if payload.try(:current_site_id) == @current_db
|
||||
|
|
|
@ -142,7 +142,7 @@ module Import
|
|||
end
|
||||
|
||||
def sidekiq_has_running_jobs?
|
||||
Sidekiq::Workers.new.each do |process_id, thread_id, worker|
|
||||
Sidekiq::Workers.new.each do |_, _, worker|
|
||||
payload = worker.try(:payload)
|
||||
return true if payload.try(:all_sites)
|
||||
return true if payload.try(:current_site_id) == @current_db
|
||||
|
|
|
@ -84,7 +84,7 @@ module Middleware
|
|||
status,headers,response = result
|
||||
|
||||
if status == 200 && cache_duration
|
||||
headers_stripped = headers.dup.delete_if{|k,v| ["Set-Cookie","X-MiniProfiler-Ids"].include? k}
|
||||
headers_stripped = headers.dup.delete_if{|k, _| ["Set-Cookie","X-MiniProfiler-Ids"].include? k}
|
||||
parts = []
|
||||
response.each do |part|
|
||||
parts << part
|
||||
|
|
|
@ -139,7 +139,7 @@ class PostDestroyer
|
|||
public_post_actions = PostAction.publics.where(post_id: @post.id)
|
||||
public_post_actions.each { |pa| pa.trash!(@user) }
|
||||
|
||||
f = PostActionType.public_types.map { |k,v| ["#{k}_count", 0] }
|
||||
f = PostActionType.public_types.map { |k, _| ["#{k}_count", 0] }
|
||||
Post.with_deleted.where(id: @post.id).update_all(Hash[*f.flatten])
|
||||
end
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ module SiteSettingExtension
|
|||
|
||||
def settings_hash
|
||||
result = {}
|
||||
@defaults.each do |s, v|
|
||||
@defaults.each do |s, _|
|
||||
result[s] = send(s).to_s
|
||||
end
|
||||
result
|
||||
|
@ -124,7 +124,7 @@ module SiteSettingExtension
|
|||
# Retrieve all settings
|
||||
def all_settings(include_hidden=false)
|
||||
@defaults
|
||||
.reject{|s, v| hidden_settings.include?(s) || include_hidden}
|
||||
.reject{|s, _| hidden_settings.include?(s) || include_hidden}
|
||||
.map do |s, v|
|
||||
value = send(s)
|
||||
type = types[get_data_type(s, value)]
|
||||
|
|
|
@ -23,7 +23,7 @@ def profile_allocations(name)
|
|||
initial_size = ObjectSpace.count_objects
|
||||
yield
|
||||
changes = ObjectSpace.count_objects
|
||||
changes.each do |k,v|
|
||||
changes.each do |k, _|
|
||||
changes[k] -= initial_size[k]
|
||||
end
|
||||
puts "#{name} changes"
|
||||
|
|
Loading…
Reference in New Issue