A platform for community discussion. Free, open, simple.
DEV: Correct `Style/RedundantReturn` rubocop issues (#23052)
Jarek Radosz94649565ced4
diff --git a/app/models/group.rb b/app/models/group.rbindex 6f34d571ed7..a9027401da7 100644--- a/app/models/group.rb+++ b/app/models/group.rb@@ -980,15 +980,19 @@ class Group < ActiveRecord::Baseenddef flair_type- return :icon if flair_icon.present?- return :image if flair_upload.present?+ if flair_icon.present?+ :icon+ elsif flair_upload.present?+ :image+ endenddef 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)+ endend%i[muted regular tracking watching watching_first_post].each do |level|diff --git a/app/models/user.rb b/app/models/user.rbindex 997d64e48ca..30fffc2770e 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -1251,7 +1251,7 @@ class User < ActiveRecord::Baseenddef full_suspend_reason- return suspend_record.try(:details) if suspended?+ suspend_record.try(:details) if suspended?enddef suspend_reasondiff --git a/lib/external_upload_helpers.rb b/lib/external_upload_helpers.rbindex 81cdfa5d91d..d1f9660b7a3 100644--- a/lib/external_upload_helpers.rb+++ b/lib/external_upload_helpers.rb@@ -363,11 +363,11 @@ module ExternalUploadHelpersenddef external_store_check- return render_404 if !Discourse.store.external?+ render_404 if !Discourse.store.external?enddef direct_s3_uploads_check- return render_404 if !SiteSetting.enable_direct_s3_uploads+ render_404 if !SiteSetting.enable_direct_s3_uploadsenddef can_upload_external?diff --git a/lib/guardian.rb b/lib/guardian.rbindex cfc9e345490..8e3add75cb2 100644--- a/lib/guardian.rb+++ b/lib/guardian.rb@@ -646,7 +646,7 @@ class Guardiandef 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)enddef can_do?(action, obj)diff --git a/lib/onebox/engine/allowlisted_generic_onebox.rb b/lib/onebox/engine/allowlisted_generic_onebox.rbindex 8120c4ce877..9f30d923de9 100644--- a/lib/onebox/engine/allowlisted_generic_onebox.rb+++ b/lib/onebox/engine/allowlisted_generic_onebox.rb@@ -191,7 +191,8 @@ module Oneboxreturn 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?)enddef is_card?diff --git a/lib/pretty_text.rb b/lib/pretty_text.rbindex 12289d2a1b6..7ac60602a7c 100644--- a/lib/pretty_text.rb+++ b/lib/pretty_text.rb@@ -41,7 +41,7 @@ module PrettyTextreturn 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}")enddef self.apply_es6_file(ctx, root_path, part_name)diff --git a/lib/quote_comparer.rb b/lib/quote_comparer.rbindex 55b7a8ceab2..c5e67f4d462 100644--- a/lib/quote_comparer.rb+++ b/lib/quote_comparer.rb@@ -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?enddef modified?diff --git a/lib/tasks/typepad.thor b/lib/tasks/typepad.thorindex bbef98037e6..4341fb04dc8 100644--- a/lib/tasks/typepad.thor+++ b/lib/tasks/typepad.thor@@ -138,7 +138,7 @@ class Typepad < Thortype = 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?endenddiff --git a/script/import_scripts/socialcast/create_title.rb b/script/import_scripts/socialcast/create_title.rbindex ea656fadb7e..5ed6e6259fc 100644--- a/script/import_scripts/socialcast/create_title.rb+++ b/script/import_scripts/socialcast/create_title.rb@@ -17,7 +17,7 @@ class CreateTitletitle = complete_words titleend- return title unless title.nil? || title.size < 20+ title unless title.nil? || title.size < 20endprivatediff --git a/spec/lib/quote_comparer_spec.rb b/spec/lib/quote_comparer_spec.rbindex ebc74d8d022..6f32ef7f3a7 100644--- a/spec/lib/quote_comparer_spec.rb+++ b/spec/lib/quote_comparer_spec.rb@@ -18,12 +18,12 @@ RSpec.describe QuoteComparer doexpect(QuoteComparer.new(post.topic_id, nil, "test")).to be_missingend- 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_missingend- 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_missingendend