CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/cartodb/models/carto.js

Summary

Maintainability
F
1 wk
Test Coverage

File carto.js has 794 lines of code (exceeds 250 allowed). Consider refactoring.
Open



carto_quotables = [
  'text-face-name'
];
Severity: Major
Found in lib/assets/javascripts/cartodb/models/carto.js - About 1 day to fix

    Function _extract has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

      _extract: function(method, extractVariables) {
        var columns = [];
        if (this.ruleset) {
          var definitions = this.ruleset.toList(this.parse_env);
          for (var d in definitions) {
    Severity: Minor
    Found in lib/assets/javascripts/cartodb/models/carto.js - About 4 hrs 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 parse has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

      parse: function(cartocss) {
        var self = this;
        var parse_env = this.parse_env = {
          validation_data: false,
          frames: [],
    Severity: Minor
    Found in lib/assets/javascripts/cartodb/models/carto.js - About 3 hrs 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 cluster_sql has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    function cluster_sql(table, zoom, props, nquartiles) {
    
      var grids = ["A", "B", "C", "D", "E"];
      var bucket = "bucket" + grids[0];
      var mainBucket = bucket;
    Severity: Minor
    Found in lib/assets/javascripts/cartodb/models/carto.js - About 3 hrs 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 density_generator has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function density_generator(table, props, changed, callback) {
      var carto_props = {
       'line-color': props['line-color'],
       'line-opacity': props['line-opacity'],
       'line-width': props['line-width'],
    Severity: Major
    Found in lib/assets/javascripts/cartodb/models/carto.js - About 3 hrs to fix

      Function parse has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        parse: function(cartocss) {
          var self = this;
          var parse_env = this.parse_env = {
            validation_data: false,
            frames: [],
      Severity: Major
      Found in lib/assets/javascripts/cartodb/models/carto.js - About 2 hrs to fix

        Function cluster_sql has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function cluster_sql(table, zoom, props, nquartiles) {
        
          var grids = ["A", "B", "C", "D", "E"];
          var bucket = "bucket" + grids[0];
          var mainBucket = bucket;
        Severity: Major
        Found in lib/assets/javascripts/cartodb/models/carto.js - About 2 hrs to fix

          Function cluster_generator has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function cluster_generator(table, props, changed, callback) {
          
            var methodMap = {
              '2 Buckets': 2,
              '3 Buckets': 3,
          Severity: Major
          Found in lib/assets/javascripts/cartodb/models/carto.js - About 2 hrs to fix

            Function choropleth_generator has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function choropleth_generator(table, props, changed, callback) {
              var type = table.geomColumnTypes() && table.geomColumnTypes()[0] || "polygon";
            
              var carto_props = manage_choropleth_props(type,props);
            
            
            Severity: Major
            Found in lib/assets/javascripts/cartodb/models/carto.js - About 2 hrs to fix

              Function choropleth_generator has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function choropleth_generator(table, props, changed, callback) {
                var type = table.geomColumnTypes() && table.geomColumnTypes()[0] || "polygon";
              
                var carto_props = manage_choropleth_props(type,props);
              
              
              Severity: Minor
              Found in lib/assets/javascripts/cartodb/models/carto.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 bubble_generator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function bubble_generator(table, props, changed, callback) {
                var carto_props = {
                 'marker-fill': props['marker-fill'],
                 'marker-line-color': props['marker-line-color'],
                 'marker-line-width': props['marker-line-width'],
              Severity: Minor
              Found in lib/assets/javascripts/cartodb/models/carto.js - About 1 hr to fix

                Function _generateCarto has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _generateCarto: function(){
                      var self = this;
                      var gen = this.generators[this.get('type')];
                
                      var gen_type = this.get('type');
                Severity: Minor
                Found in lib/assets/javascripts/cartodb/models/carto.js - About 1 hr to fix

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

                  function manage_carto_properies(props) {
                  
                    if(/none/i.test(props['text-name']) || !props['text-name']) {
                      // remove all text-* properties
                      for(var p in props) {
                  Severity: Minor
                  Found in lib/assets/javascripts/cartodb/models/carto.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 _extract has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _extract: function(method, extractVariables) {
                      var columns = [];
                      if (this.ruleset) {
                        var definitions = this.ruleset.toList(this.parse_env);
                        for (var d in definitions) {
                  Severity: Minor
                  Found in lib/assets/javascripts/cartodb/models/carto.js - About 1 hr to fix

                    Function _colorsFromRule has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _colorsFromRule: function(rule) {
                        var self = this;
                        function searchRecursiveByType(v, t) {
                          var res = []
                          for(var i in v) {
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/carto.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 _varsFromRule has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _varsFromRule: function(rule) {
                        function searchRecursiveByType(v, t) {
                          var res = []
                          for(var i in v) {
                            if(v[i] instanceof t) {
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/carto.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 manage_choropleth_props has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function manage_choropleth_props(type, props) {
                      var carto_props = {
                        'marker-width': props['marker-width'],
                        'marker-fill-opacity': props['marker-opacity'],
                        'marker-line-width': props['marker-line-width'],
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/carto.js - About 1 hr to fix

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

                        _parseError: function(errors) {
                          var parsedErrors = [];
                          for(var i in errors) {
                            var err = errors[i];
                            if(err && err.length > 0) {
                      Severity: Minor
                      Found in lib/assets/javascripts/cartodb/models/carto.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

                      Avoid deeply nested control flow statements.
                      Open

                                  for(var f in def.filters) {
                                    var filter = def.filters[f];
                                    for (var k in filter) {
                                      var filter_key = filter[k]
                                      if (filter_key.key && filter_key.key.value) {
                      Severity: Major
                      Found in lib/assets/javascripts/cartodb/models/carto.js - About 45 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return true;
                        Severity: Major
                        Found in lib/assets/javascripts/cartodb/models/carto.js - About 30 mins to fix

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

                            _checkValidType: function(e, type){
                              if (["number", "float"].indexOf(type) > -1) {
                                return typeof e.value === "number";
                              }
                              else if (type === "string"){
                          Severity: Minor
                          Found in lib/assets/javascripts/cartodb/models/carto.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

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

                              function searchRecursiveByType(v, t) {
                                var res = []
                                for(var i in v) {
                                  if(v[i] instanceof t) {
                                    res.push(v[i]);
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 4 hrs to fix
                          lib/assets/javascripts/cartodb/models/carto.js on lines 917..930

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

                          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

                              function searchRecursiveByType(v, t) {
                                var res = []
                                for(var i in v) {
                                  if(v[i] instanceof t) {
                                    res.push(v[i]);
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 4 hrs to fix
                          lib/assets/javascripts/cartodb/models/carto.js on lines 899..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 124.

                          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

                            getRuleByName: function(definition, ruleName) {
                              if (!definition._rulesByName) {
                                var rulesMap = definition._rulesByName = {};
                                for (var r in definition.rules) {
                                  var rule = definition.rules[r];
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 3 hrs to fix
                          lib/assets/javascripts/builder/helpers/parser-css.js on lines 343..352

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

                          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(err && err.length > 0) {
                                  var g = err.match(/.*:(\d+):(\d+)\s*(.*)/);
                                  if(g) {
                                    parsedErrors.push({
                                      line: parseInt(g[1], 10),
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 2 hrs to fix
                          lib/assets/javascripts/cartodb/table/menu_modules/carto_editor.js on lines 298..313

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

                          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

                              var parse_env = this.parse_env = {
                                validation_data: false,
                                frames: [],
                                errors: [],
                                error: function(obj) {
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 2 hrs to fix
                          lib/assets/javascripts/builder/helpers/parser-css.js on lines 21..29

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

                          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

                                for(var i in defs){
                                  if(defs[i].elements.length > 0){
                                      if(defs[i].elements[0].value === "Map"){
                                          mapDef = defs.splice(i, 1)[0];
                                      }
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 1 hr to fix
                          lib/assets/javascripts/builder/helpers/parser-css.js on lines 55..61

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

                          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

                            variablesUsed: function() {
                          
                              // extraction method
                              var method = function(self, rule) {
                                return _.map(self._varsFromRule(rule), function(f) {
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 1 hr to fix
                          lib/assets/javascripts/builder/helpers/parser-css.js on lines 308..317

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

                          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 (def.zoom === 8388607 && _.size(def.filters.filters) === 0 && def.attachment === '__default__') {
                                  rules = rules.concat(def.rules);
                                }
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 1 hr to fix
                          lib/assets/javascripts/builder/helpers/parser-css.js on lines 331..333

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

                          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

                            _checkValidColor: function(e){
                              var expectedArguments = { rgb: 3, hsl: 3, rgba: 4, hsla: 4};
                              return typeof e.rgb !== "undefined" || expectedArguments[e.name] === e.args;
                            },
                          Severity: Major
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 1 hr to fix
                          lib/assets/javascripts/builder/helpers/parser-css.js on lines 126..129

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

                          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

                                this.registerGenerator('torque_cat',     cdb.admin.carto.torque_cat.generate.bind(cdb.admin.carto.torque_cat));
                          Severity: Minor
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 40 mins to fix
                          lib/assets/javascripts/cartodb/models/carto.js on lines 655..655

                          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

                                this.registerGenerator('torque_heat',     cdb.admin.carto.torque.torque_generator.bind(cdb.admin.carto.torque));
                          Severity: Minor
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 40 mins to fix
                          lib/assets/javascripts/cartodb/models/carto.js on lines 656..656

                          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

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

                          cdb.admin.CartoParser = function(cartocss) {
                            this.parse_env = null;
                            this.ruleset = null;
                            if(cartocss) {
                              this.parse(cartocss);
                          Severity: Minor
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 35 mins to fix
                          lib/assets/javascripts/builder/helpers/parser-css.js on lines 8..14

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

                          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

                                for(var i = 0; i < rows.length; ++i) {
                                  quartiles.push(rows[i].maxdensity);
                                }
                          Severity: Minor
                          Found in lib/assets/javascripts/cartodb/models/carto.js and 1 other location - About 35 mins to fix
                          lib/assets/javascripts/cartodb/models/map.js on lines 72..74

                          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

                          There are no issues that match your filters.

                          Category
                          Status