DEV: Apply Rubocop redundant return style

This commit is contained in:
Penar Musaraj
2019-11-14 15:10:51 -05:00
parent be15abcf7f
commit 067696df8f
30 changed files with 45 additions and 45 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -855,7 +855,7 @@ SQL
return nil
end
return upload, real_filename
[upload, real_filename]
end
def post_process_posts

View File

@ -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

View File

@ -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)

View File

@ -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