CartoDB/cartodb20

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

Summary

Maintainability
F
2 wks
Test Coverage

File table.js has 834 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * models for cartodb admin
 */

(function() {
Severity: Major
Found in lib/assets/javascripts/cartodb/models/table.js - About 2 days to fix

    Function linkToInfowindow has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        linkToInfowindow: function(infowindow) {
          var self = this;
          this.bind('columnRename', function(newName, oldName) {
            if(infowindow.containsField(oldName)) {
              infowindow.removeField(oldName);
    Severity: Minor
    Found in lib/assets/javascripts/cartodb/models/table.js - About 1 hr to fix

      Function useSQLView has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          useSQLView: function(view, options) {
            if (!view && !this.sqlView) return;
            options = options || {};
            var self = this;
            var data = this.data();
      Severity: Minor
      Found in lib/assets/javascripts/cartodb/models/table.js - About 1 hr to fix

        Function fetch has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            fetch: function(opts) {
              opts = opts || {}
              var self = this;
              var silent = opts && opts.silent;
              var username = (this.options && this.options.user_data)? this.options.user_data.username :
        Severity: Minor
        Found in lib/assets/javascripts/cartodb/models/table.js - About 1 hr to fix

          Function duplicate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              duplicate: function(newName, callbacks) {
                callbacks = callbacks || {};
          
                // Extracted from duplicate_table_dialog
                var data = {
          Severity: Minor
          Found in lib/assets/javascripts/cartodb/models/table.js - About 1 hr to fix

            Function initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                initialize: function() {
                  _.bindAll(this, 'notice');
                  this.readOnly = false;
                  this.bind('change:schema', this._prepareSchema, this);
                  this._prepareSchema();
            Severity: Minor
            Found in lib/assets/javascripts/cartodb/models/table.js - About 1 hr to fix

              Function isTypeChangeDestructive has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  isTypeChangeDestructive: function(columnName, newType) {
                    var columnType = this.getColumnType(columnName);
              
                    var destructiveMatrix = {
                      "string": {
              Severity: Minor
              Found in lib/assets/javascripts/cartodb/models/table.js - About 1 hr to fix

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

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

                          if(view) {
                            view.bind('reset', function() {
                              if(!view.modify_rows) {
                                this.set({
                                  schema: view.schemaFromData(this.get('schema')),
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 day to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 486..523

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

                    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

                        geometryTypeChanged: function() {
                          if (!('geometry_types' in this.changed)) return false;
                          var geoTypes = this.get('geometry_types')
                          var prevGeoTypes = this.previousAttributes().geometry_types;
                          function normalize(e) {
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 day to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 697..725

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

                    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

                        alterTable: function(sql) {
                          sql = sql.trim();
                          return sql.search(/alter\s+[\w\."]+\s+/i) !== -1   ||
                                 sql.search(/drop\s+[\w\.\"]+/i)  !== -1  ||
                                 sql.search(/^vacuum\s+[\w\.\"]+/i)  !== -1 ||
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 day to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata-static.js on lines 36..48

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

                    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

                        sortSchema: function(schema) {
                          var priorities = {
                            'cartodb_id': 1,
                            'the_geom': 2,
                            '__default__': 3,
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 day to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata-static.js on lines 4..31

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

                    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

                        geomColumnTypes: function(geometryTypes) {
                          var types = geometryTypes || this.get('geometry_types');
                          var geomTypes = [];
                          if (!_.isArray(types)) {
                            return [];
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 7 hrs to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 212..237

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

                    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

                        isTypeChangeDestructive: function(columnName, newType) {
                          var columnType = this.getColumnType(columnName);
                    
                          var destructiveMatrix = {
                            "string": {
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 5 hrs to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 374..404

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

                    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

                        url: function(method) {
                          var version = cdb.config.urlVersion('column', method);
                          var table = this.table || this.collection.table;
                          if(!table) {
                            cdb.log.error("column has no table assigned");
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 5 hrs to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 931..943

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

                    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

                        url: function(method) {
                          var version = cdb.config.urlVersion('record', method);
                          var table = this.table || this.collection.table;
                          if(!table) {
                            cdb.log.error("row has no table assigned");
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 5 hrs to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 25..37

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

                    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

                        isTypeChangeAllowed: function(columnName, newType) {
                          var deactivateMatrix = {
                            'number': ['date'],
                            'boolean': ['date'],
                            'date': ['boolean']
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 4 hrs to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 358..372

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

                    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

                        alterTableData: function(sql) {
                          return this.alterTable(sql)       ||
                                 sql.search(/^refresh\s+materialized\s+view\s+[\w\.\"]+/i)  !== -1 ||
                                 sql.search(/^truncate\s+[\w\.\"]+/i)  !== -1 ||
                                 sql.search(/insert\s+into/i) !== -1  ||
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 3 hrs to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata-static.js on lines 53..60

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

                    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

                        isGeoreferenced: function() {
                          var geoColumns = this.geomColumnTypes();
                          if(geoColumns && geoColumns.length > 0) {
                            return true;
                          } else {
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 3 hrs to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 675..690

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

                    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

                        addGeomColumnType: function(t, opts) {
                          if(!t) return;
                          var types = _.clone(this.get('geometry_types')) || [];
                          if(!_.contains(types, t)) {
                            types.push(t);
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 3 hrs to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 244..254

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

                    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

                        toJSON: function() {
                          var attr = _.clone(this.attributes);
                          // remove read-only attributes
                          delete attr['updated_at'];
                          delete attr['created_at'];
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 2 hrs to fix
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 86..96

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

                    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

                        parse: function(resp, xhr) {
                          if(resp.name) {
                            resp.id = resp.name;
                          }
                          // move geometry_types to stats one
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 2 hrs to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 108..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 85.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                          this._data.bind('reset', function() {
                            var view = this._data;
                            this.set({
                              schema: view.schemaFromData(this.get('schema')),
                              geometry_types: view.getGeometryTypes()
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 2 hrs to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 77..83

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

                    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 3 locations. Consider refactoring.
                    Open

                        url: function(method) {
                          var version = cdb.config.urlVersion('table', method);
                          var base = '/api/' + version + '/tables';
                          if (this.isNew()) {
                            return base;
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 2 other locations - About 2 hrs to fix
                    lib/assets/javascripts/cartodb/common/background_polling/models/import_model.js on lines 12..20
                    lib/assets/javascripts/cartodb/models/vis.js on lines 26..33

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

                    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

                        toJSON: function() {
                          var c = _.clone(this.attributes);
                          // this hack is created to create new column
                          // if you set _name instead name backbone does not get
                          // it as idAttribute so launch a POST instead of a PUT
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 2 hrs to fix
                    lib/assets/javascripts/dashboard/data/table/column-model.js on lines 36..46

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                          this.sqlApi.execute(sql).done(function(data){
                            if(data.rows.length > 0) {
                              dfd.resolve(true);
                            } else {
                              dfd.resolve(false);
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 hr to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 660..666

                    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

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

                          if(this._data && !this._data.bindedReset) {
                    
                            this.retrigger('reset', this._data, 'dataLoaded');
                            this.retrigger('add', this._data, 'dataAdded');
                            this._data.bindedReset = true;
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 hr to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 499..503

                    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

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

                          if(this.sqlView && !this.sqlView.bindedReset) {
                            this.retrigger('reset', this.sqlView, 'dataLoaded');
                            this.retrigger('add', this.sqlView, 'dataAdded');
                            this.sqlView.bindedReset = true;
                          }
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 hr to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 492..498

                    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

                        setReadOnly: function(_) {
                          var trigger = false;
                          if (this.readOnly !== _) {
                            trigger = true;
                          }
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 hr to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 125..134

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

                    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

                        dependentVisualizations: function() {
                          // dependent = visualizations with a single layer
                          // non-dependant = have more than this dataset as a layer
                          return _.chain(this.get('dependent_visualizations'))
                            .union(this.get('non_dependent_visualizations'))
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 hr to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 789..796

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

                    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

                        hasTheGeom: function() {
                          var currentSchema = this.get('schema');
                          // if we have "the_geom" in our current schema, returnstrue
                          for(var n in currentSchema) {
                            if(currentSchema[n][0] === 'the_geom') {
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 hr to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 630..639

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

                    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 (i = 0; i < str.length; i++) {
                                    c = str.charCodeAt(i);
                                    hash = c + (hash << 6) + (hash << 16) - hash;
                                }
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 hr to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 583..586

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

                    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 10 locations. Consider refactoring.
                    Open

                          var api_key = (this.options && this.options.user_data)? this.options.user_data.api_key :
                            (window.user_data? window.user_data.api_key : window.api_key);
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 9 other locations - About 1 hr to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 8..9
                    lib/assets/javascripts/cartodb/models/table.js on lines 10..11
                    lib/assets/javascripts/cartodb/models/table.js on lines 690..691
                    lib/assets/javascripts/cartodb/models/table.js on lines 949..950
                    lib/assets/javascripts/cartodb/models/table.js on lines 951..952
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 44..45
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 46..47
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 647..648
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 649..650

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

                    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 10 locations. Consider refactoring.
                    Open

                          var api_key = (this.options && this.options.user_data)? this.options.user_data.api_key :
                            (window.user_data? window.user_data.api_key : window.api_key);
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 9 other locations - About 1 hr to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 8..9
                    lib/assets/javascripts/cartodb/models/table.js on lines 690..691
                    lib/assets/javascripts/cartodb/models/table.js on lines 692..693
                    lib/assets/javascripts/cartodb/models/table.js on lines 949..950
                    lib/assets/javascripts/cartodb/models/table.js on lines 951..952
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 44..45
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 46..47
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 647..648
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 649..650

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

                    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 10 locations. Consider refactoring.
                    Open

                          var api_key = (this.options && this.options.user_data)? this.options.user_data.api_key :
                            (window.user_data? window.user_data.api_key : window.api_key);
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 9 other locations - About 1 hr to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 8..9
                    lib/assets/javascripts/cartodb/models/table.js on lines 10..11
                    lib/assets/javascripts/cartodb/models/table.js on lines 690..691
                    lib/assets/javascripts/cartodb/models/table.js on lines 692..693
                    lib/assets/javascripts/cartodb/models/table.js on lines 949..950
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 44..45
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 46..47
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 647..648
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 649..650

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

                    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 10 locations. Consider refactoring.
                    Open

                          var username = (this.options && this.options.user_data)? this.options.user_data.username :
                            (window.user_data? window.user_data.username : window.user_name);
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 9 other locations - About 1 hr to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 8..9
                    lib/assets/javascripts/cartodb/models/table.js on lines 10..11
                    lib/assets/javascripts/cartodb/models/table.js on lines 690..691
                    lib/assets/javascripts/cartodb/models/table.js on lines 692..693
                    lib/assets/javascripts/cartodb/models/table.js on lines 951..952
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 44..45
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 46..47
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 647..648
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 649..650

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

                    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 10 locations. Consider refactoring.
                    Open

                          var username = (this.options && this.options.user_data)? this.options.user_data.username :
                            (window.user_data? window.user_data.username : window.user_name);
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 9 other locations - About 1 hr to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 8..9
                    lib/assets/javascripts/cartodb/models/table.js on lines 10..11
                    lib/assets/javascripts/cartodb/models/table.js on lines 692..693
                    lib/assets/javascripts/cartodb/models/table.js on lines 949..950
                    lib/assets/javascripts/cartodb/models/table.js on lines 951..952
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 44..45
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 46..47
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 647..648
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 649..650

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

                    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 10 locations. Consider refactoring.
                    Open

                          var username = (this.options && this.options.user_data)? this.options.user_data.username :
                            (window.user_data? window.user_data.username : window.user_name);
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 9 other locations - About 1 hr to fix
                    lib/assets/javascripts/cartodb/models/table.js on lines 10..11
                    lib/assets/javascripts/cartodb/models/table.js on lines 690..691
                    lib/assets/javascripts/cartodb/models/table.js on lines 692..693
                    lib/assets/javascripts/cartodb/models/table.js on lines 949..950
                    lib/assets/javascripts/cartodb/models/table.js on lines 951..952
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 44..45
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 46..47
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 647..648
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 649..650

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                          this.bind('columnRename', function(newName, oldName) {
                            if(infowindow.containsField(oldName)) {
                              infowindow.removeField(oldName);
                              infowindow.addField(newName);
                            }
                    Severity: Major
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 1 hr to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 564..569

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

                    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.sqlView) {
                            this.sqlView.unbind(null, null, this);
                            this.sqlView.unbind(null, null, this._data);
                          }
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 50 mins to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 473..476

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

                    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 columns = _(this.columnNames()).filter(function(c) {
                              return !_.contains(infowindow.SYSTEM_COLUMNS, c);
                            });
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 45 mins to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 575..577

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

                    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

                        isReadOnly: function() {
                          return this.readOnly || this.data().isReadOnly() || this.synchronization.isSync();
                        },
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 45 mins to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 136..138

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                          this.synchronization.bind('change:id', function isSyncChanged() {
                            this.trigger('change:isSync', this, this.synchronization.isSync());
                          }, this);
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 40 mins to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 62..64

                    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

                          if (opts.no_geom) {
                            columns = _.without(columns, 'the_geom', 'the_geom_webmercator');
                          } else {
                            columns = _.without(columns, 'the_geom');
                          }
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 40 mins to fix
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 61..65

                    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

                          if(the_geom && typeof the_geom === 'object') {
                            return !!the_geom.coordinates;
                          } else if(typeof the_geom !== 'string') {
                            return false;
                          }
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 35 mins to fix
                    lib/assets/javascripts/dashboard/data/table/row-model.js on lines 113..117

                    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

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

                        columnNames: function(sc) {
                          sc = sc || 'schema'
                          return _(this.get(sc)).pluck(0);
                        },
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 30 mins to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 186..189

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

                    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 (infowindow.get('template')) {
                              // merge fields checking actual schema
                              infowindow.mergeFields(columns);
                            } else {
                              // remove fields that no longer exist
                    Severity: Minor
                    Found in lib/assets/javascripts/cartodb/models/table.js and 1 other location - About 30 mins to fix
                    lib/assets/javascripts/dashboard/views/public-dataset/carto-table-metadata.js on lines 609..615

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

                    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