Showing 105 of 165 total issues
Function refreshRenderData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
refreshRenderData(display) {
if (
this.graphEdge.fromVertex.x === this.graphEdge.toVertex.x &&
this.graphEdge.fromVertex.y === this.graphEdge.toVertex.y
) {
- 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 render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(display) {
const styler = display.styler
this.renderData = []
forEach(this.renderedEdges, (rEdge) => {
Consider simplifying this complex logical expression. Open
if (
mode === 'WALK' ||
mode === 'BICYCLE' ||
mode === 'BICYCLE_RENT' ||
mode === 'CAR' ||
Function annotateTransitPoints
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
annotateTransitPoints() {
this.paths.forEach(function (path) {
const transitSegments = []
path.segments.forEach(function (pathSegment) {
if (pathSegment.type === 'TRANSIT') transitSegments.push(pathSegment)
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 initMarkerData
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
initMarkerData(display) {
if (this.getType() !== 'STOP' && this.getType() !== 'MULTI') return
this.mergedMarkerData = this.constructMergedMarker(display)
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
super.render()
const display = this.transitive.display
const network = this.transitive.network
Function coordAlongRefEdge
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
coordAlongRefEdge(targetDistance, coords, refCoordinates = coords) {
// our current location along the edge (in world units)
let currentLocation = 0
for (let i = 1; i < refCoordinates.length; i++) {
const distanceToNextCoord = refCoordinates[i].len
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 createRenderedEdge
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
createRenderedEdge(pathSegment, gEdge, forward, patterns) {
let rEdge
// construct the edge key, disregarding mode qualifiers (e.g. "_RENT")
const type = pathSegment.getType().split('_')[0]
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(display) {
super.render(display)
const styler = display.styler
if (!this.renderData) return
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(display) {
super.render(display)
if (this.patternCount === 0) return
Function decode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function decode(polyline) {
let currentPosition = 0
let currentLat = 0
let currentLng = 0
Function constructMergedMarker
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
constructMergedMarker(display) {
const dataArray = this.getRenderDataArray()
const xValues = []
const yValues = []
dataArray.forEach(function (data) {
- 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 createRenderedSegments
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
createRenderedSegments() {
this.reLookup = {}
this.renderedEdges = []
this.renderedSegments = []
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(display) {
const text = this.getText()
if (!text || !this.labelAnchor) return
const anchor = {
Function createInternalVertexPoints
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
createInternalVertexPoints() {
this.internalVertexPoints = []
for (const i in this.graph.edgeGroups) {
const edgeGroup = this.graph.edgeGroups[i]
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(display) {
super.render(display)
if (!this.renderData) return
Function lineIntersection
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function lineIntersection(x1, y1, x2, y2, x3, y3, x4, y4) {
Function rayIntersection
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function rayIntersection(ax, ay, avx, avy, bx, by, bvx, bvy) {