conveyal/modeify

View on GitHub

Showing 301 of 580 total issues

Function pathtoRegexp has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function pathtoRegexp (path, keys, options) {
  if (keys && !Array.isArray(keys)) {
    options = keys;
    keys = null;
  }
Severity: Major
Found in client/components/pillarjs/path-to-regexp/v1.0.1/index.js - About 2 hrs to fix

    Function updateTable has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    View.prototype.updateTable = function () {
      var users = this.users || []
    
      var fromDate = moment(this.fromDatePicker.getDate())
      var toDate = moment(this.toDatePicker.getDate())
    Severity: Minor
    Found in client/user-activity-page/index.js - About 2 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 Labeler has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    var Labeler = augment(Object, function() {
    
      this.constructor = function(transitive) {
    
        this.transitive = transitive;
    Severity: Minor
    Found in client/components/conveyal/transitive.js/master/lib/labeler/index.js - About 2 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 exports has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (r5) {
      const routeIdxToId = {}
      r5.patterns.forEach((pattern) => {
        routeIdxToId[pattern.routeIdx] = pattern.routeId
      })
    Severity: Major
    Found in lib/plan/r5-to-otp.js - About 2 hrs to fix

      Function requestPlan has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.requestPlan = function (plan) {
        if (config.r5 || process.env.TEST_R5_URL) {
          const r5Url = config.r5 ? config.r5.url : process.env.TEST_R5_URL
          const timezoneName = geoTz.tz(plan.from.lat, plan.from.lon)
          if (!timezoneName) {
      Severity: Major
      Found in lib/r5.js - About 2 hrs to fix

        File index.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var filePicker = require('component-file-picker')
        var parse = require('csv-parse/lib/sync')
        
        var L = require('leaflet')
        require('leaflet.markercluster')
        Severity: Minor
        Found in client/location-page/index.js - About 2 hrs to fix

          Function itinerary has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          View.prototype.itinerary = function () {
            var access = this.model.access()[0]
            var egress = this.model.egress()
            var segments = this.model.transit()
            var length = segments.length
          Severity: Major
          Found in client/route-directions-table/index.js - About 2 hrs to fix

            Function exports has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var View = module.exports = view(require('./template.html'), function (view, plan) {
              plan.on('change', function (name) {
                view.resetIcons()
            
                if (name === 'from') view.find('#from-location').value = plan.from()
            Severity: Major
            Found in client/locations-view/index.js - About 2 hrs to fix

              Function getGeometricCoords has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Edge.prototype.getGeometricCoords = function(fromOffsetPx, toOffsetPx, display, forward) {
                var coords = [], lastX = null, lastY = null;
              
                // reverse the coords array if needed
                var geomCoords = forward ? this.geomCoords : this.geomCoords.concat().reverse();
              Severity: Major
              Found in client/components/conveyal/transitive.js/master/lib/graph/edge.js - About 2 hrs to fix

                Function focusPath has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  this.focusPath = function(path) {
                
                    var self = this;
                    var pathRenderedSegments = [];
                    var graph = this.transitive.network.graph;

                  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 exports has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function (route, opts) {
                      opts = opts || {}
                    
                      var accessMode = route.access()[0].mode.toLowerCase()
                    
                    
                    Severity: Major
                    Found in client/route-summary-segments/index.js - About 2 hrs to fix

                      Function send has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Request.prototype.send = function(data){
                        var obj = isObject(data);
                        var type = this.getHeader('Content-Type');
                      
                        // merge
                      Severity: Minor
                      Found in client/components/visionmedia/superagent/v1.1.0/lib/client.js - About 2 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 constructMergedMarker has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        this.constructMergedMarker = function(display) {
                      
                          var dataArray = this.getRenderDataArray();
                          var xValues = [],
                            yValues = [];
                      Severity: Major
                      Found in client/components/conveyal/transitive.js/master/lib/point/index.js - About 2 hrs to fix

                        Function generateQuery has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        Plan.prototype.generateQuery = function () {
                          var from = this.from_ll() || {}
                          var to = this.to_ll() || {}
                        
                          // Transit modes
                        Severity: Major
                        Found in client/plan/index.js - About 2 hrs to fix

                          Function calculateGeometry has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Edge.prototype.calculateGeometry = function(cellSize, angleConstraint) {
                            //if(!this.hasTransit()) angleConstraint = 5;
                            angleConstraint = angleConstraint || 45;
                          
                            this.angleConstraintR = angleConstraint * Math.PI / 180;
                          Severity: Major
                          Found in client/components/conveyal/transitive.js/master/lib/graph/edge.js - About 2 hrs to fix

                            Function Journey has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function Journey(data, network) {
                            
                              this.network = network;
                            
                              for (var key in data) {
                            Severity: Major
                            Found in client/components/conveyal/transitive.js/master/lib/core/journey.js - About 2 hrs to fix

                              Function MemoryStats has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                              var MemoryStats = function () {
                                var msMin = 100
                                var msMax = 0
                                var performance = window.performance
                              
                              
                              Severity: Minor
                              Found in client/stats/memory-stats.js - About 2 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 intersect has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                              RenderedEdge.prototype.intersect = function(rEdge) {
                              
                                // do no intersect adjacent edges of unequal bundle size
                                if (this.graphEdge.renderedEdges.length !== rEdge.graphEdge.renderedEdges.length) return;
                              
                              

                              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 getDomains has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function getDomains(display, height, width, bounds, options) {
                                var xmin = bounds[0][0],
                                  xmax = bounds[1][0];
                                var ymin = bounds[0][1],
                                  ymax = bounds[1][1];
                              Severity: Major
                              Found in client/components/conveyal/transitive.js/master/lib/display/index.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language