CartoDB/Windshaft

View on GitHub

Showing 49 of 59 total issues

Function getRenderer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getRenderer (mapConfig, format, options, callback) {
        if (mapConfig.isVectorOnlyMapConfig() && format !== PgMvtFactory.MVT_FORMAT) {
            const error = new Error(`Unsupported format: 'cartocss' option is missing for ${format}`);
            error.http_status = 400;
            error.type = 'tile';
Severity: Minor
Found in lib/renderers/pg-mvt/factory.js - About 1 hr to fix

    Function _update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _update: function () {
    
            var bounds = this._map.getPixelBounds(),
                zoom = this._map.getZoom(),
                tileSize = this.options.tileSize;
    Severity: Minor
    Found in examples/viewer/leaflet.utfgrid.js - About 1 hr to fix

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

      async function fetchLayerAttributes (psql, layer) {
          try {
              const attrs = checkLayerAttributes(layer);
              const layerSql = SubstitutionTokens.replaceXYZ(layer.options.sql, { x: 0, y: 0, z: 0 });
      
      
      Severity: Minor
      Found in lib/renderers/torque/factory.js - About 1 hr to fix

        Function constructor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            constructor (options) {
                this._mapnikOptions = Object.assign({}, {
                    geometry_field: 'the_geom_webmercator',
        
                    // Metatile is the number of tiles-per-side that are going
        Severity: Minor
        Found in lib/renderers/mapnik/factory.js - About 1 hr to fix

          Function getImage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getImage (options, callback) {
                  const { mapConfigProvider, format, width, height, zoom, center, bbox } = options;
          
                  this._rendererCache.getRenderer(mapConfigProvider, (err, renderer) => {
                      if (err) {
          Severity: Minor
          Found in lib/backends/preview.js - About 1 hr to fix

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

            L.Util.ajax = function (url, timeout, success, error) {
            
                if (window.XMLHttpRequest === undefined) {
                    error(new Error("XMLHttpRequest is not supported"));
                }
            Severity: Minor
            Found in examples/viewer/leaflet.utfgrid.js - About 1 hr to fix

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

                  _loadTileP: function (zoom, x, y) {
                      var head = document.getElementsByTagName('head')[0],
                          key = zoom + '_' + x + '_' + y,
                          functionName = 'lu_' + key,
                          wk = this._windowKey,
              Severity: Minor
              Found in examples/viewer/leaflet.utfgrid.js - About 1 hr to fix

                Function getTilesFromImage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getTilesFromImage (image, x, y, imageBuffer, tileSize) {
                    const tiles = [];
                    const imageWidth = image.width();
                    const imageHeight = image.height();
                
                
                Severity: Minor
                Found in lib/renderers/plain/image-renderer.js - About 1 hr to fix

                  Function getStats has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      getStats () {
                          const stats = new Map();
                          const rendererCacheEntries = Object.entries(this.renderers);
                  
                          stats.set('rendercache.count', rendererCacheEntries.length);
                  Severity: Minor
                  Found in lib/cache/renderer-cache.js - About 1 hr to fix

                    Function _validateRemaningFormatLayers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _validateRemaningFormatLayers (mapConfigProvider, mapConfig, params) {
                            const token = mapConfig.id();
                            const validateRemainingFormatLayerPromises = [];
                    
                            mapConfig.getLayers().forEach((layer, layerId) => {
                    Severity: Minor
                    Found in lib/backends/map-validator.js - About 1 hr to fix

                      Function validateLayer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function validateLayer (mapConfig, layerIndex) {
                          const layer = mapConfig.getLayer(layerIndex);
                          const layerOptions = layer.options;
                      
                          if (!mapConfig.isVectorOnlyMapConfig()) {
                      Severity: Minor
                      Found in lib/renderers/mapnik/factory.js - About 45 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 getTilesFromImage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function getTilesFromImage (image, x, y, imageBuffer, tileSize) {
                          const tiles = [];
                          const imageWidth = image.width();
                          const imageHeight = image.height();
                      
                      
                      Severity: Minor
                      Found in lib/renderers/plain/image-renderer.js - About 45 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 attrsFromCartoCSS has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function attrsFromCartoCSS (cartocss, required) {
                          const attrsKeys = {
                              '-torque-frame-count': 'steps',
                              '-torque-resolution': 'resolution',
                              '-torque-animation-duration': 'animationDuration',
                      Severity: Minor
                      Found in lib/renderers/torque/factory.js - About 45 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 values has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function values (value, allValues) {
                          allValues = allValues || [];
                      
                          if (value.is === 'value' || value.is === 'expression') {
                              if (Array.isArray(value.value)) {
                      Severity: Minor
                      Found in lib/utils/cartocss-utils.js - About 45 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 mapConfigToMMLBuilderConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function mapConfigToMMLBuilderConfig (mapConfig, rendererOptions, mapnikOptions) {
                          const options = {
                              ids: [],
                              sql: [],
                              originalSql: [],
                      Severity: Minor
                      Found in lib/renderers/mapnik/factory.js - About 45 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 getTilesFromImage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function getTilesFromImage (image, x, y, imageBuffer, tileSize) {
                      Severity: Minor
                      Found in lib/renderers/plain/image-renderer.js - About 35 mins to fix

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

                        function getSQL (attributes, pg, layer, params, testMode) {
                        Severity: Minor
                        Found in lib/backends/attributes.js - About 35 mins to fix

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

                              getTimes () {
                                  const times = {};
                          
                                  for (const [label, stat] of Object.entries(this.times)) {
                                      if (stat.start && stat.end) {
                          Severity: Minor
                          Found in lib/stats/timer.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 colorRenderer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function colorRenderer (color, options, callback) {
                              let mapnikColor;
                          
                              try {
                                  if (Array.isArray(color)) {
                          Severity: Minor
                          Found in lib/renderers/plain/factory.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 getRenderer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              getRenderer (mapConfig, format, options, callback) {
                                  const isMvt = format === FORMAT_MVT;
                          
                                  if (mapConfig.isVectorOnlyMapConfig() && !isMvt) {
                                      const error = new Error(`Unsupported format: 'cartocss' option is missing for ${format}`);
                          Severity: Minor
                          Found in lib/renderers/mapnik/factory.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

                          Severity
                          Category
                          Status
                          Source
                          Language