DEV: Correct `Style/RedundantReturn` rubocop issues (#23052)

This commit is contained in:
Jarek Radosz 2023-08-10 02:03:38 +02:00 committed by GitHub
parent 7954d34448
commit 94649565ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 24 additions and 19 deletions

View File

@ -980,15 +980,19 @@ class Group < ActiveRecord::Base
end
def flair_type
return :icon if flair_icon.present?
return :image if flair_upload.present?
if flair_icon.present?
:icon
elsif flair_upload.present?
:image
end
end
def flair_url
return flair_icon if flair_type == :icon
return upload_cdn_path(flair_upload.url) if flair_type == :image
nil
if flair_type == :icon
flair_icon
elsif flair_type == :image
upload_cdn_path(flair_upload.url)
end
end
%i[muted regular tracking watching watching_first_post].each do |level|

View File

@ -1251,7 +1251,7 @@ class User < ActiveRecord::Base
end
def full_suspend_reason
return suspend_record.try(:details) if suspended?
suspend_record.try(:details) if suspended?
end
def suspend_reason

View File

@ -363,11 +363,11 @@ module ExternalUploadHelpers
end
def external_store_check
return render_404 if !Discourse.store.external?
render_404 if !Discourse.store.external?
end
def direct_s3_uploads_check
return render_404 if !SiteSetting.enable_direct_s3_uploads
render_404 if !SiteSetting.enable_direct_s3_uploads
end
def can_upload_external?

View File

@ -646,7 +646,7 @@ class Guardian
def method_name_for(action, obj)
method_name = :"can_#{action}_#{obj.class.name.underscore}?"
return method_name if respond_to?(method_name)
method_name if respond_to?(method_name)
end
def can_do?(action, obj)

View File

@ -191,7 +191,8 @@ module Onebox
return image_html if is_image?
return embedded_html if is_embedded?
return card_html if is_card?
return article_html if (has_text? || is_image_article?)
article_html if (has_text? || is_image_article?)
end
def is_card?

View File

@ -41,7 +41,7 @@ module PrettyText
return erb_name if File.file?("#{root}#{erb_name}")
erb_name = "#{filename}.js.erb"
return erb_name if File.file?("#{root}#{erb_name}")
erb_name if File.file?("#{root}#{erb_name}")
end
def self.apply_es6_file(ctx, root_path, part_name)

View File

@ -16,7 +16,7 @@ class QuoteComparer
# philosophy of "catch the obvious cases, leave moderation for the
# complicated ones"
def missing?
return true if @parent_post.blank?
@parent_post.blank?
end
def modified?

View File

@ -138,7 +138,7 @@ class Typepad < Thor
type = clean_type!(Regexp.last_match[1])
value = section.split("\n")[1..-1].join("\n")
value.strip!
return [type.to_sym, value] if value.present?
[type.to_sym, value] if value.present?
end
end

View File

@ -17,7 +17,7 @@ class CreateTitle
title = complete_words title
end
return title unless title.nil? || title.size < 20
title unless title.nil? || title.size < 20
end
private

View File

@ -18,12 +18,12 @@ RSpec.describe QuoteComparer do
expect(QuoteComparer.new(post.topic_id, nil, "test")).to be_missing
end
it "returns a falsey value for only missing text" do
expect(QuoteComparer.new(post.topic_id, post.post_number, nil).missing?).to be(nil)
it "returns false for only missing text" do
expect(QuoteComparer.new(post.topic_id, post.post_number, nil)).to_not be_missing
end
it "returns a falsey value for no missing topic and post" do
expect(QuoteComparer.new(post.topic_id, post.post_number, "test").missing?).to be(nil)
it "returns false for no missing topic and post" do
expect(QuoteComparer.new(post.topic_id, post.post_number, "test")).to_not be_missing
end
end