8000 Fix Naming/VariableName cop in the library code. · rubyzip/rubyzip@f9b161e · GitHub
[go: up one dir, main page]

Skip to content

Commit f9b161e

Browse files
committed
Fix Naming/VariableName cop in the library code.
1 parent e6f414f commit f9b161e

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ Naming/AccessorMethodName:
3838
- 'lib/zip/streamable_stream.rb'
3939
- 'test/file_permissions_test.rb'
4040

41-
# Offense count: 721
42-
# Configuration parameters: EnforcedStyle.
43-
# SupportedStyles: snake_case, camelCase
44-
Naming/VariableName:
45-
Exclude:
46-
- 'lib/**/*.rb'
47-
4841
# Offense count: 7
4942
# Configuration parameters: EnforcedStyle.
5043
# SupportedStyles: inline, group

lib/zip/file.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ def remove(entry)
319319

320320
# Renames the specified entry.
321321
def rename(entry, new_name, &continue_on_exists_proc)
322-
foundEntry = get_entry(entry)
322+
found_entry = get_entry(entry)
323323
check_entry_exists(new_name, continue_on_exists_proc, 'rename')
324-
@entry_set.delete(foundEntry)
325-
foundEntry.name = new_name
326-
@entry_set << foundEntry
324+
@entry_set.delete(found_entry)
325+
found_entry.name = new_name
326+
@entry_set << found_entry
327327
end
328328

329329
# Replaces the specified entry with the contents of src_path (from
@@ -420,15 +420,15 @@ def mkdir(entry_name, permission = 0o755)
420420
private
421421

422422
def directory?(new_entry, src_path)
423-
srcPathIsDirectory = ::File.directory?(src_path)
424-
if new_entry.directory? && !srcPathIsDirectory
423+
path_is_directory = ::File.directory?(src_path)
424+
if new_entry.directory? && !path_is_directory
425425
raise ArgumentError,
426426
"entry name '#{new_entry}' indicates directory entry, but " \
427427
"'#{src_path}' is not a directory"
428-
elsif !new_entry.directory? && srcPathIsDirectory
428+
elsif !new_entry.directory? && path_is_directory
429429
new_entry.name += '/'
430430
end
431-
new_entry.directory? && srcPathIsDirectory
431+
new_entry.directory? && path_is_directory
432432
end
433433

434434
def check_entry_exists(entry_name, continue_on_exists_proc, proc_name)

lib/zip/filesystem.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,16 +444,16 @@ def new(directory_name)
444444
end
445445

446446
def open(directory_name)
447-
dirIt = new(directory_name)
447+
dir_iter = new(directory_name)
448448
if block_given?
449449
begin
450-
yield(dirIt)
450+
yield(dir_iter)
451451
return nil
452452
ensure
453-
dirIt.close
453+
dir_iter.close
454454
end
455455
end
456-
dirIt
456+
dir_iter
457457
end
458458

459459
def pwd
@@ -487,9 +487,9 @@ def foreach(directory_name)
487487
path = @file.expand_path(directory_name)
488488
path << '/' unless path.end_with?('/')
489489
path = Regexp.escape(path)
490-
subDirEntriesRegex = Regexp.new("^#{path}([^/]+)$")
490+
subdir_entry_regex = Regexp.new("^#{path}([^/]+)$")
491491
@mapped_zip.each do |filename|
492-
match = subDirEntriesRegex.match(filename)
492+
match = subdir_entry_regex.match(filename)
493493
yield(match[1]) unless match.nil?
494494
end
495495
end

0 commit comments

Comments
 (0)
0