Update rubocop and fix offences.

Update rubocop and fix offences.

diff --git a/lib/onebox/engine/pastebin_onebox.rb b/lib/onebox/engine/pastebin_onebox.rb
index 5bfa071..2efb21a 100644
--- a/lib/onebox/engine/pastebin_onebox.rb
+++ b/lib/onebox/engine/pastebin_onebox.rb
@@ -52,7 +52,7 @@ module Onebox
 
         nil
       rescue
-        return nil
+        nil
       end
     end
   end
diff --git a/lib/onebox/engine/pdf_onebox.rb b/lib/onebox/engine/pdf_onebox.rb
index a70ea90..8e8c09a 100644
--- a/lib/onebox/engine/pdf_onebox.rb
+++ b/lib/onebox/engine/pdf_onebox.rb
@@ -25,7 +25,7 @@ module Onebox
       def get_pdf_info
         uri = URI.parse(@url)
         size = Onebox::Helpers.fetch_content_length(@url)
-        return {
+        {
           filesize: size ? Onebox::Helpers.pretty_filesize(size.to_i) : nil,
           name: File.basename(uri.path)
         }
diff --git a/lib/onebox/engine/wechat_mp_onebox.rb b/lib/onebox/engine/wechat_mp_onebox.rb
index 0e77340..0ac9ec5 100644
--- a/lib/onebox/engine/wechat_mp_onebox.rb
+++ b/lib/onebox/engine/wechat_mp_onebox.rb
@@ -26,7 +26,7 @@ module Onebox
       def extract_script_value(var_name)
         if (script_elem = raw.css("script").select { |script| script.inner_text.include? "var #{var_name} = " }) && script_elem.any?
           e = Nokogiri::HTML(script_elem[0].inner_text.match(/var\s+#{Regexp.quote(var_name)}\s+=\s+"(.*?)";/)[1])
-          return CGI::unescapeHTML(e.text.scan(/(?:\\x([a-f0-9]{2}))|(.)/i).map { |x| x[0] ? [x[0].to_i(16)].pack('U') : x[1] }.join)
+          CGI::unescapeHTML(e.text.scan(/(?:\\x([a-f0-9]{2}))|(.)/i).map { |x| x[0] ? [x[0].to_i(16)].pack('U') : x[1] }.join)
         end
       end
 
diff --git a/lib/onebox/helpers.rb b/lib/onebox/helpers.rb
index 54a9448..9a51b38 100644
--- a/lib/onebox/helpers.rb
+++ b/lib/onebox/helpers.rb
@@ -132,7 +132,7 @@ module Onebox
         end
       end
       ndx = 7
-      return "#{'%.2f' % (size / (scale**(ndx - 1)))} #{conv[ndx - 1]}"
+      "#{'%.2f' % (size / (scale**(ndx - 1)))} #{conv[ndx - 1]}"
     end
 
     def self.click_to_scroll_div(width = 690, height = 400)
diff --git a/onebox.gemspec b/onebox.gemspec
index 172d5c0..d26dac6 100644
--- a/onebox.gemspec
+++ b/onebox.gemspec
@@ -32,7 +32,8 @@ Gem::Specification.new do |spec|
   spec.add_development_dependency 'fakeweb', '~> 1.3'
   spec.add_development_dependency 'pry', '~> 0.10'
   spec.add_development_dependency 'mocha', '~> 1.1'
-  spec.add_development_dependency 'rubocop', '~> 0.50'
+  spec.add_development_dependency 'rubocop', '~> 0.69.0'
+  spec.add_development_dependency 'rubocop-discourse', '~> 1.0.1'
   spec.add_development_dependency 'twitter', '~> 4.8'
   spec.add_development_dependency 'guard-rspec', '~> 4.2.8'
   spec.add_development_dependency 'sinatra', '~> 1.4'

GitHub sha: 15bec2bb

1 Like