conveyal/modeify

View on GitHub

Showing 301 of 580 total issues

Function modelRouter has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function modelRouter (opts, fn) {
  var router = express.Router()
  var middleware = opts.middleware || []
  var Model = opts.model
  var name = opts.name || Model.modelName
Severity: Major
Found in lib/model-router.js - About 2 hrs to fix

    Function end has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    Batch.prototype.end = function(cb){
      var self = this
        , total = this.fns.length
        , pending = total
        , results = []
    Severity: Minor
    Found in client/components/visionmedia/batch/0.5.2/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 MemoryStats has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var MemoryStats = function () {
      var msMin = 100
      var msMax = 0
      var performance = window.performance
    
    
    Severity: Major
    Found in client/stats/memory-stats.js - About 2 hrs to fix

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

      module.exports = function (commuter, plan) {
        var welcome = new Welcome(commuter)
        var locations = new Locations({
          'locations-view': new LocationsView(plan),
          plan: plan,
      Severity: Major
      Found in client/welcome-flow/index.js - About 2 hrs to fix

        Function getBBox has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          this.getBBox = function() {
        
            if (this.orientation === 'E') {
              return {
                x: this.labelAnchor.x,

          Function tally has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ProfileScore.prototype.tally = function (o) {
            // Defaults
            o.bikeCalories = 0
            o.calories = 0
            o.cost = 0
          Severity: Major
          Found in client/components/conveyal/otp-profile-score/master/index.js - About 2 hrs to fix

            Function exports has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function (opts, fn) {
              if (opts.closable && !opts.logo) opts.template = closableHtml + opts.template
              if (!opts.noPadding) opts.template = '<div class="content">' + opts.template + '</div>'
            
              // Wrap with a logo nav
            Severity: Minor
            Found in client/modal/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 populate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            function populate(els, data) {
              for (var i = 0, el; el = els[i]; i++) {
                var val = data[el.getAttribute('name')];
                if (val !== undefined) {
            
            
            Severity: Minor
            Found in client/components/trevorgerhardt/serialize/0.0.1/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 calculateGeometry has a Cognitive Complexity of 19 (exceeds 5 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: Minor
            Found in client/components/conveyal/transitive.js/master/lib/graph/edge.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 a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function (obj, iterator, context) {
                if (obj == null) return;
                if (nativeForEach && obj.forEach === nativeForEach) {
                    obj.forEach(iterator, context);
                } else if (obj.length === +obj.length) {
            Severity: Minor
            Found in client/components/manuelstofer/each/master/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 a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function (Model) {
              Model
                .attr('coordinate')
                .attr('address')
                .attr('original_address')
            Severity: Minor
            Found in client/model-geo/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 onclick has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              function onclick(e) {
            
                if (1 !== which(e)) return;
            
                if (e.metaKey || e.ctrlKey || e.shiftKey) return;
            Severity: Minor
            Found in client/components/visionmedia/page.js/1.6.1/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 continue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            Modal.prototype.continue = function (e) {
              e.preventDefault()
              var selections = {
                commuterId: this.find('.commuter-id-select').value,
                email: this.find('.email-select').value,
            Severity: Minor
            Found in client/location-page/commuter-upload-modal.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 a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function (r5) {
              const routeIdxToId = {}
              r5.patterns.forEach((pattern) => {
                routeIdxToId[pattern.routeIdx] = pattern.routeId
              })
            Severity: Minor
            Found in lib/plan/r5-to-otp.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 TileLayer has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function TileLayer(opts) {
              debug('creating the tile layer');
            
              var el = opts.el;
              var display = opts.display;

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

              module.exports = function (opts, fn) {
                if (opts.closable && !opts.logo) opts.template = closableHtml + opts.template
                if (!opts.noPadding) opts.template = '<div class="content">' + opts.template + '</div>'
              
                // Wrap with a logo nav
              Severity: Major
              Found in client/modal/index.js - About 2 hrs to fix

                Function Display has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function Display(transitive) {
                  this.transitive = transitive;
                  var el = this.el = transitive.el;
                  this.width = el.clientWidth;
                  this.height = el.clientHeight;
                Severity: Major
                Found in client/components/conveyal/transitive.js/master/lib/display/index.js - About 2 hrs to fix

                  File model.js has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  const mongoosePaginate = require('mongoose-paginate')
                  
                  const {getAccount} = require('../auth0')
                  const Email = require('../email/model')
                  const Commuter = require('../commuter/model')
                  Severity: Minor
                  Found in lib/commuter-locations/model.js - About 2 hrs to fix

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

                    function makeAuthResponseHandler (alertIfFailed, callback) {
                      return (authErr, authResult) => {
                        const idToken = authResult ? authResult.idToken : null
                        if (authErr || !idToken) {
                          store('auth0IdToken', null)
                    Severity: Major
                    Found in client/session/index.js - About 2 hrs to fix

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

                      SignUpModal.prototype.save = function (e) {
                        e.preventDefault()
                        log('submit')
                      
                        var alerts = this.find('.alerts')
                      Severity: Major
                      Found in client/rideshare-sign-up/index.js - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language