File pure_ruby.rb
has 863 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'singleton'
require 'forwardable'
require 'socket'
require 'fcntl'
require 'set'
Method start_tls
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def start_tls signature
selectable = Reactor.instance.get_selectable(signature) or raise "unknown io selectable for start_tls"
tls_parms = @tls_parms[signature]
ctx = OpenSSL::SSL::SSLContext.new
ctx.options = tls_parms[:ssl_options]
- 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 start_tls
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_tls signature
selectable = Reactor.instance.get_selectable(signature) or raise "unknown io selectable for start_tls"
tls_parms = @tls_parms[signature]
ctx = OpenSSL::SSL::SSLContext.new
ctx.options = tls_parms[:ssl_options]
Method set_tls_parms
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def set_tls_parms signature, priv_key_path, priv_key, priv_key_pass, cert_chain_path, cert, verify_peer, fail_if_no_peer_cert, sni_hostname, cipher_list, ecdh_curve, dhparam, protocols_bitmask
bitmask = protocols_bitmask
ssl_options = OpenSSL::SSL::OP_ALL
ssl_options |= OpenSSL::SSL::OP_NO_SSLv2 if defined?(OpenSSL::SSL::OP_NO_SSLv2) && EM_PROTO_SSLv2 & bitmask == 0
ssl_options |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3) && EM_PROTO_SSLv3 & bitmask == 0
- 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 set_tls_parms
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_tls_parms signature, priv_key_path, priv_key, priv_key_pass, cert_chain_path, cert, verify_peer, fail_if_no_peer_cert, sni_hostname, cipher_list, ecdh_curve, dhparam, protocols_bitmask
Method eventable_write
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def eventable_write
# coalesce the outbound array here, perhaps
@last_activity = Reactor.instance.current_loop_time
while data = @outbound_q.shift do
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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run
raise Error.new( "already running" ) if @running
@running = true
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 handshake_complete?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handshake_complete?
if !@handshake_complete && io.respond_to?(:state)
if io.state =~ /^SSLOK/
@handshake_complete = true
EventMachine::event_callback uuid, SslHandshakeCompleted, ""
- 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_datagram
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_datagram target, data, datalength, host, port
Method eventable_write
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def eventable_write
40.times {
break if @outbound_q.empty?
begin
data,target = @outbound_q.first
- 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 crank_selectables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def crank_selectables
#$stderr.write 'R'
readers = @selectables.values.select {|io| io.select_for_reading?}
writers = @selectables.values.select {|io| io.select_for_writing?}
- 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"