conveyal/modeify

View on GitHub
client/components/conveyal/transitive.js/master/lib/graph/index.js

Summary

Maintainability
D
3 days
Test Coverage

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');
Severity: Minor
Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 7 hrs to fix

    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
    Severity: Minor
    Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 3 hrs 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 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
    Severity: Major
    Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 2 hrs to fix

      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 = {
      Severity: Major
      Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 2 hrs to fix

        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) {
        Severity: Minor
        Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 1 hr to fix

          Function initComparisons has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          NetworkGraph.prototype.initComparisons = function() {
          
            this.bundleComparisons = {};
          
            each(this.vertices, function(vertex) {
          Severity: Minor
          Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 1 hr to fix

            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;
            
            
            Severity: Minor
            Found in client/components/conveyal/transitive.js/master/lib/graph/index.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 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;
            Severity: Minor
            Found in client/components/conveyal/transitive.js/master/lib/graph/index.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 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 = {
            Severity: Minor
            Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 55 mins 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

            Avoid too many return statements within this function.
            Open

                if (b.point && b.point.getType() === 'STOP') return 1;
            Severity: Major
            Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  if (a.point && a.point.getType() === 'STOP') return -1;
              Severity: Major
              Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 30 mins to fix

                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);
                Severity: Minor
                Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 25 mins 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

                There are no issues that match your filters.

                Category
                Status