Method start
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
def start
@started = true
@server = ::TCPServer.new('127.0.0.1', port)
@port = @server.addr[1]
@thread = Thread.new do
Class Server
has 21 methods (exceeds 20 allowed). Consider refactoring.
class Server
attr_accessor :client, :command_state, :data_server, :passive_port
attr_accessor :port, :store, :workdir
alias path workdir
Method start
has 44 lines of code (exceeds 25 allowed). Consider refactoring.
def start
@started = true
@server = ::TCPServer.new('127.0.0.1', port)
@port = @server.addr[1]
@thread = Thread.new do
Method run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def run(ctx, filename = '', *)
ctx.respond_with('501 No filename given') if filename.empty?
f = ctx.file(filename.to_s)
return ctx.respond_with('550 File not found') if f.nil?
Method load_command_instance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
private def load_command_instance(command)
require "fake_ftp/server_commands/#{command}"
FakeFtp::ServerCommands.constants.each do |const_name|
next unless const_name.to_s.downcase == command
return FakeFtp::ServerCommands.const_get(const_name).new