conveyal/modeify

View on GitHub

Showing 580 of 580 total issues

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

router.get('/suggest/:text', function (req, res) {
  suggest(req.params.text, function (err, suggestions) {
    if (err) {
      res.status(400).send(err)
    } else {
Severity: Major
Found in lib/geocode.js and 1 other location - About 3 hrs to fix
lib/geocode.js on lines 55..63

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

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

module.exports = function(points) {
  var newPoints, i, r;

  // determine if we need to resample the path (i.e. place new points at a regular
  // interval for marker-based styling) based on styler settings

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

  this.addSegmentsToQuadtree = function() {

    var disp = this.transitive.display;
    this.transitive.renderSegments.forEach(function(segment) {

Severity: Major
Found in client/components/conveyal/transitive.js/master/lib/labeler/index.js - About 2 hrs to fix

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

    request.post = function(url, data, fn){
      var req = request('POST', url);
      if ('function' == typeof data) fn = data, data = null;
      if (data) req.send(data);
      if (fn) req.end(fn);
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1012..1018
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1030..1036
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1063..1069
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1099..1105

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

    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 5 locations. Consider refactoring.
    Open

    request.head = function(url, data, fn){
      var req = request('HEAD', url);
      if ('function' == typeof data) fn = data, data = null;
      if (data) req.send(data);
      if (fn) req.end(fn);
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1012..1018
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1063..1069
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1081..1087
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1099..1105

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

    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 5 locations. Consider refactoring.
    Open

    request.patch = function(url, data, fn){
      var req = request('PATCH', url);
      if ('function' == typeof data) fn = data, data = null;
      if (data) req.send(data);
      if (fn) req.end(fn);
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1012..1018
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1030..1036
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1081..1087
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1099..1105

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

    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 5 locations. Consider refactoring.
    Open

    request.put = function(url, data, fn){
      var req = request('PUT', url);
      if ('function' == typeof data) fn = data, data = null;
      if (data) req.send(data);
      if (fn) req.end(fn);
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1012..1018
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1030..1036
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1063..1069
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1081..1087

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

    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 (o.access && o.access.length > 0) {
        var access = o.access[0]
        var accessMode = access.mode.toLowerCase()
    
        addStreetEdges(o, accessMode, access.streetEdges)
    Severity: Major
    Found in client/components/conveyal/otp-profile-score/master/index.js and 1 other location - About 2 hrs to fix
    client/components/conveyal/otp-profile-score/master/index.js on lines 198..205

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

    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 (o.egress && o.egress.length > 0) {
        var egress = o.egress[0]
        var egressMode = egress.mode.toLowerCase()
    
        addStreetEdges(o, egressMode, egress.streetEdges)
    Severity: Major
    Found in client/components/conveyal/otp-profile-score/master/index.js and 1 other location - About 2 hrs to fix
    client/components/conveyal/otp-profile-score/master/index.js on lines 188..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 92.

    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 5 locations. Consider refactoring.
    Open

    request.get = function(url, data, fn){
      var req = request('GET', url);
      if ('function' == typeof data) fn = data, data = null;
      if (data) req.query(data);
      if (fn) req.end(fn);
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1030..1036
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1063..1069
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1081..1087
    client/components/visionmedia/superagent/v1.1.0/lib/client.js on lines 1099..1105

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

    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 apply2DOffsets has 69 lines of code (exceeds 25 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: Major
    Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 2 hrs to fix

      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

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

        TextBinding.prototype.subscribe = function(){
          var self = this;
          var reactive = this.reactive;
          this.props.forEach(function(prop){
            reactive.sub(prop, function(){
        client/components/ianstormtaylor/reactive/0.13.2/lib/attr-binding.js on lines 39..47

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

        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

        Organization.loadAll = function (ctx, next) {
          Organization.all(function (err, orgs, res) {
            if (err || !res.ok) {
              next(err || res.text)
            } else {
        Severity: Major
        Found in client/organization/index.js and 1 other location - About 2 hrs to fix
        client/service-alert/index.js on lines 31..40

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

        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

        AttrBinding.prototype.subscribe = function(){
          var self = this;
          var reactive = this.reactive;
          this.props.forEach(function(prop){
            reactive.sub(prop, function(){
        client/components/ianstormtaylor/reactive/0.13.2/lib/text-binding.js on lines 37..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 90.

        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

        ServiceAlert.loadAll = function (ctx, next) {
          ServiceAlert.all(function (err, alerts, res) {
            if (err || !res.ok) {
              next(err || res.text)
            } else {
        Severity: Major
        Found in client/service-alert/index.js and 1 other location - About 2 hrs to fix
        client/organization/index.js on lines 46..55

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

        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

        View.prototype.profile = function () {
          this.model.profile(function (err) {
            if (err) {
              ConfirmModal({
                text: 'Failed to profile commuters.',
        Severity: Major
        Found in client/location-page/index.js and 1 other location - About 2 hrs to fix
        client/location-page/index.js on lines 201..215

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

        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.delete('/:id', byId, function (req, res) {
          req.organization.remove(function (err) {
            if (err) {
              res.status(400).send(err)
            } else {
        Severity: Major
        Found in lib/organization/index.js and 1 other location - About 2 hrs to fix
        lib/model-router.js on lines 97..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 88.

        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.delete('/:id', byId, function (req, res) {
            req[slug].remove(function (err) {
              if (err) {
                res.status(400).send(err)
              } else {
        Severity: Major
        Found in lib/model-router.js and 1 other location - About 2 hrs to fix
        lib/organization/index.js on lines 89..97

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

        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

        Severity
        Category
        Status
        Source
        Language