nodetiles/nodetiles-core

View on GitHub

Showing 100 of 100 total issues

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

  _shapeBounds: function(shape) {
    shape = shape.geometry || shape;
    var coordinates = shape.coordinates;
    
    if (shape.type === "Point") {
Severity: Minor
Found in datasources/GeoJson.js - About 2 hrs to fix

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

    var selectorIsMatch = function(selector, feature, source) {
      var matches = true;
      for (var key in selector) {
        if (key === "source") {
          matches = matches && selector[key] === source;
    Severity: Minor
    Found in lib/renderer.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

            this._renderer.renderImage(__.extend({}, options, {
              layers: shapes,
              styles: this.processedStyles,
              callback: function(error, canvas) {
                options.callback && options.callback(error, canvas);
    Severity: Major
    Found in lib/Map.js and 1 other location - About 1 hr to fix
    lib/Map.js on lines 68..74

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

    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._renderer.renderGrid(__.extend({}, options, {
              layers: shapes,
              styles: this.processedStyles,
              callback: function(error, canvas) {
                options.callback && options.callback(error, canvas);
    Severity: Major
    Found in lib/Map.js and 1 other location - About 1 hr to fix
    lib/Map.js on lines 48..54

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

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

    var imageRenderer = function (ctx, scale, layers, styles) {
      // background first
      styles.forEach(function(style) {
        if (selectorIsMatch(style.selector)) {
          if (style.properties["background-color"]) {
    Severity: Minor
    Found in lib/renderer.js - About 1 hr to fix

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

      suite
        .add('FeatureCollection', function() {
          projector.project.FeatureCollection("EPSG:4326", "EPSG:900913", data);
        })
        .add('Feature', function() {
      Severity: Major
      Found in test_perf/projector.js and 1 other location - About 1 hr to fix
      test_perf/projector.js on lines 16..32

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

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

        _shapes: function(feature) {
          var shapes = [];
          if (feature.type === "FeatureCollection") {
            for (var i = feature.features.length - 1; i >= 0; i--) {
              shapes = shapes.concat(this._shapes(feature.features[i]));
      Severity: Minor
      Found in datasources/GeoJson.js - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

        _shapes: function(feature) {
          var shapes = [];
          if (feature.type === "FeatureCollection") {
            for (var i = feature.features.length - 1; i >= 0; i--) {
              shapes = shapes.concat(this._shapes(feature.features[i]));
      Severity: Minor
      Found in datasources/Shp.js - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

      var cartoImageRenderer = function (ctx, scale, layers, styles, zoom, minX, maxX, minY) {
        // background first
        styles.forEach(function(style) {
          if (cartoSelectorIsMatch(style, null, null, zoom)) {
            style.rules.forEach(function(rule) {
      Severity: Minor
      Found in lib/cartoRenderer.js - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

        'MultiPoint': function(text, p, scale) {
          // Can't use forEach here because we need to pass scale along
          for (var i = 0, len = p.length; i < len; i++) {
            renderText.Point.call(this, radius, p[i], scale);
          }
      Severity: Major
      Found in lib/cartoRenderer.js and 2 other locations - About 1 hr to fix
      lib/cartoRenderer.js on lines 313..318
      lib/cartoRenderer.js on lines 348..353

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

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

        'MultiPoint': function(image, p, scale) {
          // Can't use forEach here because we need to pass scale along
          for (var i = 0, len = p.length; i < len; i++) {
            renderImage.Point.call(this, image, p[i], scale);
          }
      Severity: Major
      Found in lib/cartoRenderer.js and 2 other locations - About 1 hr to fix
      lib/cartoRenderer.js on lines 348..353
      lib/cartoRenderer.js on lines 565..570

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

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

        'MultiPoint': function(radius, p, scale) {
          // Can't use forEach here because we need to pass scale along
          for (var i = 0, len = p.length; i < len; i++) {
            renderDot.Point.call(this, radius, p[i], scale);
          }
      Severity: Major
      Found in lib/cartoRenderer.js and 2 other locations - About 1 hr to fix
      lib/cartoRenderer.js on lines 313..318
      lib/cartoRenderer.js on lines 565..570

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

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

        _screenLine: function(dashArray, start, end, realLength, angle, offset) {
          // we're gonna do some transforms
          this.save();
          
          // move the line out by half a pixel for more crisp 1px drawing
      Severity: Minor
      Found in lib/cartoRenderer.js - About 1 hr to fix

        Function cartoSelectorIsMatch has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var cartoSelectorIsMatch = function(definition, feature, source, zoom) {
          // ZOOM
          var supportedZooms = definition.zoom;
          // 8388607 is all zooms
          if (supportedZooms && supportedZooms !== 8388607) {
        Severity: Minor
        Found in lib/cartoRenderer.js - About 1 hr to fix

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

              'MultiPoint': function(p, scale) {
                  // Can't use forEach here because we need to pass scale along
                  for (var i = 0, len = p.length; i < len; i++) {
                    renderPath.Point.call(this, p[i], scale);
                  }
          Severity: Major
          Found in lib/cartoRenderer.js and 1 other location - About 1 hr to fix
          lib/renderer.js on lines 146..151

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

          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

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

              'MultiPoint': function(p, scale) {
                  // Can't use forEach here because we need to pass scale along
                  for (var i = 0, len = p.length; i < len; i++) {
                    renderPath.Point.call(this, p[i], scale);
                  }
          Severity: Major
          Found in lib/renderer.js and 1 other location - About 1 hr to fix
          lib/cartoRenderer.js on lines 137..142

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

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

          module.exports.utfGrid = function utfGrid(options){
            var options = options || {},
                map = options.map,
                format;
                
          Severity: Minor
          Found in lib/routes.js - About 1 hr to fix

            Function _screenLine has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              _screenLine: function(dashArray, start, end, realLength, angle, offset) {
                // we're gonna do some transforms
                this.save();
                
                // move the line out by half a pixel for more crisp 1px drawing
            Severity: Minor
            Found in lib/cartoRenderer.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function imageRenderer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            var imageRenderer = function (ctx, scale, layers, styles) {
              // background first
              styles.forEach(function(style) {
                if (selectorIsMatch(style.selector)) {
                  if (style.properties["background-color"]) {
            Severity: Minor
            Found in lib/renderer.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function deepEqual has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var deepEqual = function(a, b) {
              try {
              var aKeys = Object.keys(a),
                  bKeys = Object.keys(b);
              }
            Severity: Minor
            Found in lib/renderer.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language