Showing 131 of 147 total issues
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'
File eventmachine.rb
has 527 lines of code (exceeds 250 allowed). Consider refactoring. Open
if defined?(EventMachine.library_type) and EventMachine.library_type == :pure_ruby
# assume 'em/pure_ruby' was loaded already
elsif RUBY_PLATFORM =~ /java/
require 'java'
require 'jeventmachine'
Method receive_data
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
def receive_data data
while data and data.length > 0
case @read_state
when :base
# Perform any per-request initialization here and don't consume any 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 event_callback
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def self.event_callback conn_binding, opcode, data
#
# Changed 27Dec07: Eliminated the hookable error handling.
# No one was using it, and it degraded performance significantly.
# It's in original_event_callback, which is dead code.
- 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
File EmReactor.java
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* $Id$
*
* Author:: Francis Cianfrocca (gmail: blackhedd)
* Homepage:: http://rubyeventmachine.com
EmReactor
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
public class EmReactor implements EmReactorInterface
{
private static final NullEventableChannel NULL_EVENTABLE_CHANNEL = new NullEventableChannel();
public final int EM_TIMER_FIRED = 100;
public final int EM_CONNECTION_READ = 101;
Class Connection
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
class Connection
# @private
attr_accessor :signature
# @private
Method receive_data
has a Cognitive Complexity of 37 (exceeds 5 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
- 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 SmtpServer
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class SmtpServer < EventMachine::Connection
include Protocols::LineText2
HeloRegex = /\AHELO\s*/i
EhloRegex = /\AEHLO\s*/i
Method receive_line
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def receive_line line
case @hc_mode
when :discard_blanks
unless line == ""
@hc_mode = :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 each
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def each(foreach=nil, after=nil, &blk)
raise ArgumentError, 'proc or block required for iteration' unless foreach ||= blk
raise RuntimeError, 'cannot iterate over an iterator more than once' if @started or @ended
@started = 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 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
EventableSocketChannel
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
public class EventableSocketChannel implements EventableChannel {
Selector selector;
SelectionKey channelKey;
SocketChannel channel;
File smtpserver.rb
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
module EventMachine
module Protocols
# This is a protocol handler for the server side of SMTP.
# It's NOT a complete SMTP server obeying all the semantics of servers conforming to
File httpclient2.rb
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
module EventMachine
module Protocols
# ### Usage
#
Method start_tls
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def start_tls args={}
priv_key_path = args[:private_key_file]
priv_key = args[:private_key]
priv_key_pass = args[:private_key_pass]
cert_chain_path = args[:cert_chain_file]
- 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 25 (exceeds 5 allowed). Consider refactoring. Open
def stream_one_chunk
loop {
if @position < @size
if @connection.get_outbound_data_size > BackpressureLevel
EventMachine::next_tick {stream_one_chunk}
- 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
EmReactorInterface
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
public interface EmReactorInterface
{
void eventCallback (long sig, int eventType, ByteBuffer data, long data2);
void eventCallback (long sig, int eventType, ByteBuffer data);
NullEmReactor
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
public class NullEmReactor implements EmReactorInterface
{
public void eventCallback(long sig, int eventType, ByteBuffer data, long data2)
{
Method receive_data
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def receive_data data
if @lbp_mode == :lines
begin
@lpb_buffer.extract(data).each do |line|
receive_line(line.chomp) if respond_to?(:receive_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"