CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/service_import/import_service_view.js

Summary

Maintainability
F
3 days
Test Coverage

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

  _initViews: function() {
    // Header
    var header = new ServiceHeader({
      el: this.$('.ImportPanel-header'),
      user: this.user,

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

      _checkState: function() {
        if (this.model.get('state') === "list") {
          if (this.collection.size() === 1) {
            var item = this.collection.at(0);
            this.model.set({
    lib/assets/javascripts/builder/components/modals/add-layer/content/imports/import-service/import-service-view.js on lines 161..179

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

    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

      _openWindow: function() {
        var url = this.service.get('url');
        var self = this;
        var i = window.open(url, null, "menubar=no,toolbar=no,width=600,height=495");
        var e = window.setInterval(function() {
    lib/assets/javascripts/builder/components/modals/add-layer/content/imports/import-bigquery/import-bigquery-view.js on lines 203..220
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_bigquery_view.js on lines 154..167

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

    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

      _initBinds: function() {
        this.model.bind('change', this._triggerChange, this);
        this.model.bind('change:state', this._checkState, this);
        this.token.bind('change:oauth_valid', this._onOauthChange, this);
        this.service.bind('change:url', this._openWindow, this);
    lib/assets/javascripts/builder/components/background-importer/background-import-item-view.js on lines 38..45
    lib/assets/javascripts/builder/components/modals/add-layer/content/imports/import-service/import-service-view.js on lines 85..92

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 124.

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

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

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

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

    Refactorings

    Further Reading

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

        var header = new ServiceHeader({
          el: this.$('.ImportPanel-header'),
          user: this.user,
          model: this.model,
          collection: this.collection,
    lib/assets/javascripts/builder/components/modals/add-layer/content/imports/import-service/import-service-view.js on lines 95..105

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

    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

      options: {
        service: '',                  // Name of the service
        showAvailableFormats: false,  // If all available format link should appear or not
        fileExtensions: [],           // File extensions
        acceptSync: false,            // Accept sync this service?
    lib/assets/javascripts/builder/components/modals/add-layer/content/imports/import-service/import-service-view.js on lines 28..40

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

        var selected = new ServiceSelectedFile({
          el: this.$('.ServiceSelected'),
          user: this.user,
          model: this.model,
          acceptSync: this.options.acceptSync,
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_arcgis_view.js on lines 45..51
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_bigquery_view.js on lines 118..124
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_data_view.js on lines 67..73
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_data_view.js on lines 78..84
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/service_import/import_service_view.js on lines 116..122

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

        var list = new ServiceList({
          el: this.$('.ServiceList'),
          model: this.model,
          collection: this.collection,
          title: this.options.title,
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_arcgis_view.js on lines 45..51
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_bigquery_view.js on lines 118..124
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_data_view.js on lines 67..73
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/import_data_view.js on lines 78..84
    lib/assets/javascripts/cartodb/common/dialogs/create/listing/imports/service_import/import_service_view.js on lines 127..133

    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

      render: function() {
        this.clearSubViews();
        this.$el.html(this.template(this.options));
        this._initViews();
        return this;
    lib/assets/javascripts/cartodb/table/overlays/overlay_properties_dropdown.js on lines 321..330

    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

    There are no issues that match your filters.

    Category
    Status