conveyal/modeify

View on GitHub

Showing 580 of 580 total issues

Function Stop has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Stop = augment(Point, function(base) {

  this.constructor = function(data) {
    base.constructor.call(this, data);

Severity: Major
Found in client/components/conveyal/transitive.js/master/lib/point/stop.js - About 6 hrs to fix

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

    var Batch = require('batch')
    var model = require('component-model')
    var qs = require('component-querystring')
    const typ = require('component-type')
    const ll = require('@conveyal/lonlat')
    Severity: Minor
    Found in client/plan/index.js - About 5 hrs to fix

      File client.js has 414 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * Module dependencies.
       */
      
      var Emitter = require('emitter');
      Severity: Minor
      Found in client/components/visionmedia/superagent/v1.1.0/lib/client.js - About 5 hrs to fix

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

        router.get('/profile', authenticateUser, function (req, res) {
          CommuterLocations
            .findCommutersAndProfiles(req.query._location)
            .then((cls) => {
              return CommuterLocations.profile(cls, () => {
        Severity: Major
        Found in lib/commuter-locations/api.js and 1 other location - About 5 hrs to fix
        lib/commuter-locations/api.js on lines 77..90

        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 148.

        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

        router.get('/profile-and-match', authenticateUser, function (req, res) {
          CommuterLocations
            .findCommutersAndProfiles(req.query._location)
            .then((cls) => {
              return CommuterLocations.profileAndMatch(cls, () => {
        Severity: Major
        Found in lib/commuter-locations/api.js and 1 other location - About 5 hrs to fix
        lib/commuter-locations/api.js on lines 92..105

        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 148.

        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

        File network.js has 389 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var each = require('each');
        var debug = require('debug')('transitive:network');
        var Emitter = require('emitter');
        
        var NetworkPath = require('./path');
        Severity: Minor
        Found in client/components/conveyal/transitive.js/master/lib/core/network.js - About 5 hrs to fix

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

          function get (req, res, next) {
            ServiceAlert
              .findById(req.params.id)
              .exec()
              .then(servicealert => {
          Severity: Major
          Found in lib/service-alerts/index.js and 1 other location - About 4 hrs to fix
          lib/commuter/index.js on lines 105..119

          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 131.

          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

          function get (req, res, next) {
            Commuter
              .findById(req.params.id)
              .exec()
              .then(commuter => {
          Severity: Major
          Found in lib/commuter/index.js and 1 other location - About 4 hrs to fix
          lib/service-alerts/index.js on lines 46..60

          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 131.

          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

            describe('suggest', () => {
              it('should make basic suggest query', (done) => {
                nock('https://geocode.arcgis.com/')
                  .get(/arcgis\/rest\/services\/World\/GeocodeServer\/suggest/)
                  .reply(200, (uri, requestBody) => {
          Severity: Major
          Found in __tests__/lib/geocode.js and 1 other location - About 4 hrs to fix
          __tests__/lib/geocode.js on lines 12..27

          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 130.

          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

            describe('encode', () => {
              it('should make basic encode query', (done) => {
                nock('https://geocode.arcgis.com/')
                  .get(/arcgis\/rest\/services\/World\/GeocodeServer\/findAddressCandidates/)
                  .reply(200, (uri, requestBody) => {
          Severity: Major
          Found in __tests__/lib/geocode.js and 1 other location - About 4 hrs to fix
          __tests__/lib/geocode.js on lines 54..69

          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 130.

          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

            } else {
              manager.grantManagementPermission(org._id(), function (err) {
                if (err) {
                  alerts.show({
                    type: 'danger',
          Severity: Major
          Found in client/manager-page/index.js and 1 other location - About 4 hrs to fix
          client/manager-page/index.js on lines 30..45

          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 128.

          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

            if (this.isAdmin()) {
              manager.revokeManagementPermission(org._id(), function (err) {
                if (err) {
                  alerts.show({
                    type: 'danger',
          Severity: Major
          Found in client/manager-page/index.js and 1 other location - About 4 hrs to fix
          client/manager-page/index.js on lines 45..60

          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 128.

          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 SphericalMercator has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          var SphericalMercator = (function() {
          
            // Closures including constants and other precalculated values.
            var cache = {},
              EPSLN = 1.0e-10,

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

          var SphericalMercator = (function() {
          
            // Closures including constants and other precalculated values.
            var cache = {},
              EPSLN = 1.0e-10,

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

              for (var i = 0; i < this.renderedEdges.length; i++) {
                var rEdge = this.renderedEdges[i];
                var edgeRenderLen = rEdge.graphEdge.getRenderLength(display);
                if (loc <= cur + edgeRenderLen) {
                  var t2 = (loc - cur) / edgeRenderLen;
            client/components/conveyal/transitive.js/master/lib/labeler/labeledgegroup.js on lines 59..67

            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 123.

            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

              for (var i = 0; i < this.renderedEdges.length; i++) {
                var rEdge = this.renderedEdges[i];
                var edgeRenderLen = rEdge.graphEdge.getRenderLength(display);
                if (loc <= cur + edgeRenderLen) {
                  var t2 = (loc - cur) / edgeRenderLen;
            client/components/conveyal/transitive.js/master/lib/renderer/renderedsegment.js on lines 187..195

            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 123.

            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

              this.runFocusTransition = function(display, callback) {
                if (this.mergedMarker) {
                  var newStrokeColor = display.styler.compute(display.styler.stops_merged
                    .stroke, display, {
                      owner: this
            client/components/conveyal/transitive.js/master/lib/point/multipoint.js on lines 245..255

            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 123.

            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

              this.runFocusTransition = function(display, callback) {
                if (this.mergedMarker) {
                  var newStrokeColor = display.styler.compute(display.styler.multipoints_merged
                    .stroke, display, {
                      owner: this
            client/components/conveyal/transitive.js/master/lib/point/stop.js on lines 245..255

            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 123.

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

            Edge.prototype.getRenderCoords = function(fromOffsetPx, toOffsetPx, display, forward) {
              var fromOffsetX, fromOffsetY;
              var isBase = (fromOffsetPx === 0 && toOffsetPx === 0);
            
              if (!this.baseRenderCoords && !isBase) {
            Severity: Major
            Found in client/components/conveyal/transitive.js/master/lib/graph/edge.js - About 4 hrs to fix

              Function Place has 104 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var Place = augment(Point, function(base) {
              
                /**
                 *  the constructor
                 */
              Severity: Major
              Found in client/components/conveyal/transitive.js/master/lib/point/place.js - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language