Showing 105 of 165 total issues
File edge.js
has 630 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { forEach } from 'lodash'
import {
ccw,
distance,
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'
File network.js
has 464 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { forEach } from 'lodash'
import Emitter from 'component-emitter'
import Stop from '../point/stop'
import Place from '../point/place'
Edge
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Edge {
/**
* Initialize a new edge
* @constructor
* @param {Point[]} pointArray - the internal Points for this Edge
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
File labeler.js
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { forEach } from 'lodash'
import measureText from 'measure-text'
import d3 from 'd3' // TODO: replace w/ other quadtree library
import { getFontSizeWithUnit } from '../util'
Function load
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
load(data) {
debug('loading', data)
// check data
if (!data) data = {}
Function getRenderCoords
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
getRenderCoords(fromOffsetPx, toOffsetPx, display, forward) {
const isBase = fromOffsetPx === 0 && toOffsetPx === 0
if (!this.baseRenderCoords && !isBase) {
this.calculateBaseRenderCoords(display)
Point
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Point {
constructor(data) {
for (const key in data) {
this[key] = data[key]
}
Function populateGraphEdges
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
populateGraphEdges() {
// vertex associated with the last vertex point we passed in this sequence
let lastVertex = null
// collection of 'internal' (i.e. non-vertex) points passed
File transitive.ts
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable camelcase */ // FIXME remove camel case
/* globals Display */
import d3 from 'd3'
import Emitter from 'component-emitter'
Function addSegmentsToQuadtree
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
addSegmentsToQuadtree() {
forEach(this.transitive.renderSegments, (segment) => {
if (segment.getType() !== 'TRANSIT') return
let lw = this.transitive.style.compute(
Function constructMergedMarker
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructMergedMarker(display) {
const dataArray = this.getRenderDataArray()
const xValues = []
const yValues = []
dataArray.forEach(function (data) {
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 constructor
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(data, network) {
this.network = network
for (const key in data) {
this[key] = data[key]
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
File styles.js
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import d3 from 'd3'
/**
* Scales for utility functions to use
*/
Function getBBox
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBBox() {
if (this.orientation === 'E') {
return {
height: this.textHeight,
width: this.textWidth,
Function calculateGeometry
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
calculateGeometry(cellSize, angleConstraint) {
// if(!this.hasTransit()) angleConstraint = 5;
angleConstraint = angleConstraint || 45
this.angleConstraintR = (angleConstraint * Math.PI) / 180
- 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 getRenderCoords
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
getRenderCoords(fromOffsetPx, toOffsetPx, display, forward) {
const isBase = fromOffsetPx === 0 && toOffsetPx === 0
if (!this.baseRenderCoords && !isBase) {
this.calculateBaseRenderCoords(display)
- 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"