Skip to content

Commit 786fa22

Browse files
committed
Fix warnings
1 parent 088114e commit 786fa22

18 files changed

+25
-57
lines changed

examples/example.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def initialize(argv)
5252
private
5353

5454
def option_parser
55-
op = OptionParser.new do |op|
55+
OptionParser.new do |op|
5656
op.on('-p', '--port N', Integer, 'Bind to a specific port') do |t|
5757
@port = t
5858
end

features/support/test_file_templates.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def [](filename)
1313
private
1414

1515
def have_template?(filename)
16-
File.exists?(template_path(filename))
16+
File.exist?(template_path(filename))
1717
end
1818

1919
def read_template(filename)

features/support/test_server_files.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def add_directory(path)
2222

2323
def has_file?(path)
2424
full_path = temp_path(path)
25-
File.exists?(full_path)
25+
File.exist?(full_path)
2626
end
2727

2828
def has_file_with_contents_of?(path)

lib/ftpd.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
require_relative 'ftpd/list_path'
7878
require_relative 'ftpd/null_logger'
7979
require_relative 'ftpd/protocols'
80-
require_relative 'ftpd/read_only_disk_file_system'
8180
require_relative 'ftpd/release'
8281
require_relative 'ftpd/server'
8382
require_relative 'ftpd/session'

lib/ftpd/cmd_help.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ class CmdHelp < CommandHandler
88

99
def cmd_help(argument)
1010
if argument
11-
command = argument.upcase
12-
if supported_commands.include?(command)
13-
reply "214 Command #{command} is recognized"
11+
target_command = argument.upcase
12+
if supported_commands.include?(target_command)
13+
reply "214 Command #{target_command} is recognized"
1414
else
15-
reply "214 Command #{command} is not recognized"
15+
reply "214 Command #{target_command} is not recognized"
1616
end
1717
else
1818
reply '214-The following commands are recognized:'

lib/ftpd/cmd_nlst.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def cmd_nlst(argument)
1818

1919
private
2020

21-
def name_list(path)
22-
path_list(path).map do |path|
21+
def name_list(target_path)
22+
path_list(target_path).map do |path|
2323
File.basename(path) + "\n"
2424
end.join
2525
end

lib/ftpd/cmd_type.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ class CmdType < CommandHandler
88

99
def cmd_type(argument)
1010
ensure_logged_in
11-
syntax_error unless argument =~ /^(\S)(?: (\S+))?$/
12-
type_code = $1
13-
format_code = $2
11+
syntax_error unless argument =~ /^\S(?: \S+)?$/
1412
unless argument =~ /^([AEI]( [NTC])?|L .*)$/
1513
error 'Invalid type code', 504
1614
end

lib/ftpd/data_connection_helper.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative 'command_handler'
4-
53
module Ftpd
64

75
module DataConnectionHelper

lib/ftpd/disk_file_system.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def accessible?(ftp_path)
5757
# @return [Boolean]
5858

5959
def exists?(ftp_path)
60-
File.exists?(expand_ftp_path(ftp_path))
60+
File.exist?(expand_ftp_path(ftp_path))
6161
end
6262

6363
# Return true if the path exists and is a directory.

lib/ftpd/file_system_helper.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative 'command_handler'
4-
53
module Ftpd
64

75
module FileSystemHelper

0 commit comments

Comments
 (0)