conveyal/transitive.js

View on GitHub

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
    ) {
Severity: Minor
Found in lib/renderer/renderededge.js - About 1 hr to fix

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) => {
Severity: Minor
Found in lib/renderer/renderedsegment.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

        if (
          mode === 'WALK' ||
          mode === 'BICYCLE' ||
          mode === 'BICYCLE_RENT' ||
          mode === 'CAR' ||
    Severity: Critical
    Found in lib/styler/styler.js - About 1 hr to fix

      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)
      Severity: Minor
      Found in lib/core/network.js - About 1 hr to fix

        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
        Severity: Minor
        Found in lib/graph/graph.js - About 1 hr to fix

          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)
          
          
          Severity: Minor
          Found in lib/point/point.js - About 1 hr to fix

            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
            Severity: Minor
            Found in lib/renderer/default-renderer.js - About 1 hr to fix

              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
              Severity: Minor
              Found in lib/graph/edge.js - About 1 hr to fix

                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
                Severity: Minor
                Found in lib/graph/graph.js - About 1 hr to fix

                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]
                Severity: Minor
                Found in lib/core/network.js - About 1 hr to fix

                  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
                  
                  
                  Severity: Minor
                  Found in lib/point/place.js - About 1 hr to fix

                    Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render(display) {
                        super.render(display)
                    
                        if (this.patternCount === 0) return
                    
                    
                    Severity: Minor
                    Found in lib/point/stop.js - About 1 hr to fix

                      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
                      Severity: Minor
                      Found in lib/util/polyline.js - About 1 hr to fix

                        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) {
                        Severity: Minor
                        Found in lib/point/point.js - About 1 hr to fix

                        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 = []
                        
                        
                        Severity: Minor
                        Found in lib/core/network.js - About 1 hr to fix

                          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 = {
                          Severity: Minor
                          Found in lib/labeler/pointlabel.js - About 1 hr to fix

                            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]
                            Severity: Minor
                            Found in lib/core/network.js - About 1 hr to fix

                              Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                render(display) {
                                  super.render(display)
                              
                                  if (!this.renderData) return
                              
                              
                              Severity: Minor
                              Found in lib/point/multipoint.js - About 1 hr to fix

                                Function lineIntersection has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                function lineIntersection(x1, y1, x2, y2, x3, y3, x4, y4) {
                                Severity: Major
                                Found in lib/util/index.js - About 1 hr to fix

                                  Function rayIntersection has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  function rayIntersection(ax, ay, avx, avy, bx, by, bvx, bvy) {
                                  Severity: Major
                                  Found in lib/util/index.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language