nodetiles/nodetiles-core

View on GitHub

Showing 56 of 100 total issues

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

              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

                  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

                  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

                    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

                      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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language