nodetiles/nodetiles-core

View on GitHub

Showing 100 of 100 total issues

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

    Consider simplifying this complex logical expression.
    Open

            if (selectorIsMatch(style.selector, feature, source)) {
              style = style.properties;
              
              ctx.fillStyle = style.fillStyle || style['background-color'] || '';
              ctx.strokeStyle = style.strokeStyle || style['line-color'] || '';
    Severity: Critical
    Found in lib/renderer.js - About 1 hr to fix

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

        if (this.name.indexOf(".") !== -1) {
          this.name = this.name.slice(0, this.name.indexOf("."));
        }
      Severity: Major
      Found in datasources/GeoJson.js and 1 other location - About 1 hr to fix
      datasources/Shp.js on lines 11..13

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

      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

        if (this.name.indexOf(".") !== -1) {
          this.name = this.name.slice(0, this.name.indexOf("."));
        }
      Severity: Major
      Found in datasources/Shp.js and 1 other location - About 1 hr to fix
      datasources/GeoJson.js on lines 11..13

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

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

      var renderGrid = exports.renderGrid = function(minX, minY, maxX, maxY, width, height, layers, styles, featureImage, callback) {
      Severity: Major
      Found in lib/renderer.js - About 1 hr to fix

        Function encodeAsObject has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          encodeAsObject: function() {
            var grid = {
              grid: [],
              keys: [""],
              data: {}
        Severity: Minor
        Found in lib/utfgrid.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 load has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          load: function(callback) {
            if (this._data || this._loadError) {
              callback(this._loadError, this._data);
              return;
            }
        Severity: Minor
        Found in datasources/GeoJson.js - About 1 hr to fix

          Function gridRenderer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var gridRenderer = function (ctx, scale, layers, styles) {
            var intColor = 1; // color zero is black/empty; so start with 1
            colorIndex = ['']; // make room for black/empty
            
            
          Severity: Minor
          Found in lib/renderer.js - About 1 hr to fix

            Function renderGrid has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var renderGrid = exports.renderGrid = function(minX, minY, maxX, maxY, width, height, layers, styles, featureImage, callback) {
              var canvas = new Canvas(width, width),
                  ctx = canvas.getContext('2d'),
                  // we're using the same ratio for width and height, so the actual maxY may not match specified maxY...
                  pxPtRatio = width / (maxX - minX),
            Severity: Minor
            Found in lib/renderer.js - About 1 hr to fix

              Function tilePng has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                return function tilePng(req, res, next){
                  var tileCoordinate, format, bounds;
                  
                  // verify arguments (don't forget jsonp!)
                  tileCoordinate = req.path.match(/(\d+)\/(\d+)\/(\d+)\.(png|json|jsonp)$/);
              Severity: Minor
              Found in lib/routes.js - About 1 hr to fix

                Function renderImage has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                var renderImage = exports.renderImage = function(minX, minY, maxX, maxY, width, height, layers, styles, callback) {
                Severity: Major
                Found in lib/renderer.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

                  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/renderer.js and 1 other location - About 1 hr to fix
                  lib/cartoRenderer.js on lines 1020..1027

                  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

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

                    _calculateBounds: function(dataset) {
                      return this._shapes(dataset).forEach(function(shape) {
                        shape.bounds = this._shapeBounds(shape);
                      }, this);
                    },
                  Severity: Major
                  Found in datasources/Shp.js and 1 other location - About 1 hr to fix
                  datasources/GeoJson.js on lines 115..119

                  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

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

                    _calculateBounds: function(dataset) {
                      return this._shapes(dataset).forEach(function(shape) {
                        shape.bounds = this._shapeBounds(shape);
                      }, this);
                    },
                  Severity: Major
                  Found in datasources/GeoJson.js and 1 other location - About 1 hr to fix
                  datasources/Shp.js on lines 107..111

                  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

                  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

                  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

                    Function intersects has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var intersects = function(a, b) {
                      var xIntersects = (a.minX < b.maxX && a.minX > b.minX) ||
                        (a.maxX < b.maxX && a.maxX > b.minX) ||
                        (a.minX < b.minX && a.maxX > b.maxX);
                    
                    
                    Severity: Minor
                    Found in datasources/Shp.js - About 55 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 intersects has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var intersects = function(a, b) {
                      var xIntersects = (a.minX < b.maxX && a.minX > b.minX) ||
                                        (a.maxX < b.maxX && a.maxX > b.minX) ||
                                        (a.minX < b.minX && a.maxX > b.maxX);
                                        
                    Severity: Minor
                    Found in datasources/GeoJson.js - About 55 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 Point has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      'Point': function(inProjection, outProjection, c) {
                        if (inProjection && outProjection) {
                          var inProjectionCode = inProjection instanceof Proj4js.Proj ?
                            'EPSG:' + inProjection.srsProjNumber : inProjection;
                          var outProjectionCode = outProjection instanceof Proj4js.Proj ?
                    Severity: Minor
                    Found in lib/projector.js - About 55 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