File index.js
has 480 lines of code (exceeds 250 allowed). Consider refactoring. Open
var d3 = require('d3');
var debug = require('debug')('transitive:graph');
var each = require('each');
var clone = require('clone');
var PriorityQueue = require('priorityqueuejs');
Function apply2DOffsets
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
NetworkGraph.prototype.apply2DOffsets = function() {
this.initComparisons();
var alignmentBundles = {}; // maps alignment ID to array of range-bounded bundles on that alignment
- 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 apply2DOffsets
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
NetworkGraph.prototype.apply2DOffsets = function() {
this.initComparisons();
var alignmentBundles = {}; // maps alignment ID to array of range-bounded bundles on that alignment
Function mergeVertices
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
NetworkGraph.prototype.mergeVertices = function(vertexArray) {
var xTotal = 0,
yTotal = 0;
var vertexGroups = {
Function splitEdgeAtInternalPoints
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
NetworkGraph.prototype.splitEdgeAtInternalPoints = function(edge, points) {
var subEdgePoints = [],
newEdge, newEdgeInfoArr = [];
var fromVertex = edge.fromVertex;
each(edge.pointArray, function(point) {
Function initComparisons
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
NetworkGraph.prototype.initComparisons = function() {
this.bundleComparisons = {};
each(this.vertices, function(vertex) {
Function sortVertices
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
NetworkGraph.prototype.sortVertices = function() {
this.vertices.sort(function(a, b) {
if (a.point && a.point.getType() === 'PLACE') return -1;
if (b.point && b.point.getType() === 'PLACE') return 1;
- 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 bounds
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
NetworkGraph.prototype.bounds = function() {
var xmax = null,
xmin = null;
var ymax = null,
ymin = null;
- 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 mergeVertices
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
NetworkGraph.prototype.mergeVertices = function(vertexArray) {
var xTotal = 0,
yTotal = 0;
var vertexGroups = {
- 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 too many return
statements within this function. Open
if (b.point && b.point.getType() === 'STOP') return 1;
Avoid too many return
statements within this function. Open
if (a.point && a.point.getType() === 'STOP') return -1;
Function mergeEdges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
NetworkGraph.prototype.mergeEdges = function(edge1, edge2) {
// reverse edges if necessary
if (edge1.fromVertex === edge2.toVertex) {
this.mergeEdges(edge2, edge1);
- 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"