nodetiles/nodetiles-core

View on GitHub
lib/cartoRenderer.js

Summary

Maintainability
F
2 wks
Test Coverage

File cartoRenderer.js has 933 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var Canvas = require('canvas');
var carto = require("carto");
var UTFGrid = require('./utfgrid');
var fs = require('fs');
var path = require('path');
Severity: Major
Found in lib/cartoRenderer.js - About 2 days to fix

    Function LineString has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
    Open

      'LineString': function(text, l) {
        // we support line and point, point is default
        if (text.placement === "line") {
          this.textAlign = "left";
          
    Severity: Minor
    Found in lib/cartoRenderer.js - About 1 day 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 253 lines of code (exceeds 25 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: Major
    Found in lib/cartoRenderer.js - About 1 day to fix

      Function renderInstance has 192 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              var renderInstance = function(instanceName) {
                var instanceStyle = collapsedStyle[instanceName];
                
                ctx.save();
        
      Severity: Major
      Found in lib/cartoRenderer.js - About 7 hrs to fix

        Function LineString has 150 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          'LineString': function(text, l) {
            // we support line and point, point is default
            if (text.placement === "line") {
              this.textAlign = "left";
              
        Severity: Major
        Found in lib/cartoRenderer.js - About 6 hrs to fix

          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

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

                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

                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

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

                    var renderGrid = exports.renderGrid = function(options) {
                      var bounds = options.bounds;
                      var width = options.width;
                      var height = options.height;
                      var callback = options.callback;
                    Severity: Minor
                    Found in lib/cartoRenderer.js - About 1 hr to fix

                      Function LINE_DASH_PROPERTY has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      var LINE_DASH_PROPERTY = (function() {
                        var canvas = new Canvas(8, 8);
                        var ctx = canvas.getContext("2d");
                        var property = (ctx.dash && "dash") || (ctx.lineDash && "lineDash");
                        if (!property) {
                      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 cartoImageRenderer has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      var cartoImageRenderer = function (ctx, scale, layers, styles, zoom, minX, maxX, minY) {
                      Severity: Major
                      Found in lib/cartoRenderer.js - About 1 hr to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    for (var j = 0, jLen = fullText.length; j < jLen; j++) {
                                      // GO BACKWARDS FOR FLIPPED TEXT
                                      if (flippedText) {
                                          
                                        if (segmentOffset + segmentDistance + textPixels > segmentLength && (i < len - 1 || closedShape)) {
                        Severity: Major
                        Found in lib/cartoRenderer.js - About 45 mins to fix

                          Function _screenLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            _screenLine: function(dashArray, start, end, realLength, angle, offset) {
                          Severity: Minor
                          Found in lib/cartoRenderer.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                              if (instanceStyle["text-halo-radius"]) {
                                                ctx.lineWidth = instanceStyle["text-halo-radius"].value * 2;
                                              }
                            Severity: Major
                            Found in lib/cartoRenderer.js - About 45 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                        if (shouldFill || shouldStroke || shouldMark || shouldPoint || shouldText) {
                                          ctx.beginPath();
                                          var shape = feature.geometry || feature;
                                          var coordinates = shape.coordinates;
                                          renderPath[shape.type].call(ctx, coordinates, scale);
                              Severity: Major
                              Found in lib/cartoRenderer.js - About 40 mins to fix

                                Function cartoGridRenderer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                var cartoGridRenderer = function (ctx, scale, layers, styles, zoom) {
                                Severity: Minor
                                Found in lib/cartoRenderer.js - About 35 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                    return true;
                                  Severity: Major
                                  Found in lib/cartoRenderer.js - About 30 mins to fix

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

                                      if (featureImage) {
                                        callback(undefined, canvas);
                                      }
                                      else {
                                        var pixels = ctx.getImageData(0, 0, gridSize, gridSize).data; // array of all pixels
                                    Severity: Major
                                    Found in lib/cartoRenderer.js and 1 other location - About 1 day to fix
                                    lib/renderer.js on lines 81..104

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

                                    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

                                      'LineString': function(radius, l) {
                                        // put the point at the center
                                        var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
                                        l.forEach(function(point) {
                                          minX = Math.min(minX, point[0]);
                                    Severity: Major
                                    Found in lib/cartoRenderer.js and 1 other location - About 7 hrs to fix
                                    lib/cartoRenderer.js on lines 302..312

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

                                    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

                                      'LineString': function(image, l) {
                                        // put the point at the center
                                        var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
                                        l.forEach(function(point) {
                                          minX = Math.min(minX, point[0]);
                                    Severity: Major
                                    Found in lib/cartoRenderer.js and 1 other location - About 7 hrs to fix
                                    lib/cartoRenderer.js on lines 337..347

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

                                    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

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

                                    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

                                    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

                                    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

                                    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

                                    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

                                    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

                                    function d2h(d, digits) {
                                      d = d.toString(16); 
                                      while (d.length < digits) {
                                            d = '0' + d;
                                        }
                                    Severity: Major
                                    Found in lib/cartoRenderer.js and 1 other location - About 1 hr to fix
                                    lib/renderer.js on lines 268..275

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

                                    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 (!collapsedStyle[style.attachment]) {
                                                collapsedStyle[style.attachment] = {};
                                                attachmentOrder.push(style.attachment);
                                              }
                                    Severity: Minor
                                    Found in lib/cartoRenderer.js and 1 other location - About 40 mins to fix
                                    lib/cartoRenderer.js on lines 631..634

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

                                    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 (!collapsedStyle[rule.instance]) {
                                                    collapsedStyle[rule.instance] = {};
                                                    instanceOrder.push(rule.instance);
                                                  }
                                    Severity: Minor
                                    Found in lib/cartoRenderer.js and 1 other location - About 40 mins to fix
                                    lib/cartoRenderer.js on lines 909..912

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status