Showing 131 of 147 total issues
Avoid deeply nested control flow statements. Open
elsif find_openssl_library
# If we don't even need any options to find a usable OpenSSL, go with it
add_define 'WITH_SSL'
elsif dir_config_search('OpenSSL', 'openssl', ['/usr/local', '/opt/local', '/usr/local/opt/openssl']) do
find_openssl_library
Method close
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public void close() {
if (channelKey != null) {
channelKey.cancel();
channelKey = null;
}
- 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 deeply nested control flow statements. Open
rescue Exception => error
@wrapped_exception = error
stop
Method start_server
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.start_server server, port=nil, handler=nil, *args, &block
begin
port = Integer(port)
rescue ArgumentError, TypeError
# there was no port, so server must be a unix domain socket
- 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 deeply nested control flow statements. Open
elsif @content_length
# If there was no content-length header, we have to wait until the connection
# closes. Everything we get until that point is content.
# TODO: Must impose a content-size limit, and also must implement chunking.
# Also, must support either temporary files for large content, or calling
Avoid deeply nested control flow statements. Open
will_take = if remaining_data.length > needed
needed
else
remaining_data.length
end
Method receive_line
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def receive_line line
@stomp_initialized || init_message_reader
@stomp_message.consume_line(line) {|outcome|
if outcome.first == :sized_text
set_text_mode outcome[1]
- 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 deeply nested control flow statements. Open
elsif opcode == ConnectionData
c = @conns[conn_binding] or raise ConnectionNotBound, "received data #{data} for unknown signature: #{conn_binding}"
c.receive_data data
elsif opcode == LoopbreakSignalled
run_deferred_callbacks
Avoid deeply nested control flow statements. Open
if @headers.length == 1
parse_response_line
elsif ary.first =~ /\Acontent-length:\s*/i
# Only take the FIRST content-length header that appears,
# which we can distinguish because @content_length is nil.
Avoid deeply nested control flow statements. Open
if @lt2_textpos >= @lt2_textsize
# Reset line mode (the default behavior) BEFORE calling the
# receive_binary_data. This makes it possible for user code
# to call set_text_mode, enabling chains of text blocks
# (which can possibly be of different sizes).
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
Avoid deeply nested control flow statements. Open
return if t == false # timer cancelled
Method scheduleOutboundData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public void scheduleOutboundData (ByteBuffer bb) {
if (!bCloseScheduled && bb.remaining() > 0) {
if (sslEngine != null) {
try {
ByteBuffer b = ByteBuffer.allocate(32*1024); // TODO, preallocate this buffer.
- 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_deferred_callbacks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.run_deferred_callbacks
until (@resultqueue ||= []).empty?
result,cback = @resultqueue.pop
cback.call result if cback
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 send_cmd
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_cmd cmd, key, flags = 0, exptime = 0, bytes = 0, noreply = false
Method isWritable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
void isWritable (SelectionKey k) {
EventableChannel ec = (EventableChannel) k.attachment();
long b = ec.getBinding();
if (ec.isWatchOnly()) {
- 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 bind_connect
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.bind_connect bind_addr, bind_port, server, port=nil, handler=nil, *args
Method invoke_auth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def invoke_auth
if @args[:auth]
if @args[:auth][:type] == :plain
psw = @args[:auth][:password]
if psw.respond_to?(:call)
- 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 deeply nested control flow statements. Open
if (m = data.match(/\A(\S*)\r\n/m))
data = data[m[0].length..-1]
@chunk_length = m[1].to_i(16)
@chunk_read = 0
if @chunk_length == 0
Avoid deeply nested control flow statements. Open
if (@content_length and @content_length > 0) || @chunked || @connection_close
@read_state = :content
else
dispatch_response
@read_state = :base