nodetiles/nodetiles-core

View on GitHub

Showing 100 of 100 total issues

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

    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/Shp.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 _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 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

              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

                  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

                  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

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

                          this.name = options.name || options.path.slice(options.path.lastIndexOf("/") + 1);
                        Severity: Minor
                        Found in datasources/GeoJson.js and 1 other location - About 35 mins to fix
                        datasources/Shp.js on lines 10..10

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

                        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

                          this.name = options.name || options.path.slice(options.path.lastIndexOf("/") + 1);
                        Severity: Minor
                        Found in datasources/Shp.js and 1 other location - About 35 mins to fix
                        datasources/GeoJson.js on lines 10..10

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

                        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

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

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language