nodetiles/nodetiles-core

View on GitHub

Showing 56 of 100 total issues

Avoid deeply nested control flow statements.
Open

          for (var k = coordinateSetSet.length - 1; k >= 0; k--) {
            bounds.minX = Math.min(bounds.minX, coordinateSetSet[k][0]);
            bounds.maxX = Math.max(bounds.maxX, coordinateSetSet[k][0]);
            bounds.minY = Math.min(bounds.minY, coordinateSetSet[k][1]);
            bounds.maxY = Math.max(bounds.maxY, coordinateSetSet[k][1]);
Severity: Major
Found in datasources/Shp.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

                  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 getShapes has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          getShapes: function(minX, minY, maxX, maxY, mapProjection, callback) {
        Severity: Minor
        Found in datasources/Shp.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

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

              getShapes: function(minX, minY, maxX, maxY, mapProjection, callback) {
            Severity: Minor
            Found in datasources/GeoJson.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        for (var k = coordinateSetSet.length - 1; k >= 0; k--) {
                          bounds.minX = Math.min(bounds.minX, coordinateSetSet[k][0]);
                          bounds.maxX = Math.max(bounds.maxX, coordinateSetSet[k][0]);
                          bounds.minY = Math.min(bounds.minY, coordinateSetSet[k][1]);
                          bounds.maxY = Math.max(bounds.maxY, coordinateSetSet[k][1]);
              Severity: Major
              Found in datasources/GeoJson.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 _filterByExtent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    _filterByExtent: function(dataset, minX, minY, maxX, maxY) {
                  Severity: Minor
                  Found in datasources/Shp.js - About 35 mins to fix

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

                      _filterByExtent: function(dataset, minX, minY, maxX, maxY) {
                    Severity: Minor
                    Found in datasources/GeoJson.js - About 35 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

                        Function tileJson has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports.tileJson = function tileJson(options) {
                          var options = options || {},
                              path = options.path;
                            
                          if (!options.path) {
                        Severity: Minor
                        Found in lib/routes.js - About 35 mins 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 utfGrid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports.utfGrid = function utfGrid(options){
                          var options = options || {},
                              map = options.map,
                              format;
                              
                        Severity: Minor
                        Found in lib/routes.js - About 35 mins 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

                        Avoid too many return statements within this function.
                        Open

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

                          Function getShapes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            getShapes: function(minX, minY, maxX, maxY, mapProjection, callback) {
                              if (this._projectedData[mapProjection]){
                                var data = this._filterByExtent(this._projectedData[mapProjection], minX, minY, maxX, maxY);
                                callback(null, data);
                              }
                          Severity: Minor
                          Found in datasources/GeoJson.js - About 25 mins 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 getShapes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            getShapes: function(minX, minY, maxX, maxY, mapProjection, callback) {
                              if (this._projectedData[mapProjection]){
                                var data = this._filterByExtent(this._projectedData[mapProjection], minX, minY, maxX, maxY);
                                callback(null, data);
                              }
                          Severity: Minor
                          Found in datasources/Shp.js - About 25 mins 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