Fix Style/UnpackFirst cop.
This commit is contained in:
parent
4e1b679c73
commit
2dfe092728
|
@ -335,15 +335,6 @@ Style/TrailingCommaInHashLiteral:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/zip/constants.rb'
|
- 'lib/zip/constants.rb'
|
||||||
|
|
||||||
# Offense count: 6
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/UnpackFirst:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/zip/entry.rb'
|
|
||||||
- 'lib/zip/extra_field.rb'
|
|
||||||
- 'lib/zip/extra_field/generic.rb'
|
|
||||||
- 'lib/zip/extra_field/zip64.rb'
|
|
||||||
|
|
||||||
# Offense count: 247
|
# Offense count: 247
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||||
|
|
|
@ -194,15 +194,15 @@ module Zip
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def read_zip_short(io) # :nodoc:
|
def read_zip_short(io) # :nodoc:
|
||||||
io.read(2).unpack('v')[0]
|
io.read(2).unpack1('v')
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_zip_long(io) # :nodoc:
|
def read_zip_long(io) # :nodoc:
|
||||||
io.read(4).unpack('V')[0]
|
io.read(4).unpack1('V')
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_zip_64_long(io) # :nodoc:
|
def read_zip_64_long(io) # :nodoc:
|
||||||
io.read(8).unpack('Q<')[0]
|
io.read(8).unpack1('Q<')
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_c_dir_entry(io) #:nodoc:all
|
def read_c_dir_entry(io) #:nodoc:all
|
||||||
|
|
|
@ -40,7 +40,7 @@ module Zip
|
||||||
i = 0
|
i = 0
|
||||||
while i < binstr.bytesize
|
while i < binstr.bytesize
|
||||||
id = binstr[i, 2]
|
id = binstr[i, 2]
|
||||||
len = binstr[i + 2, 2].to_s.unpack('v').first
|
len = binstr[i + 2, 2].to_s.unpack1('v')
|
||||||
if id && ID_MAP.member?(id)
|
if id && ID_MAP.member?(id)
|
||||||
extra_field_type_exist(binstr, id, len, i)
|
extra_field_type_exist(binstr, id, len, i)
|
||||||
elsif id
|
elsif id
|
||||||
|
|
|
@ -19,7 +19,7 @@ module Zip
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
[binstr[2, 2].unpack('v')[0], binstr[4..-1]]
|
[binstr[2, 2].unpack1('v'), binstr[4..-1]]
|
||||||
end
|
end
|
||||||
|
|
||||||
def ==(other)
|
def ==(other)
|
||||||
|
|
|
@ -46,7 +46,7 @@ module Zip
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract(size, format)
|
def extract(size, format)
|
||||||
@content.slice!(0, size).unpack(format)[0]
|
@content.slice!(0, size).unpack1(format)
|
||||||
end
|
end
|
||||||
private :extract
|
private :extract
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue