Browse Source

Autofix Rubocop Style/UnpackFirst (#23741)

closed-social-glitch-2
Nick Schonning 1 year ago
committed by GitHub
parent
commit
d2dcb6c45a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 11 deletions
  1. +0
    -7
      .rubocop_todo.yml
  2. +2
    -2
      app/models/concerns/account_interactions.rb
  3. +2
    -2
      lib/paperclip/gif_transcoder.rb

+ 0
- 7
.rubocop_todo.yml View File

@ -2617,10 +2617,3 @@ Style/SymbolArray:
Style/SymbolProc: Style/SymbolProc:
Exclude: Exclude:
- 'spec/lib/request_spec.rb' - 'spec/lib/request_spec.rb'
# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
Style/UnpackFirst:
Exclude:
- 'app/models/concerns/account_interactions.rb'
- 'lib/paperclip/gif_transcoder.rb'

+ 2
- 2
app/models/concerns/account_interactions.rb View File

@ -278,7 +278,7 @@ module AccountInteractions
followers.where(Account.arel_table[:uri].matches("#{Account.sanitize_sql_like(url_prefix)}/%", false, true)).or(followers.where(uri: url_prefix)).pluck_each(:uri) do |uri| followers.where(Account.arel_table[:uri].matches("#{Account.sanitize_sql_like(url_prefix)}/%", false, true)).or(followers.where(uri: url_prefix)).pluck_each(:uri) do |uri|
Xorcist.xor!(digest, Digest::SHA256.digest(uri)) Xorcist.xor!(digest, Digest::SHA256.digest(uri))
end end
digest.unpack('H*')[0]
digest.unpack1('H*')
end end
end end
@ -288,7 +288,7 @@ module AccountInteractions
followers.where(domain: nil).pluck_each(:username) do |username| followers.where(domain: nil).pluck_each(:username) do |username|
Xorcist.xor!(digest, Digest::SHA256.digest(ActivityPub::TagManager.instance.uri_for_username(username))) Xorcist.xor!(digest, Digest::SHA256.digest(ActivityPub::TagManager.instance.uri_for_username(username)))
end end
digest.unpack('H*')[0]
digest.unpack1('H*')
end end
end end

+ 2
- 2
lib/paperclip/gif_transcoder.rb View File

@ -57,7 +57,7 @@ class GifReader
end end
# Skip lzw min code size # Skip lzw min code size
raise InvalidValue unless s.read(1).unpack('C')[0] >= 2
raise InvalidValue unless s.read(1).unpack1('C') >= 2
# Skip image data sub-blocks # Skip image data sub-blocks
skip_sub_blocks!(s) skip_sub_blocks!(s)
@ -77,7 +77,7 @@ class GifReader
private private
def skip_extension_block!(file) def skip_extension_block!(file)
if EXTENSION_LABELS.include?(file.read(1).unpack('C')[0])
if EXTENSION_LABELS.include?(file.read(1).unpack1('C'))
block_size, = file.read(1).unpack('C') block_size, = file.read(1).unpack('C')
file.seek(block_size, IO::SEEK_CUR) file.seek(block_size, IO::SEEK_CUR)
end end

Loading…
Cancel
Save