Skip to content

Commit

Permalink
Autofix Rubocop Style/UnpackFirst (mastodon#23741)
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni authored Feb 20, 2023
1 parent 5116347 commit d2dcb6c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
7 changes: 0 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2617,10 +2617,3 @@ Style/SymbolArray:
Style/SymbolProc:
Exclude:
- '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'
4 changes: 2 additions & 2 deletions app/models/concerns/account_interactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def remote_followers_hash(url)
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))
end
digest.unpack('H*')[0]
digest.unpack1('H*')
end
end

Expand All @@ -288,7 +288,7 @@ def local_followers_hash
followers.where(domain: nil).pluck_each(:username) do |username|
Xorcist.xor!(digest, Digest::SHA256.digest(ActivityPub::TagManager.instance.uri_for_username(username)))
end
digest.unpack('H*')[0]
digest.unpack1('H*')
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/paperclip/gif_transcoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def initialize(path, max_frames = 2)
end

# 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_sub_blocks!(s)
Expand All @@ -77,7 +77,7 @@ def initialize(path, max_frames = 2)
private

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')
file.seek(block_size, IO::SEEK_CUR)
end
Expand Down

0 comments on commit d2dcb6c

Please sign in to comment.