Fix Naming/VariableName cop in the library code.
This commit is contained in:
parent
e6f414f539
commit
f9b161eb32
|
@ -38,13 +38,6 @@ Naming/AccessorMethodName:
|
|||
- 'lib/zip/streamable_stream.rb'
|
||||
- 'test/file_permissions_test.rb'
|
||||
|
||||
# Offense count: 721
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: snake_case, camelCase
|
||||
Naming/VariableName:
|
||||
Exclude:
|
||||
- 'lib/**/*.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: inline, group
|
||||
|
|
|
@ -319,11 +319,11 @@ module Zip
|
|||
|
||||
# Renames the specified entry.
|
||||
def rename(entry, new_name, &continue_on_exists_proc)
|
||||
foundEntry = get_entry(entry)
|
||||
found_entry = get_entry(entry)
|
||||
check_entry_exists(new_name, continue_on_exists_proc, 'rename')
|
||||
@entry_set.delete(foundEntry)
|
||||
foundEntry.name = new_name
|
||||
@entry_set << foundEntry
|
||||
@entry_set.delete(found_entry)
|
||||
found_entry.name = new_name
|
||||
@entry_set << found_entry
|
||||
end
|
||||
|
||||
# Replaces the specified entry with the contents of src_path (from
|
||||
|
@ -420,15 +420,15 @@ module Zip
|
|||
private
|
||||
|
||||
def directory?(new_entry, src_path)
|
||||
srcPathIsDirectory = ::File.directory?(src_path)
|
||||
if new_entry.directory? && !srcPathIsDirectory
|
||||
path_is_directory = ::File.directory?(src_path)
|
||||
if new_entry.directory? && !path_is_directory
|
||||
raise ArgumentError,
|
||||
"entry name '#{new_entry}' indicates directory entry, but " \
|
||||
"'#{src_path}' is not a directory"
|
||||
elsif !new_entry.directory? && srcPathIsDirectory
|
||||
elsif !new_entry.directory? && path_is_directory
|
||||
new_entry.name += '/'
|
||||
end
|
||||
new_entry.directory? && srcPathIsDirectory
|
||||
new_entry.directory? && path_is_directory
|
||||
end
|
||||
|
||||
def check_entry_exists(entry_name, continue_on_exists_proc, proc_name)
|
||||
|
|
|
@ -444,16 +444,16 @@ module Zip
|
|||
end
|
||||
|
||||
def open(directory_name)
|
||||
dirIt = new(directory_name)
|
||||
dir_iter = new(directory_name)
|
||||
if block_given?
|
||||
begin
|
||||
yield(dirIt)
|
||||
yield(dir_iter)
|
||||
return nil
|
||||
ensure
|
||||
dirIt.close
|
||||
dir_iter.close
|
||||
end
|
||||
end
|
||||
dirIt
|
||||
dir_iter
|
||||
end
|
||||
|
||||
def pwd
|
||||
|
@ -487,9 +487,9 @@ module Zip
|
|||
path = @file.expand_path(directory_name)
|
||||
path << '/' unless path.end_with?('/')
|
||||
path = Regexp.escape(path)
|
||||
subDirEntriesRegex = Regexp.new("^#{path}([^/]+)$")
|
||||
subdir_entry_regex = Regexp.new("^#{path}([^/]+)$")
|
||||
@mapped_zip.each do |filename|
|
||||
match = subDirEntriesRegex.match(filename)
|
||||
match = subdir_entry_regex.match(filename)
|
||||
yield(match[1]) unless match.nil?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue