Showing 97 of 165 total issues
Function subscribe
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Channel.prototype.subscribe = function (handler) {
if (typeof handler !== 'function') {
throw new Error('handler function is required');
}
this.handlers.push(handler);
Function 9
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
},{"./util/globals":10,"./util/mock-window":11}],9:[function(require,module,exports){
require('./globals');
var instanceCount = 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 write
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
Avoid deeply nested control flow statements. Open
if (Assertion.prototype.hasOwnProperty(fn) && fn != name) {
this[name][fn] = bind(assertion[fn], assertion);
}
Function 10
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
},{"./globals":10}],10:[function(require,module,exports){
(function (global){
global.when = function(){
var args = Array.prototype.slice.apply(arguments);
- 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 findWindow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Channel.prototype.findWindow = function () {
if (this._window) {
return this._window;
}
var target = this.options.target;
- 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 writeDouble
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function writeDouble (buf, value, offset, littleEndian, noAssert) {
Function waitMessageResponse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function waitMessageResponse(self, id, timeout, resolve, reject) {
Function read
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
Function writeUInt16
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function writeUInt16 (buf, value, offset, littleEndian, noAssert) {
Function writeInt32
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function writeInt32 (buf, value, offset, littleEndian, noAssert) {
Function waitMessageResponse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function waitMessageResponse(self, id, timeout, resolve, reject) {
Function writeUInt32
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function writeUInt32 (buf, value, offset, littleEndian, noAssert) {
Function writeFloat
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function writeFloat (buf, value, offset, littleEndian, noAssert) {
Function writeInt16
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function writeInt16 (buf, value, offset, littleEndian, noAssert) {
Avoid too many return
statements within this function. Open
return stylize("["+value.toString()+"]", 'Error');
Avoid too many return
statements within this function. Open
return braces[0] + base + braces[1];
Avoid too many return
statements within this function. Open
return false;