Method negotiate_authentication
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def negotiate_authentication
# Authentication type negotiation is protocol version specific.
if @minver < 7
buf = @sock.get_once(4)
if !buf
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method negotiate_authentication
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def negotiate_authentication
# Authentication type negotiation is protocol version specific.
if @minver < 7
buf = @sock.get_once(4)
if !buf
Method authenticate_with_type
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_with_type(type, username = nil, password = nil)
return false if !type
# Authenticate.
case type
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method authenticate_with_type
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authenticate_with_type(type, username = nil, password = nil)
return false if !type
# Authenticate.
case type
Method handshake
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handshake
@banner = @sock.get_once(12)
if !@banner
@error = 'Unable to obtain banner from server'
return false
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return nil
Avoid too many return
statements within this method. Open
return nil
Avoid too many return
statements within this method. Open
return true
Avoid too many return
statements within this method. Open
return nil