Showing 57 of 83 total issues
File faye-browser.js
has 1910 lines of code (exceeds 250 allowed). Consider refactoring. Open
(function() {
'use strict';
var Faye = {
VERSION: '1.1.2',
Method connect
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def connect
@state ||= UNCONNECTED
return unless @state == UNCONNECTED
@state = CONNECTING
- 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_request
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def handle_request(request)
unless json_msg = message_from_request(request)
error 'Received request with no message: ?', format_request(request)
return [400, TYPE_TEXT, ['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 subscribe
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def subscribe(message, local = false, &callback)
response = make_response(message)
client_id = message['clientId']
subscription = [message['subscription']].flatten
- 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 unsubscribe
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def unsubscribe(message, local = false, &callback)
response = make_response(message)
client_id = message['clientId']
subscription = [message['subscription']].flatten
- 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
Function str
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
Method pipe_through_extensions
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def pipe_through_extensions(stage, message, env, &callback)
debug('Passing through ? extensions: ?', stage, message)
return callback.call(message) unless @extensions
extensions = @extensions.dup
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def connect(message, local = false, &callback)
response = make_response(message)
client_id = message['clientId']
connection_type = message['connectionType']
- 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 get
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get(dispatcher, allowed, disabled, &callback)
endpoint = dispatcher.endpoint
select = lambda do |(conn_type, klass), resume|
conn_endpoint = dispatcher.endpoint_for(conn_type)
- 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 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def connect
@state ||= UNCONNECTED
return unless @state == UNCONNECTED
@state = CONNECTING
Method call
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
filename = File.basename(env['PATH_INFO'])
filename = @path_map[filename] || filename
cache = @index[filename] ||= {}
- 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
Function connect
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
connect: function() {
if (Faye.Transport.WebSocket._unloaded) return;
this._state = this._state || this.UNCONNECTED;
if (this._state !== this.UNCONNECTED) return;
Method create
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create
respond_to do |format|
@message = @conversation.messages.new(message_params)
@messages = @conversation.messages
if @messages.length==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
Function emit
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
EventEmitter.prototype.emit = function(type) {
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events || !this._events.error ||
(isArray(this._events.error) && !this._events.error.length))
Function request
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
request: function(messages) {
var xhrClass = Faye.ENV.XDomainRequest ? XDomainRequest : XMLHttpRequest,
xhr = new xhrClass(),
id = ++Faye.Transport.CORS._id,
headers = this._dispatcher.headers,
Method handle_request
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_request(request)
unless json_msg = message_from_request(request)
error 'Received request with no message: ?', format_request(request)
return [400, TYPE_TEXT, ['Bad request']]
end
Function parse
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
parse: function(url) {
if (typeof url !== 'string') return url;
var uri = {}, parts, query, pairs, i, n, data;
var consume = function(name, pattern) {
Method subscribe
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def subscribe(channel, force = false, &block)
if Array === channel
return channel.map { |c| subscribe(c, force, &block) }
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 async_each
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.async_each(list, iterator, callback)
n = list.size
i = -1
calls = 0
looping = false
- 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
Function parse
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.