CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/cartodb/common/dialogs/pecan/pecan_dialog_view.js

Summary

Maintainability
D
2 days
Test Coverage

exports has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

module.exports = BaseDialog.extend({

  _CARD_MARGIN: 20,
  _CARD_WIDTH: 288,
  _CARD_HEIGHT: 170,

    File pecan_dialog_view.js has 348 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var cdb = require('cartodb.js-v3');
    var Utils = require('cdb.Utils');
    var Pecan = require('cartodb-pecan');
    var BaseDialog = require('../../views/base_dialog/view');
    var ViewFactory = require('../../view_factory');

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

        _generateLayerDefinition: function(column) {
      
          var type = column.get("visualizationType");
          var sql = column.get("sql");
          var css = this._setupCSS(column.get("css"), column.get("geometryType"));

        Function _initViews has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _initViews: function() {
        
            _.bindAll(this, "_addCard", "_generateThumbnail", "_refreshMapList", "_setWizardProperties");
        
            this.vis   = this.options.vis;

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

            _nextPage: function() {
              var page = this.model.get('page');
              var maxPages = this.model.get('maxPages');
          
              if (page < maxPages) {
          lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports_view.js on lines 107..114

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

          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

            _prevPage: function() {
              var page = this.model.get('page');
              if (page > 1) {
                this.model.set('page', page - 1);
              }
          lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports_view.js on lines 116..121

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

          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

            _bindDataLayer: function() {
              this.layer.wizard_properties.unbind("load", this._setWizardProperties, this);
              this.layer.wizard_properties.bind("load", this._setWizardProperties, this);
            },
          lib/assets/javascripts/cartodb/table/overlays/mobile.js on lines 314..319

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

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

            _initBinds: function() {
              this.model.bind('change:page', this._moveTabsNavigation, this);
              this._panes.bind('tabEnabled', this.render, this);
            },
          lib/assets/javascripts/builder/components/background-importer/background-importer.js on lines 61..64
          lib/assets/javascripts/builder/components/custom-list/custom-view.js on lines 101..104
          lib/assets/javascripts/builder/components/modals/add-layer/content/imports/import-bigquery/import-bigquery-form-view.js on lines 86..89
          lib/assets/javascripts/builder/components/modals/add-layer/content/imports/import-database/import-database-connect-form-view.js on lines 57..60
          lib/assets/javascripts/builder/components/modals/add-layer/content/imports/import-database/import-database-query-form-view.js on lines 50..53
          lib/assets/javascripts/builder/components/pagination-search/pagination-search-model.js on lines 28..31
          lib/assets/javascripts/builder/components/table/body/table-body-row-view.js on lines 44..47
          lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-fields-view.js on lines 28..31
          lib/assets/javascripts/cartodb/common/background_polling/views/geocodings/background_geocoding_item_view.js on lines 55..58
          lib/assets/javascripts/cartodb/common/background_polling/views/imports/background_import_item_view.js on lines 102..105
          lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_data_view.js on lines 117..120
          lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/service_import/service_loader_view.js on lines 34..37
          lib/assets/javascripts/cartodb/common/dialogs/edit_vis_metadata/edit_vis_form_view.js on lines 51..54
          lib/assets/javascripts/cartodb/common/dialogs/georeference/tab_item_view.js on lines 36..39
          lib/assets/javascripts/cartodb/common/dialogs/map/image_picker/footer_view.js on lines 40..43
          lib/assets/javascripts/cartodb/common/dialogs/merge_datasets/spatial_merge/merge_method_view.js on lines 51..54
          lib/assets/javascripts/cartodb/common/edit_fields/edit_field_view.js on lines 49..52

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

          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