Showing 121 of 147 total issues
Class SmtpClient
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class SmtpClient < Connection
include EventMachine::Deferrable
include EventMachine::Protocols::LineText2
def initialize
Method send_request
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def send_request args
args[:verb] ||= args[:method] # Support :method as an alternative to :verb.
args[:verb] ||= :get # IS THIS A GOOD IDEA, to default to GET if nothing was specified?
verb = args[:verb].to_s.upcase
- 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 stream_one_chunk
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def stream_one_chunk
loop do
if @io.eof?
@connection.send_data "0\r\n\r\n" if @http_chunks
succeed
- 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 spawn_threadpool
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.spawn_threadpool
until @threadpool.size == @threadpool_size.to_i
thread = Thread.new do
Thread.current.abort_on_exception = true
while true
- 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_deferred_status
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def set_deferred_status status, *args
cancel_timeout
@errbacks ||= nil
@callbacks ||= nil
@deferred_status = status
- 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 process_header
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def process_header
unless @header_lines.first =~ HttpResponseRE
@conn.close_connection
@internal_error = :bad_request
end
- 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 consume_line
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def consume_line line
if @state == :precommand
unless line =~ /\A\s*\Z/
@command = line
@state = :headers
- 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 close
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
void close() {
try {
if (mySelector != null)
mySelector.close();
} catch (IOException e) {}
- 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 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 writeOutboundData
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public boolean writeOutboundData() throws IOException {
ByteBuffer[] bufs = new ByteBuffer[64];
int i;
long written, toWrite;
while (!outboundQ.isEmpty()) {
- 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 receive_data
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def receive_data data
return unless (data and data.length > 0)
# Do this stuff in lieu of a constructor.
@lt2_mode ||= :lines
Method klass_from_handler
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.klass_from_handler(klass = Connection, handler = nil, *args)
klass = if handler and handler.is_a?(Class)
raise ArgumentError, "must provide module or subclass of #{klass.name}" unless klass >= handler
handler
elsif handler
- 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_binary_mode
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def set_binary_mode size = nil
if @lbp_mode == :lines
if size == 0
receive_binary_data("") if respond_to?(:receive_binary_data)
# Do no more work here. Stay in line mode and keep consuming data.
- 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 receive_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def receive_data data
@sasl_data << data
while @sasl_data.length >= 2
len = (@sasl_data[0,2].unpack("n")).first
raise "SASL Max Field Length exceeded" if len > MaxFieldSize
- 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 process_data_line
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process_data_line ln
if ln == "."
if @databuffer.length > 0
receive_data_chunk @databuffer
@databuffer.clear
- 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_request
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_request args
args[:verb] ||= args[:method] # Support :method as an alternative to :verb.
args[:verb] ||= :get # IS THIS A GOOD IDEA, to default to GET if nothing was specified?
verb = args[:verb].to_s.upcase
Method isAcceptable
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
void isAcceptable (SelectionKey k) {
ServerSocketChannel ss = (ServerSocketChannel) k.channel();
SocketChannel sn;
long b;
- 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 hosts
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.hosts
return @hosts if @hosts
@hosts = {}
IO.readlines(HOSTS_FILE).each do |line|
- 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 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.run blk=nil, tail=nil, &block
# Obsoleted the use_threads mechanism.
# 25Nov06: Added the begin/ensure block. We need to be sure that release_machine
# gets called even if an exception gets thrown within any of the user code
# that the event loop runs. The best way to see this is to run a unit
Method process_rcpt_to
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def process_rcpt_to rcpt
unless @state.include?(:mail_from)
send_data "503 MAIL is required before RCPT\r\n"
else
succeeded = proc {
- 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"