Showing 12 of 12 total issues
Method connect
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def connect(
remote_addr,
remote_port,
local_addr: nil,
local_port: nil,
- 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 change_state
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def change_state(new_state)
case new_state
when :connecting
raise "@socket is unset in #{@state} state" unless @socket
raise(StateError, "not in the disconnected state (actual: #{@state})") unless @state == :disconnected
- 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
Class Socket
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Socket
include Socketry::Timeout
attr_reader :state
attr_reader :addr_fmaily, :remote_addr, :remote_port, :local_addr, :local_port
File socket.rb
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Socketry
# Transmission Control Protocol
module TCP
# Transmission Control Protocol sockets: Provide stream-like semantics
class Socket
Method write
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def write(data, timeout: @write_timeout)
total_written = data.size
deadline = lifetime + timeout if timeout
begin
- 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 read
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def read(size, outbuf: "".b, timeout: @write_timeout)
outbuf.clear
deadline = lifetime + timeout if timeout
begin
- 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 accept
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def accept(tcp_socket, timeout: nil)
tcp_socket = IO.try_convert(tcp_socket) || raise(TypeError, "couldn't convert #{tcp_socket.class} to IO")
ssl_socket = @ssl_socket_class.new(tcp_socket, @ssl_context)
begin
- 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 resolve
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def resolve(hostname, timeout: nil)
raise TypeError, "expected String, got #{hostname.class}" unless hostname.is_a?(String)
IPAddr.new(@hosts.getaddress(hostname).sub(/%.*$/, ""))
rescue ::Resolv::ResolvError
- 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 send
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send(msg, host: nil, port: nil)
host = @resolver.resolve(host).to_s if host
if host || port
@socket.send(msg, 0, host, port)
else
- 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 connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def connect(
remote_host,
remote_port,
local_addr: nil,
local_port: nil,
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(
ssl_socket_class: OpenSSL::SSL::SSLSocket,
ssl_context: OpenSSL::SSL::SSLContext.new,
ssl_params: nil,
**args
- 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 connect_nonblock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def connect_nonblock(
remote_addr,
remote_port,
local_addr: nil,
local_port: nil
- 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"