CartoDB/Windshaft

View on GitHub

Showing 49 of 59 total issues

Avoid too many return statements within this function.
Open

        return callback(null, new Renderer(urlTemplate, subdomains, rendererOptions));
Severity: Major
Found in lib/renderers/http/factory.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

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

      Function getRenderer has a Cognitive Complexity of 6 (exceeds 5 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 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 getRenderer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          getRenderer (mapConfig, format, options, callback) {
              const layerNumber = options.layer;
              const layer = mapConfig.getLayer(layerNumber);
              const urlTemplate = layer.options.urlTemplate;
      
      
      Severity: Minor
      Found in lib/renderers/http/factory.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 _finish_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          _finish_request: function (key) {
              // Remove from requests in process
              var pos = this._requests_in_process.indexOf(key);
              if (pos >= 0) {
                  this._requests_in_process.splice(pos, 1);
      Severity: Minor
      Found in examples/viewer/leaflet.utfgrid.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 getSimplifyExtent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function getSimplifyExtent (layers, vectorExtent) {
          let undef = 0;
          const extents = [...new Set(layers.map(layer => {
              if (layer.options.vector_simplify_extent === undefined) {
                  undef++;
      Severity: Minor
      Found in lib/models/mapconfig.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 checkValidType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function checkValidType (e, type) {
          if (['number', 'float'].indexOf(type) > -1) {
              return typeof e.value === 'number';
          } else if (type === 'string') {
              return e.value !== 'undefined' && typeof e.value === 'string';
      Severity: Minor
      Found in lib/renderers/torque/factory.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 typeName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function typeName (cname) {
          let tname = cname;
      
          if (cname.match('bool')) {
              tname = 'boolean';
      Severity: Minor
      Found in lib/renderers/torque/psql-adaptor.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 getRenderer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          getRenderer (mapConfig, format, options, callback) {
              const layerNumber = options.layer;
              const layer = mapConfig.getLayer(layerNumber);
      
              if (layer.type !== this.getName()) {
      Severity: Minor
      Found in lib/renderers/plain/factory.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