about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2020-09-01 03:04:00 +0200
committerGitHub <noreply@github.com>2020-09-01 03:04:00 +0200
commit8972e5f7f643c7a851de68b131b5b49844818ec5 (patch)
tree0b782e777a2611b8b45c5846489e71f43c8b9af7 /app/lib
parent10f180417e137e469eac3e7b11de90aa9edcaf13 (diff)
Bump rubocop from 0.86.0 to 0.88.0 (#14412)
* Bump rubocop from 0.86.0 to 0.88.0

Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.86.0 to 0.88.0.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.86.0...v0.88.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Fix for latest RuboCop

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/activitypub/linked_data_signature.rb4
-rw-r--r--app/lib/entity_cache.rb2
-rw-r--r--app/lib/formatter.rb2
-rw-r--r--app/lib/request.rb2
-rw-r--r--app/lib/sidekiq_error_handler.rb2
5 files changed, 8 insertions, 4 deletions
diff --git a/app/lib/activitypub/linked_data_signature.rb b/app/lib/activitypub/linked_data_signature.rb
index f52a8f406..e853a970e 100644
--- a/app/lib/activitypub/linked_data_signature.rb
+++ b/app/lib/activitypub/linked_data_signature.rb
@@ -27,7 +27,7 @@ class ActivityPub::LinkedDataSignature
     document_hash  = hash(@json.without('signature'))
     to_be_verified = options_hash + document_hash
 
-    if creator.keypair.public_key.verify(OpenSSL::Digest::SHA256.new, Base64.decode64(signature), to_be_verified)
+    if creator.keypair.public_key.verify(OpenSSL::Digest.new('SHA256'), Base64.decode64(signature), to_be_verified)
       creator
     end
   end
@@ -44,7 +44,7 @@ class ActivityPub::LinkedDataSignature
     to_be_signed  = options_hash + document_hash
     keypair       = sign_with.present? ? OpenSSL::PKey::RSA.new(sign_with) : creator.keypair
 
-    signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest::SHA256.new, to_be_signed))
+    signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest.new('SHA256'), to_be_signed))
 
     @json.merge('signature' => options.merge('signatureValue' => signature))
   end
diff --git a/app/lib/entity_cache.rb b/app/lib/entity_cache.rb
index afdbd70f2..89cbf8d2c 100644
--- a/app/lib/entity_cache.rb
+++ b/app/lib/entity_cache.rb
@@ -16,7 +16,7 @@ class EntityCache
   end
 
   def emoji(shortcodes, domain)
-    shortcodes   = [shortcodes] unless shortcodes.is_a?(Array)
+    shortcodes   = Array(shortcodes)
     cached       = Rails.cache.read_multi(*shortcodes.map { |shortcode| to_key(:emoji, shortcode, domain) })
     uncached_ids = []
 
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index e6f5d7a63..7f217ae9f 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -135,6 +135,7 @@ class Formatter
     end
   end
 
+  # rubocop:disable Metrics/BlockNesting
   def encode_custom_emojis(html, emojis, animate = false)
     return html if emojis.empty?
 
@@ -189,6 +190,7 @@ class Formatter
 
     html
   end
+  # rubocop:enable Metrics/BlockNesting
 
   def rewrite(text, entities)
     text = text.to_s
diff --git a/app/lib/request.rb b/app/lib/request.rb
index bcba1eebf..89fbeaf95 100644
--- a/app/lib/request.rb
+++ b/app/lib/request.rb
@@ -114,7 +114,7 @@ class Request
 
   def signature
     algorithm = 'rsa-sha256'
-    signature = Base64.strict_encode64(@keypair.sign(OpenSSL::Digest::SHA256.new, signed_string))
+    signature = Base64.strict_encode64(@keypair.sign(OpenSSL::Digest.new('SHA256'), signed_string))
 
     "keyId=\"#{key_id}\",algorithm=\"#{algorithm}\",headers=\"#{signed_headers.keys.join(' ').downcase}\",signature=\"#{signature}\""
   end
diff --git a/app/lib/sidekiq_error_handler.rb b/app/lib/sidekiq_error_handler.rb
index b07817d45..ab555b1be 100644
--- a/app/lib/sidekiq_error_handler.rb
+++ b/app/lib/sidekiq_error_handler.rb
@@ -17,8 +17,10 @@ class SidekiqErrorHandler
 
   private
 
+  # rubocop:disable Naming/MethodParameterName
   def limit_backtrace_and_raise(e)
     e.set_backtrace(e.backtrace.first(BACKTRACE_LIMIT))
     raise e
   end
+  # rubocop:enable Naming/MethodParameterName
 end