DEV: Apply Rubocop redundant return style
This commit is contained in:
parent
be15abcf7f
commit
067696df8f
|
@ -320,7 +320,7 @@ class SessionController < ApplicationController
|
|||
|
||||
def invalid_security_key(user, err_message = nil)
|
||||
stage_webauthn_security_key_challenge(user) if !params[:security_key_credential]
|
||||
return render json: failed_json.merge(
|
||||
render json: failed_json.merge(
|
||||
error: err_message || I18n.t("login.invalid_security_key"),
|
||||
reason: "invalid_security_key",
|
||||
backup_enabled: user.backup_codes_enabled?
|
||||
|
@ -403,7 +403,7 @@ class SessionController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
return render json: { error: I18n.t('email_login.invalid_token') }
|
||||
render json: { error: I18n.t('email_login.invalid_token') }
|
||||
rescue ::Webauthn::SecurityKeyError => err
|
||||
invalid_security_key(user, err.message)
|
||||
end
|
||||
|
|
|
@ -84,7 +84,7 @@ module Jobs
|
|||
end
|
||||
end
|
||||
|
||||
return topic
|
||||
topic
|
||||
end
|
||||
|
||||
def send_invite(invite)
|
||||
|
|
|
@ -228,7 +228,7 @@ class Reviewable < ActiveRecord::Base
|
|||
priority ||= SiteSetting.reviewable_default_visibility
|
||||
id = Reviewable.priorities[priority.to_sym]
|
||||
return 0.0 if id.nil?
|
||||
return PluginStore.get('reviewables', "priority_#{id}").to_f
|
||||
PluginStore.get('reviewables', "priority_#{id}").to_f
|
||||
end
|
||||
|
||||
def history
|
||||
|
|
|
@ -104,7 +104,7 @@ class SearchLog < ActiveRecord::Base
|
|||
details << { x: Date.parse(record['date'].to_s), y: record['count'] }
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
type: "search_log_term",
|
||||
title: I18n.t("search_logs.graph_title"),
|
||||
start_date: start_of(period),
|
||||
|
|
|
@ -67,7 +67,7 @@ class UserApiKey < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.invalid_auth_redirect?(auth_redirect)
|
||||
return SiteSetting.allowed_user_api_auth_redirects
|
||||
SiteSetting.allowed_user_api_auth_redirects
|
||||
.split('|')
|
||||
.none? { |u| WildcardUrlChecker.check_url(u, auth_redirect) }
|
||||
end
|
||||
|
|
|
@ -115,7 +115,7 @@ class ReviewableSerializer < ApplicationSerializer
|
|||
end
|
||||
|
||||
def topic_url
|
||||
return object.topic&.url
|
||||
object.topic&.url
|
||||
end
|
||||
|
||||
def include_topic_url?
|
||||
|
|
|
@ -249,7 +249,7 @@ class PostAlerter
|
|||
end
|
||||
|
||||
def should_notify_edit?(notification, opts)
|
||||
return notification.data_hash["display_username"] != opts[:display_username]
|
||||
notification.data_hash["display_username"] != opts[:display_username]
|
||||
end
|
||||
|
||||
def should_notify_like?(user, notification)
|
||||
|
|
|
@ -36,6 +36,6 @@ class SiteSettingsTask
|
|||
counts[:not_found] += 1
|
||||
end
|
||||
end
|
||||
return log, counts
|
||||
[log, counts]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ class ThemesInstallTask
|
|||
end
|
||||
end
|
||||
|
||||
return log, counts
|
||||
[log, counts]
|
||||
end
|
||||
|
||||
attr_reader :url, :options
|
||||
|
|
|
@ -38,7 +38,7 @@ class Auth::GithubAuthenticator < Auth::Authenticator
|
|||
|
||||
def valid?()
|
||||
@validator.validate_each(self, :email, @email)
|
||||
return errors.blank?
|
||||
errors.blank?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -437,7 +437,7 @@ class CookedPostProcessor
|
|||
def get_filename(upload, src)
|
||||
return File.basename(src) unless upload
|
||||
return upload.original_filename unless upload.original_filename =~ /^blob(\.png)?$/i
|
||||
return I18n.t("upload.pasted_image_filename")
|
||||
I18n.t("upload.pasted_image_filename")
|
||||
end
|
||||
|
||||
def create_node(tag_name, klass)
|
||||
|
|
|
@ -370,7 +370,7 @@ module DiscourseTagging
|
|||
tag_names.uniq!
|
||||
end
|
||||
|
||||
return opts[:unlimited] ? tag_names : tag_names[0...SiteSetting.max_tags_per_topic]
|
||||
opts[:unlimited] ? tag_names : tag_names[0...SiteSetting.max_tags_per_topic]
|
||||
end
|
||||
|
||||
def self.add_or_create_tags_by_name(taggable, tag_names_arg, opts = {})
|
||||
|
|
|
@ -55,7 +55,7 @@ module FileStore
|
|||
path, etag = @s3_helper.upload(file, path, options)
|
||||
|
||||
# return the upload url and etag
|
||||
return File.join(absolute_base_url, path), etag
|
||||
[File.join(absolute_base_url, path), etag]
|
||||
end
|
||||
|
||||
def remove_file(url, path)
|
||||
|
|
|
@ -14,7 +14,7 @@ module ActiveRecord
|
|||
module ClassMethods
|
||||
# this is for Rails 5
|
||||
def enforce_raw_sql_whitelist(*args)
|
||||
return
|
||||
nil
|
||||
end
|
||||
|
||||
BLANK_ARRAY = [].freeze
|
||||
|
@ -23,7 +23,7 @@ module ActiveRecord
|
|||
def disallow_raw_sql!(args, permit: nil)
|
||||
# we may consider moving to https://github.com/rails/rails/pull/33330
|
||||
# once all frozen string hints are in place
|
||||
return BLANK_ARRAY
|
||||
BLANK_ARRAY
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -120,7 +120,7 @@ class Guardian
|
|||
def can_see?(obj)
|
||||
if obj
|
||||
see_method = method_name_for :see, obj
|
||||
return (see_method ? public_send(see_method, obj) : true)
|
||||
(see_method ? public_send(see_method, obj) : true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -539,7 +539,7 @@ class Guardian
|
|||
def can_do?(action, obj)
|
||||
if obj && authenticated?
|
||||
action_method = method_name_for action, obj
|
||||
return (action_method ? public_send(action_method, obj) : true)
|
||||
(action_method ? public_send(action_method, obj) : true)
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ class IntroductionUpdater
|
|||
protected
|
||||
|
||||
def summary_from_post(post)
|
||||
return post ? post.raw.split("\n").first : nil
|
||||
post ? post.raw.split("\n").first : nil
|
||||
end
|
||||
|
||||
def find_welcome_post
|
||||
|
|
|
@ -103,7 +103,7 @@ class Promotion
|
|||
return false if (stat.time_read / 60) < SiteSetting.tl1_requires_time_spent_mins
|
||||
return false if ((Time.now - user.created_at) / 60) < SiteSetting.tl1_requires_time_spent_mins
|
||||
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
def self.tl3_met?(user)
|
||||
|
|
|
@ -67,6 +67,6 @@ module RetrieveTitle
|
|||
title = extract_title(current)
|
||||
throw :done if title || max_size < current.length
|
||||
end
|
||||
return title
|
||||
title
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,7 +47,7 @@ class S3Helper
|
|||
end
|
||||
end
|
||||
|
||||
return path, etag.gsub('"', '')
|
||||
[path, etag.gsub('"', '')]
|
||||
end
|
||||
|
||||
def remove(s3_filename, copy_to_tombstone = false)
|
||||
|
|
|
@ -27,7 +27,7 @@ class Unread
|
|||
|
||||
new_posts = (highest_post_number - @topic_user.highest_seen_post_number)
|
||||
new_posts = 0 if new_posts < 0
|
||||
return new_posts
|
||||
new_posts
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -778,7 +778,7 @@ class BulkImport::Base
|
|||
|
||||
def normalize_charset(text)
|
||||
return text if @encoding == Encoding::UTF_8
|
||||
return text && text.encode(@encoding).force_encoding(Encoding::UTF_8)
|
||||
text && text.encode(@encoding).force_encoding(Encoding::UTF_8)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -882,7 +882,7 @@ class ImportScripts::DiscuzX < ImportScripts::Base
|
|||
return nil
|
||||
end
|
||||
|
||||
return upload, real_filename
|
||||
[upload, real_filename]
|
||||
end
|
||||
|
||||
# find the uploaded file and real name from the db
|
||||
|
@ -938,12 +938,12 @@ class ImportScripts::DiscuzX < ImportScripts::Base
|
|||
return nil
|
||||
end
|
||||
|
||||
return upload, real_filename
|
||||
[upload, real_filename]
|
||||
rescue Mysql2::Error => e
|
||||
puts "SQL Error"
|
||||
puts e.message
|
||||
puts sql
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
def first_exists(*items)
|
||||
|
|
|
@ -196,7 +196,7 @@ class DisqusSAX < Nokogiri::XML::SAX::Document
|
|||
end
|
||||
|
||||
def inside?(*params)
|
||||
return !params.find { |p| !@inside[p] }
|
||||
!params.find { |p| !@inside[p] }
|
||||
end
|
||||
|
||||
def normalize
|
||||
|
|
|
@ -457,7 +457,7 @@ class ImportScripts::FMGP < ImportScripts::Base
|
|||
end
|
||||
# FIXME: import G+ "+1" as "like" if F+MG+E feature request implemented
|
||||
|
||||
return mapped
|
||||
mapped
|
||||
end
|
||||
|
||||
def parse_title(post, created_at)
|
||||
|
@ -524,7 +524,7 @@ class ImportScripts::FMGP < ImportScripts::Base
|
|||
words << fragment[1]
|
||||
end
|
||||
end
|
||||
return words
|
||||
words
|
||||
end
|
||||
|
||||
def formatted_message(post)
|
||||
|
@ -588,10 +588,10 @@ class ImportScripts::FMGP < ImportScripts::Base
|
|||
return text
|
||||
end
|
||||
elsif fragment[0] == 1
|
||||
return "\n"
|
||||
"\n"
|
||||
elsif fragment[0] == 2
|
||||
urls_seen.add(fragment[2])
|
||||
return formatted_link_text(fragment[2], fragment[1])
|
||||
formatted_link_text(fragment[2], fragment[1])
|
||||
elsif fragment[0] == 3
|
||||
# reference to a user
|
||||
if @usermap.include?(fragment[2].to_s)
|
||||
|
@ -619,7 +619,7 @@ class ImportScripts::FMGP < ImportScripts::Base
|
|||
end
|
||||
elsif fragment[0] == 4
|
||||
# hashtag, the octothorpe is included
|
||||
return fragment[1]
|
||||
fragment[1]
|
||||
else
|
||||
raise RuntimeError.new("message code #{fragment[0]} not recognized!")
|
||||
end
|
||||
|
|
|
@ -855,7 +855,7 @@ SQL
|
|||
return nil
|
||||
end
|
||||
|
||||
return upload, real_filename
|
||||
[upload, real_filename]
|
||||
end
|
||||
|
||||
def post_process_posts
|
||||
|
|
|
@ -181,7 +181,7 @@ class ImportScripts::MyBB < ImportScripts::Base
|
|||
if count > 5
|
||||
puts "Warning: probably incorrect quote in post #{post_id}"
|
||||
end
|
||||
return username
|
||||
username
|
||||
end
|
||||
|
||||
# Take an original post id and return the migrated topic id and post number for it
|
||||
|
|
|
@ -244,7 +244,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
|||
raise "Attachment for post #{post[:id]} failed: #{attachment[:filename]}" unless path.present?
|
||||
upload = create_upload(post[:user_id], path, attachment[:filename])
|
||||
raise "Attachment for post #{post[:id]} failed: #{upload.errors.full_messages.join(', ')}" unless upload.persisted?
|
||||
return upload
|
||||
upload
|
||||
rescue SystemCallError => err
|
||||
raise "Attachment for post #{post[:id]} failed: #{err.message}"
|
||||
end
|
||||
|
@ -280,7 +280,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
|||
return __query(db, sql).to_a if opts[:as] == :array
|
||||
return __query(db, sql, as: :array).first[0] if opts[:as] == :single
|
||||
return __query(db, sql, stream: true).each(&block) if block_given?
|
||||
return __query(db, sql, stream: true)
|
||||
__query(db, sql, stream: true)
|
||||
end
|
||||
|
||||
def __query(db, sql, **opts)
|
||||
|
@ -345,7 +345,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
|||
end
|
||||
end
|
||||
|
||||
return opts[:ignore_quotes] ? body : convert_quotes(body)
|
||||
opts[:ignore_quotes] ? body : convert_quotes(body)
|
||||
end
|
||||
|
||||
def get_upload_markdown(upload)
|
||||
|
|
|
@ -359,12 +359,12 @@ class ImportScripts::VBulletin < ImportScripts::Base
|
|||
return nil
|
||||
end
|
||||
|
||||
return upload, real_filename
|
||||
[upload, real_filename]
|
||||
rescue Mysql2::Error => e
|
||||
puts "SQL Error"
|
||||
puts e.message
|
||||
puts sql
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
def import_attachments
|
||||
|
|
|
@ -85,7 +85,7 @@ def consume_mapping(map_lines, totals)
|
|||
Mapping::FIELDS.each do |field|
|
||||
totals[field] += m.public_send(field)
|
||||
end
|
||||
return m
|
||||
m
|
||||
end
|
||||
|
||||
def create_memstats_not_available(totals)
|
||||
|
@ -136,7 +136,7 @@ def get_commandline(pid)
|
|||
loop { break if commandline.shift == "-jar" }
|
||||
return "[java] #{commandline.shift}"
|
||||
end
|
||||
return commandline.join(' ')
|
||||
commandline.join(' ')
|
||||
end
|
||||
|
||||
if ARGV.include? '--yaml'
|
||||
|
|
|
@ -267,7 +267,7 @@ HTML
|
|||
def transpile(html)
|
||||
f = ThemeField.create!(target_id: Theme.targets[:mobile], theme_id: 1, name: "after_header", value: html)
|
||||
f.ensure_baked!
|
||||
return f.value_baked, f.javascript_cache
|
||||
[f.value_baked, f.javascript_cache]
|
||||
end
|
||||
|
||||
it "transpiles ES6 code" do
|
||||
|
|
Loading…
Reference in New Issue