Function onMessage
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Manager.prototype.onMessage = function (flow, message) {
var reverseFlow = this.controlFlows[flow], origin;
if (!reverseFlow) {
this.debug.warn("Unknown message source: " + flow);
return;
- Read upRead up
- Create a ticketCreate a ticket
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 onMessage
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Manager.prototype.onMessage = function (flow, message) {
var reverseFlow = this.controlFlows[flow], origin;
if (!reverseFlow) {
this.debug.warn("Unknown message source: " + flow);
return;
- Create a ticketCreate a ticket
Function createLink
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Manager.prototype.createLink = function (port, name, destination, destName,
toDest) {
if (!this.config.global) {
this.once('config',
this.createLink.bind(this, port, name, destination, destName));
- Create a ticketCreate a ticket
Function removeLink
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Manager.prototype.removeLink = function (port, name) {
var reverse = this.hub.getDestination(name),
rflow = this.reverseFlowMap[name],
i;
- Create a ticketCreate a ticket
Function setup
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Manager.prototype.setup = function (port) {
if (!port.id) {
this.debug.warn("Refusing to setup unidentified port ");
return false;
}
- Create a ticketCreate a ticket
Function createLink
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Manager.prototype.createLink = function (port, name, destination, destName,
toDest) {
if (!this.config.global) {
this.once('config',
this.createLink.bind(this, port, name, destination, destName));
- Read upRead up
- Create a ticketCreate a ticket
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 createLink
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Manager.prototype.createLink = function (port, name, destination, destName,
toDest) {
- Create a ticketCreate a ticket
Function forgetFlow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Manager.prototype.forgetFlow = function (id, name) {
var i;
if (this.dataFlows[id]) {
for (i = 0; i < this.dataFlows[id].length; i += 1) {
if (this.dataFlows[id][i] === name) {
- Read upRead up
- Create a ticketCreate a ticket
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"