Showing 105 of 189 total issues
Function readFrame
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
frames.readFrame = function(buffer, options) {
options = options || { verbose: true };
if (buffer.length < 8) return undefined;
var sizeAndDoff = buffer.slice(0, 8);
- 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 defineComposite
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function defineComposite(Base, definition) {
if (definition === undefined) {
definition = Base;
Base = Object;
}
Function readFrame
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
frames.readFrame = function(buffer, options) {
options = options || { verbose: true };
if (buffer.length < 8) return undefined;
var sizeAndDoff = buffer.slice(0, 8);
Function _processFrame
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Sasl.prototype._processFrame = function(frame) {
var self = this;
if (frame instanceof frames.SaslMechanismsFrame) {
var mechanism = this.mechanism;
var mechanisms = Array.isArray(frame.saslServerMechanisms) ?
- 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 _readFullValue
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Codec.prototype._readFullValue = function(buf, offset, doNotConsume, forcedCode) {
offset = offset || 0;
var remaining = buf.length - offset;
if (remaining < 1) return undefined;
- 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 _tryReceiveHeader
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Connection.prototype._tryReceiveHeader = function(header) {
header = header || constants.amqpVersion;
if (this._buffer.length >= header.length) {
var serverVersion = this._buffer.slice(0, 8);
this._buffer.consume(8);
- 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 _processFrame
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Sasl.prototype._processFrame = function(frame) {
var self = this;
if (frame instanceof frames.SaslMechanismsFrame) {
var mechanism = this.mechanism;
var mechanisms = Array.isArray(frame.saslServerMechanisms) ?
Function _sendMessage
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
SenderLink.prototype._sendMessage = function(message, options) {
// preconditions
if (this.linkCredit <= 0) {
throw new errors.OverCapacityError('Cannot send if no link credit.');
}
Function _readFullValue
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Codec.prototype._readFullValue = function(buf, offset, doNotConsume, forcedCode) {
offset = offset || 0;
var remaining = buf.length - offset;
if (remaining < 1) return undefined;
Function arrayBuilder
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function arrayBuilder(val, bufb, codec, width) {
if (!(val instanceof AMQPArray)) {
throw new errors.EncodingError(val, 'Unsure how to encode non-amqp array as array');
}
Function stateMachine
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
var stateMachine = function(session) {
function warnBeginState(state) {
console.warn('BUG: Tried to call begin() on a session in nonterminal state ' + state);
}
Function bufferEqualsLegacy
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function bufferEqualsLegacy(lhs, rhs, offset1, offset2, size) {
if (offset1 === undefined && offset2 === undefined && size === undefined) {
if (lhs.length !== rhs.length) return false;
}
var slice1 = (offset1 === undefined && size === undefined) ? lhs : lhs.slice(offset1 || 0, size || lhs.length);
- 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 _sendMessage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
SenderLink.prototype._sendMessage = function(message, options) {
// preconditions
if (this.linkCredit <= 0) {
throw new errors.OverCapacityError('Cannot send if no link credit.');
}
- 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 writeFrame
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
frames.writeFrame = function(frame, stream, options, callback) {
if (!(frame instanceof frames.Frame)) {
throw new errors.EncodingError(frame, 'unknown frame 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
Function translate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function translate(input) {
if (!Array.isArray(input)) { // raw value
return input;
}
- 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 createReceiver
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
AMQPClient.prototype.createReceiver = function(address, policyOverrides, session) {
if (!this._connection) {
throw new Error('Must connect before creating links');
}
Function deepMerge
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function deepMerge() {
var args = Array.prototype.slice.call(arguments);
var helper = function(tgt, src, key) {
var s2, t2;
if (key === undefined) {
Function _processOpenFrame
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Connection.prototype._processOpenFrame = function(frame) {
this.connSM.openReceived();
if (this.connSM.getMachineState() === 'OPEN_RCVD') {
this.connSM.sendOpen();
}
Function mapBuilder
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function mapBuilder(map, bufb, codec, width) {
if (typeof map !== 'object') {
throw new errors.EncodingError(map, 'Unsure how to encode non-object as map');
}
- 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 listBuilder
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function listBuilder(list, bufb, codec, width) {
if (!Array.isArray(list)) {
throw new errors.EncodingError(list, 'Unsure how to encode non-array as list');
}
- 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"