nodetiles/nodetiles-core

View on GitHub

Showing 100 of 100 total issues

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

    'LineString': function(l) {
        var start = l[0];
        if (transform) {
          start = transform(start);
        }
Severity: Major
Found in lib/renderer.js and 1 other location - About 4 hrs to fix
lib/cartoRenderer.js on lines 124..136

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

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

var cartoGridRenderer = function (ctx, scale, layers, styles, zoom) {
  var intColor = 1; // color zero is black/empty; so start with 1
  colorIndex = ['']; // make room for black/empty
  
  layers.forEach(function(layer, i) {
Severity: Major
Found in lib/cartoRenderer.js - About 3 hrs to fix

    Function cartoSelectorIsMatch has a Cognitive Complexity of 26 (exceeds 5 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 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

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

      _filterByExtent: function(dataset, minX, minY, maxX, maxY) {
        if (!FILTER_BY_EXTENTS) {
          return dataset;
        }
        
    Severity: Major
    Found in datasources/GeoJson.js and 1 other location - About 3 hrs to fix
    datasources/Shp.js on lines 113..129

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

    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

        'Point': function(p, scale) {
            if (transform) {
              p = transform(p);
              this.arc(p[0], p[1], 8, 0, Math.PI * 2, true);
            }
    Severity: Major
    Found in lib/renderer.js and 1 other location - About 3 hrs to fix
    lib/cartoRenderer.js on lines 143..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 102.

    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

      _filterByExtent: function(dataset, minX, minY, maxX, maxY) {
        if (!FILTER_BY_EXTENTS) {
          return dataset;
        }
    
    
    Severity: Major
    Found in datasources/Shp.js and 1 other location - About 3 hrs to fix
    datasources/GeoJson.js on lines 121..137

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

    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

        'Point': function(p, scale) {
            if (transform) {
              p = transform(p);
              this.arc(p[0], p[1], 8, 0, Math.PI * 2, true);
            }
    Severity: Major
    Found in lib/cartoRenderer.js and 1 other location - About 3 hrs to fix
    lib/renderer.js on lines 152..160

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

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

    exports.processStyles = function(styles, assetsPath) {
      var processed = [];
      var imageCache = {};
      
      styles.forEach(function(cartoString, index) {
    Severity: Major
    Found in lib/cartoRenderer.js - About 3 hrs to fix

      Function _shapeBounds has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

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

      Cognitive Complexity

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

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

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

      Further reading

      Function _shapeBounds has a Cognitive Complexity of 21 (exceeds 5 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

      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

        transform = function(p) {
          var point = [];
          point[0] = (p[0] - bounds.minX) * pxPtRatio;
          point[1] = ((p[1] - bounds.minY) * -pxPtRatio) + height;
          return point;
      Severity: Major
      Found in lib/cartoRenderer.js and 1 other location - About 2 hrs to fix
      lib/cartoRenderer.js on lines 45..50

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

      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

        transform = function(p) {
          var point = [];
          point[0] = (p[0] - bounds.minX) * pxPtRatio;
          point[1] = ((p[1] - bounds.minY) * -pxPtRatio) + height;
          return point;
      Severity: Major
      Found in lib/cartoRenderer.js and 1 other location - About 2 hrs to fix
      lib/cartoRenderer.js on lines 70..75

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

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

            var renderAttachment = function(attachmentName) {
              var attachmentStyle = collapsedStyle[attachmentName];
                
              ctx.save();
        
      Severity: Major
      Found in lib/cartoRenderer.js - About 2 hrs to fix

        File renderer.js has 259 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var Canvas = require('canvas');
        var UTFGrid = require('./utfgrid');
        var fs = require('fs');
        var path = require('path');
        var __ = require('lodash');
        Severity: Minor
        Found in lib/renderer.js - About 2 hrs to fix

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

                            var start = transform(l[i]),
                                end = transform(l[i + 1]),
                                dx = end[0] - start[0],
                                dy = end[1] - start[1],
                                angle = Math.atan2(dy, dx);
          Severity: Major
          Found in lib/cartoRenderer.js and 1 other location - About 2 hrs to fix
          lib/cartoRenderer.js on lines 476..480

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

          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

                            var start = transform(l[i]),
                                end = transform(l[i + 1]),
                                dx = end[0] - start[0],
                                dy = end[1] - start[1],
                                angle = Math.atan2(dy, dx);
          Severity: Major
          Found in lib/cartoRenderer.js and 1 other location - About 2 hrs to fix
          lib/cartoRenderer.js on lines 520..524

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

          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 deepEqual has a Cognitive Complexity of 16 (exceeds 5 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 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

            transform = function(p) {
              var point = [];
              point[0] = (p[0] - minX) * pxPtRatio;
              point[1] = ((p[1] - minY) * -pxPtRatio) + height;
              return point;
          Severity: Major
          Found in lib/renderer.js and 1 other location - About 2 hrs to fix
          lib/renderer.js on lines 27..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 75.

          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 _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/Shp.js - About 2 hrs to fix

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

              transform = function(p) {
                var point = [];
                point[0] = (p[0] - minX) * pxPtRatio;
                point[1] = ((p[1] - minY) * -pxPtRatio) + height;
                return point;
            Severity: Major
            Found in lib/renderer.js and 1 other location - About 2 hrs to fix
            lib/renderer.js on lines 62..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 75.

            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