Fix Layout/SpaceAroundOperators cop.

This commit is contained in:
Robert Haines 2020-02-09 10:52:06 +00:00
parent e7275dad93
commit 98c6969c18
6 changed files with 7 additions and 19 deletions

View File

@ -31,18 +31,6 @@ Layout/HashAlignment:
- 'lib/zip/file.rb' - 'lib/zip/file.rb'
- 'rubyzip.gemspec' - 'rubyzip.gemspec'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
# SupportedStylesForExponentOperator: space, no_space
Layout/SpaceAroundOperators:
Exclude:
- 'lib/zip/entry.rb'
- 'lib/zip/extra_field/zip64.rb'
- 'lib/zip/file.rb'
- 'lib/zip/filesystem.rb'
- 'lib/zip/input_stream.rb'
# Offense count: 1 # Offense count: 1
Lint/AmbiguousBlockAssociation: Lint/AmbiguousBlockAssociation:
Exclude: Exclude:

View File

@ -99,7 +99,7 @@ module Zip
@extra.create('UniversalTime') @extra.create('UniversalTime')
end end
(@extra['UniversalTime'] || @extra['NTFS']).mtime = value (@extra['UniversalTime'] || @extra['NTFS']).mtime = value
@time = value @time = value
end end
def file_type_is?(type) def file_type_is?(type)

View File

@ -9,7 +9,7 @@ module Zip
# unparsed binary; we don't actually know what this contains # unparsed binary; we don't actually know what this contains
# without looking for FFs in the associated file header # without looking for FFs in the associated file header
# call parse after initializing with a binary string # call parse after initializing with a binary string
@content = nil @content = nil
@original_size = nil @original_size = nil
@compressed_size = nil @compressed_size = nil
@relative_header_offset = nil @relative_header_offset = nil

View File

@ -75,7 +75,7 @@ module Zip
# a new archive if it doesn't exist already. # a new archive if it doesn't exist already.
def initialize(path_or_io, create = false, buffer = false, options = {}) def initialize(path_or_io, create = false, buffer = false, options = {})
super() super()
options = DEFAULT_OPTIONS.merge(options) options = DEFAULT_OPTIONS.merge(options)
@name = path_or_io.respond_to?(:path) ? path_or_io.path : path_or_io @name = path_or_io.respond_to?(:path) ? path_or_io.path : path_or_io
@comment = '' @comment = ''
@create = create ? true : false # allow any truthy value to mean true @create = create ? true : false # allow any truthy value to mean true

View File

@ -35,9 +35,9 @@ module Zip
module FileSystem module FileSystem
def initialize # :nodoc: def initialize # :nodoc:
mappedZip = ZipFileNameMapper.new(self) mappedZip = ZipFileNameMapper.new(self)
@zipFsDir = ZipFsDir.new(mappedZip) @zipFsDir = ZipFsDir.new(mappedZip)
@zipFsFile = ZipFsFile.new(mappedZip) @zipFsFile = ZipFsFile.new(mappedZip)
@zipFsDir.file = @zipFsFile @zipFsDir.file = @zipFsFile
@zipFsFile.dir = @zipFsDir @zipFsFile.dir = @zipFsDir
end end

View File

@ -51,7 +51,7 @@ module Zip
# @param offset [Integer] offset in the IO/StringIO # @param offset [Integer] offset in the IO/StringIO
def initialize(context, offset = 0, decrypter = nil) def initialize(context, offset = 0, decrypter = nil)
super() super()
@archive_io = get_io(context, offset) @archive_io = get_io(context, offset)
@decompressor = ::Zip::NullDecompressor @decompressor = ::Zip::NullDecompressor
@decrypter = decrypter || ::Zip::NullDecrypter.new @decrypter = decrypter || ::Zip::NullDecrypter.new
@current_entry = nil @current_entry = nil