Function ensureImplements
has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring. Open
Interface.ensureImplements = function(intfs, object) {
if (Interface.HARDROCK && typeof object[Interface.INTERFACES_PROP] === 'undefined') {
object[Interface.INTERFACES_PROP] = [];
}
- 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 ensureImplements
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Interface.ensureImplements = function(intfs, object) {
if (Interface.HARDROCK && typeof object[Interface.INTERFACES_PROP] === 'undefined') {
object[Interface.INTERFACES_PROP] = [];
}
Function method
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
object[method] = (function(method, argumentTypes, resultType, fn) {
return function() {
var argumentType, callArg, callArguments = [].slice.call(arguments, 0);
for (var i = 0; i < argumentTypes.length; i += 1) {
argumentType = argumentTypes[i];
Function clear
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Interface.clear = function (iface, obj) {
if (!obj[Interface.FN_STORE_PROP]) {
obj[Interface.FN_STORE_PROP] = {};
}
- 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 Interface
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
var Interface = function(name, methods) {
if (arguments.length !== 2) {
throw new Error("Interface constructor called with " + arguments.length + "arguments, but expected exactly 2.");
}
this.name = name;
- 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 (this[Interface.FN_STORE_PROP]) {
_clearAgain(this);
}
Avoid deeply nested control flow statements. Open
for (var i = 0; i < argumentTypes.length; i += 1) {
argumentType = argumentTypes[i];
if (callArguments.length <= i) {
throw new Error("Called method \"" + method + "\" - argument #" + i + " not passed");
}
Avoid deeply nested control flow statements. Open
if (resultType) {
if (_hasNativeType(resultType, ret) || typeof resultType === 'function' &&
ret instanceof resultType) {} else {
if (_hasIntf(resultType, ret)) {} else {
throw new Error("Called method \"" + method + "\" - result not passed or has invalid type");
Avoid deeply nested control flow statements. Open
if (this[Interface.FN_STORE_PROP]) {
Interface.restore(this);
}
Avoid deeply nested control flow statements. Open
for (i = 0; i < callArguments.length; i += 1) {
Interface.restore(callArguments[i]);
}