File graph.js
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
import d3 from 'd3'
import { forEach } from 'lodash'
import MultiPoint from '../point/multipoint'
import { ccw, isOutwardVector, sm } from '../util'
Function apply2DOffsets
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
apply2DOffsets() {
this.initComparisons()
const 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
apply2DOffsets() {
this.initComparisons()
const alignmentBundles = {} // maps alignment ID to array of range-bounded bundles on that alignment
Function splitEdgeAtInternalPoints
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
splitEdgeAtInternalPoints(edge, points) {
let subEdgePoints = []
let newEdge
const newEdgeInfoArr = []
let fromVertex = edge.fromVertex
Function mergeVertices
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
mergeVertices(vertexArray) {
let xTotal = 0
let yTotal = 0
const vertexGroups = {
Function initComparisons
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
initComparisons() {
this.bundleComparisons = {}
forEach(this.vertices, (vertex) => {
const incidentGraphEdges = vertex.incidentEdges()
Function mergeEdges
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
mergeEdges(edge1, edge2) {
// check for infinite recursion loop case
if (
edge1.fromVertex === edge2.toVertex &&
edge2.fromVertex === edge1.toVertex
Function bounds
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
bounds() {
let xmax = null
let xmin = null
let ymax = null
let 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
mergeVertices(vertexArray) {
let xTotal = 0
let yTotal = 0
const 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
Function mergeEdges
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
mergeEdges(edge1, edge2) {
// check for infinite recursion loop case
if (
edge1.fromVertex === edge2.toVertex &&
edge2.fromVertex === edge1.toVertex
- 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 (a.point && a.point.getType() === 'STOP') return -1
Avoid too many return
statements within this function. Open
if (b.point && b.point.getType() === 'STOP') return 1