conveyal/modeify

View on GitHub

Showing 301 of 580 total issues

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

var d3 = require('d3');
var debug = require('debug')('transitive:display');
var each = require('each');

var Legend = require('./legend');
Severity: Minor
Found in client/components/conveyal/transitive.js/master/lib/display/index.js - About 2 hrs to fix

    File r5.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const geoTz = require('geo-tz')
    const fetch = require('isomorphic-fetch')
    const moment = require('moment-timezone')
    
    const config = require('./config')
    Severity: Minor
    Found in lib/r5.js - About 2 hrs to fix

      Function end has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Request.prototype.end = function(fn){
        var self = this;
        var xhr = this.xhr = request.getXHR();
        var query = this._query.join('&');
        var timeout = this._timeout;
      Severity: Major
      Found in client/components/visionmedia/superagent/v1.1.0/lib/client.js - About 2 hrs to fix

        Function notifyManagers has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        schema.statics.notifyManagers = function (_location) {
          // get the location
          Location.findById(_location, (err, location) => {
            if (err) {
              log.error('Could not find locations', err)
        Severity: Major
        Found in lib/commuter-locations/model.js - About 2 hrs to fix

          Function end has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Batch.prototype.end = function(cb){
            var self = this
              , total = this.fns.length
              , pending = total
              , results = []
          Severity: Major
          Found in client/components/visionmedia/batch/0.5.2/index.js - About 2 hrs to fix

            Function placePointLabels has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              this.placePointLabels = function() {
            
                var styler = this.transitive.styler;
            
                var labeledPoints = [];
            Severity: Major
            Found in client/components/conveyal/transitive.js/master/lib/labeler/index.js - About 2 hrs to fix

              Function setOrientation has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                this.setOrientation = function(orientation) {
                  this.orientation = orientation;
              
                  var markerBBox = this.parent.getMarkerBBox();
                  if (!markerBBox) return;

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

                module.exports = function (ctx, next) {
                  log('render')
                
                  var transitiveLayer
                  var plan = ctx.session.plan()
                Severity: Minor
                Found in client/planner-page/index.js - About 1 hr to fix

                  Function load has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  session.load = function (ctx, next) {
                    session.settings(store('session') || DEFAULT_SETTINGS)
                  
                    loadUser(function (err) {
                      if (err) return next(err)
                  Severity: Minor
                  Found in client/session/index.js - About 1 hr to fix

                    Function send has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports.send = function send (options, callback, template) {
                      if (process.env.NODE_ENV === 'test') {
                        if (options.to.email && options.template) {
                          return callback(null, {
                            _id: '123',
                    Severity: Minor
                    Found in lib/spark.js - About 1 hr to fix

                      Function setAddress has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Plan.prototype.setAddress = function (name, locationData, callback) {
                        callback = callback || function () {} // noop callback
                        if (
                          !locationData &&
                          (
                      Severity: Minor
                      Found in client/plan/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 load has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Network.prototype.load = function(data) {
                        debug('loading', data);
                        var self = this;
                      
                        // check data
                      Severity: Minor
                      Found in client/components/conveyal/transitive.js/master/lib/core/network.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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports.render = function (ctx, next) {
                        if (ctx.redirect) {
                          log('redirecting from %s to %s', decodeURIComponent(ctx.path), ctx.redirect)
                          return page.redirect(ctx.redirect + window.location.search)
                        }
                      Severity: Minor
                      Found in client/router-utils/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 refresh has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        this.refresh = function(panning) {
                          base.refresh.call(this, panning);
                      
                          var display = this.transitive.display;
                          var network = this.transitive.network;

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

                        module.exports = function(Model) {
                          /**
                           * Create `get` request
                           */
                        
                        
                        Severity: Minor
                        Found in client/components/trevorgerhardt/model-query/0.3.0/index.js - About 1 hr to fix

                          Function PointClusterMap has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function PointClusterMap(transitive) {
                            this.transitive = transitive;
                          
                            this.clusters = [];
                            this.clusterLookup = {}; // maps Point object to its containing cluster

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

                            module.exports = function() {
                              var size = [960, 500],
                                scale = 256,
                                translate = [size[0] / 2, size[1] / 2],
                                zoomDelta = 0;

                              Function placeSegmentLabels has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                this.placeSegmentLabels = function() {
                              
                                  each(this.segmentLabels, function(label) {
                                    label.clear();
                                  });

                                Function formatDepartureTimes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function formatDepartureTimes (times) {
                                  var hours = {}
                                  var maxPerHour = 0
                                  var text = ''
                                
                                
                                Severity: Minor
                                Found in client/route-directions-table/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 pathtoRegexp has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function pathtoRegexp (path, keys, options) {
                                  if (keys && !Array.isArray(keys)) {
                                    options = keys;
                                    keys = null;
                                  }
                                Severity: Minor
                                Found in client/components/pillarjs/path-to-regexp/v1.0.1/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

                                Severity
                                Category
                                Status
                                Source
                                Language