Showing 57 of 83 total issues
Avoid deeply nested control flow statements. Open
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
Method send_message
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_message(message, options, &callback)
message['id'] = generate_message_id
timeout = [nil, 0].include?(@advice['timeout']) ?
1.2 * @dispatcher.retry :
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def connect(&block)
return if @advice['reconnect'] == NONE or
@state == DISCONNECTED
return handshake { connect(&block) } if @state == UNCONNECTED
- 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 (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
Function pipeThroughExtensions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
pipeThroughExtensions: function(stage, message, request, callback, context) {
Function get
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
get: function(dispatcher, allowed, disabled, callback, context) {
Method index
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def index
@messages = @conversation.messages
if @messages.length==0
@last_user = 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 online?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def online?
if current_sign_in_at.present?
online_status = last_sign_out_at.present? ? current_sign_in_at > last_sign_out_at : true
if (online_status)
online_status = updated_at > 1.minutes.ago
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handshake(message, local = false, &callback)
response = make_response(message)
response['version'] = BAYEUX_VERSION
response['error'] = Error.parameter_missing('version') if message['version'].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
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this method. Open
return handle_eventsource(request) if Faye::EventSource.eventsource?(env)
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
if (this._connectRequest) return;
Method initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(app = nil, options = nil, &block)
@app = app if app.respond_to?(:call)
@options = [app, options].grep(Hash).first || {}
::WebSocket::Driver.validate_options(@options, [:engine, :mount, :ping, :timeout, :extensions, :websocket_extensions])
- 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 handle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle(message, local = false, &callback)
return callback.call([]) if !message
info('Handling message: ? (local: ?)', message, local)
channel_name = message['channel']
- 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 flush_connection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def flush_connection(client_id, close = true)
return unless client_id
debug('Flushing connection for ?', client_id)
return unless conn = connection(client_id, false)
conn.socket = nil unless close
- 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_envelope
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_envelope(envelope)
return unless @transport
return if envelope.request or envelope.timer
message = envelope.message
- 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"