conveyal/modeify

View on GitHub

Showing 580 of 580 total issues

Function Stats has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Stats = function () {
  var startTime = Date.now()
  var prevTime = startTime
  var ms = 0
  var msMin = Infinity
Severity: Major
Found in client/stats/stats.js - About 4 hrs to fix

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

    module.exports = function (schema, options) {
      /**
       * Add address and coordinate fields
       */
    
    
    Severity: Major
    Found in lib/plugins/mongoose-geocode.js - About 4 hrs to fix

      Function setAddress has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Plan.prototype.setAddress = function (name, locationData, callback) {
        callback = callback || function () {} // noop callback
        if (
          !locationData &&
          (
      Severity: Major
      Found in client/plan/index.js - About 4 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        Styler.prototype.styleMultiPoint = function(display, multipoint) {
          this.applyAttrAndStyle(
            display,
            multipoint.svgGroup.selectAll('.transitive-multipoint-marker-pattern'),
            this.multipoints_pattern
        client/components/conveyal/transitive.js/master/lib/styler/index.js on lines 194..212

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 113.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        Styler.prototype.stylePlace = function(display, place) {
          this.applyAttrAndStyle(
            display,
            place.svgGroup.selectAll('.transitive-place-circle'),
            this.places
        client/components/conveyal/transitive.js/master/lib/styler/index.js on lines 221..239

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 113.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        User.prototype.revokeManagementPermission = function (org, callback) {
          request.get('/users/' + this.id() + '/remove-from-group', {
            group: 'organization-' + org + '-manager'
          }, function (err, res) {
            if (err || !res.ok) {
        Severity: Major
        Found in client/user/index.js and 1 other location - About 3 hrs to fix
        client/user/index.js on lines 63..73

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 112.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        User.prototype.grantManagementPermission = function (org, callback) {
          request.get('/users/' + this.id() + '/add-to-group', {
            group: 'organization-' + org + '-manager'
          }, function (err, res) {
            if (err || !res.ok) {
        Severity: Major
        Found in client/user/index.js and 1 other location - About 3 hrs to fix
        client/user/index.js on lines 110..120

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 112.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function updateRoutes has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function updateRoutes (plan, opts, callback) {
          opts = opts || {}
        
          const done = function (err, res) {
            if (err) {
        Severity: Major
        Found in client/plan/update-routes.js - About 3 hrs to fix

          Function View has 94 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var View = view(require('./template.html'), function (view, model) {
            var scorer = new ProfileScorer()
          
            view.on('rendered', function () {
              try {
          Severity: Major
          Found in client/commute-analysis-page/index.js - About 3 hrs to fix

            Function end has a Cognitive Complexity of 26 (exceeds 5 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: Minor
            Found in client/components/visionmedia/superagent/v1.1.0/lib/client.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

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

            var convert = require('../convert')
            var model = require('component-model')
            var defaults = require('../components/segmentio/model-defaults/0.2.0')
            var each = require('component-each')
            
            
            Severity: Minor
            Found in client/route/index.js - About 3 hrs to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              RenderedEdge.prototype.addPattern = function(pattern) {
                if (!this.patterns) this.patterns = [];
                if (this.patterns.indexOf(pattern) !== -1) return;
                this.patterns.push(pattern);
              
              
              client/components/conveyal/transitive.js/master/lib/renderer/renderededge.js on lines 45..52

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 104.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    geocode(locationData, (err, res) => {
                      if (err) {
                        return callback(err)
                      } else {
                        location.coordinate(res)
              Severity: Major
              Found in client/plan/index.js and 1 other location - About 3 hrs to fix
              client/plan/index.js on lines 280..291

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 104.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    geocode(address, locationData.magicKey, (err, res) => {
                      if (err) {
                        return callback(err)
                      } else {
                        location.coordinate(res)
              Severity: Major
              Found in client/plan/index.js and 1 other location - About 3 hrs to fix
              client/plan/index.js on lines 294..305

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 104.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                reactive.bind('data-hidden', function(el, name){
                  this.change(function(){
                    if (this.value(name)) {
                      classes(el).remove('visible').add('hidden');
                    } else {
              client/components/ianstormtaylor/reactive/0.13.2/lib/bindings.js on lines 71..79

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 104.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              RenderedEdge.prototype.addPathSegment = function(pathSegment) {
                if (!this.pathSegments) this.pathSegments = [];
                if (this.pathSegments.indexOf(pathSegment) !== -1) return;
                this.pathSegments.push(pathSegment);
              
              
              client/components/conveyal/transitive.js/master/lib/renderer/renderededge.js on lines 36..43

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 104.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                reactive.bind('data-visible', function(el, name){
                  this.change(function(){
                    if (this.value(name)) {
                      classes(el).add('visible').remove('hidden');
                    } else {
              client/components/ianstormtaylor/reactive/0.13.2/lib/bindings.js on lines 85..93

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 104.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

              Network.prototype.load = function(data) {
                debug('loading', data);
                var self = this;
              
                // check data
              Severity: Major
              Found in client/components/conveyal/transitive.js/master/lib/core/network.js - About 3 hrs to fix

                Function Point has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                var Point = augment(Object, function() {
                
                  this.constructor = function(data) {
                    for (var key in data) {
                      this[key] = data[key];
                Severity: Minor
                Found in client/components/conveyal/transitive.js/master/lib/point/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

                Severity
                Category
                Status
                Source
                Language