CartoDB/cartodb20

View on GitHub

Showing 3,496 of 5,951 total issues

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

    this._formModel.bind('change', function (input) {
      this.model.set('range', [(+input.get('min')), (+input.get('max'))]);
    }, this);
lib/assets/javascripts/builder/components/form-components/editors/size/size-by-value-content-view.js on lines 76..82

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

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

      def content_guessing_options
        guessing_config = Cartodb.config.fetch(:importer, {}).deep_symbolize_keys.fetch(:content_guessing, {})
        geocoder_config = Cartodb.config.fetch(:geocoder, {}).deep_symbolize_keys
        if guessing_config[:enabled] and self.content_guessing and geocoder_config
          { guessing: guessing_config, geocoder: geocoder_config }
Severity: Minor
Found in app/models/synchronization/member.rb and 1 other location - About 40 mins to fix
app/models/data_import.rb on lines 554..561

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

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

      def decorate_twitter_import_data!(data, data_import)
        return if data_import.service_name != CartoDB::Datasources::Search::Twitter::DATASOURCE_NAME

        audit_entry = Carto::SearchTweet.find_by(data_import_id: data_import.id)
        data[:tweets_georeferenced] = audit_entry.retrieved_items
Severity: Minor
Found in app/controllers/carto/api/imports_controller.rb and 1 other location - About 40 mins to fix
app/controllers/api/json/imports_controller.rb on lines 174..180

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

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

  def decorate_twitter_import_data!(data, data_import)
    return if data_import.service_name != CartoDB::Datasources::Search::Twitter::DATASOURCE_NAME

    audit_entry = Carto::SearchTweet.find_by(data_import_id: data_import.id)
    data[:tweets_georeferenced] = audit_entry.retrieved_items
Severity: Minor
Found in app/controllers/api/json/imports_controller.rb and 1 other location - About 40 mins to fix
app/controllers/carto/api/imports_controller.rb on lines 101..107

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

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

  def content_guessing_options
    guessing_config = Cartodb.config.fetch(:importer, {}).deep_symbolize_keys.fetch(:content_guessing, {})
    geocoder_config = Cartodb.config.fetch(:geocoder, {}).deep_symbolize_keys
    if guessing_config[:enabled] and self.content_guessing and geocoder_config
      { guessing: guessing_config, geocoder: geocoder_config }
Severity: Minor
Found in app/models/data_import.rb and 1 other location - About 40 mins to fix
app/models/synchronization/member.rb on lines 537..544

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

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

  parse: function (response) {
    this.total_entries = response.total_entries;
    this.total_user_entries = response.total_user_entries;

    return response.users;
lib/assets/javascripts/builder/data/users-group-collection.js on lines 24..29
lib/assets/javascripts/cartodb/models/group_users.js on lines 17..22

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

  parse: function(response) {
    this.total_entries = response.total_entries;
    this.total_user_entries = response.total_user_entries;

    return response.users;
Severity: Minor
Found in lib/assets/javascripts/cartodb/models/group_users.js and 2 other locations - About 40 mins to fix
lib/assets/javascripts/builder/data/users-group-collection.js on lines 24..29
lib/assets/javascripts/dashboard/data/group-users-collection.js on lines 28..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 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 3 locations. Consider refactoring.
Open

  parse: function (response) {
    this.total_entries = response.total_entries;
    this.total_user_entries = response.total_user_entries;

    return response.users;
Severity: Minor
Found in lib/assets/javascripts/builder/data/users-group-collection.js and 2 other locations - About 40 mins to fix
lib/assets/javascripts/cartodb/models/group_users.js on lines 17..22
lib/assets/javascripts/dashboard/data/group-users-collection.js on lines 28..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 48.

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

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

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

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

Refactorings

Further Reading

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

    var guessingTogglerView = new GuessingTogglerView({
      guessingModel: this._guessingModel,
      userModel: this._userModel,
      createModel: this._createModel,
      configModel: this._configModel
lib/assets/javascripts/builder/components/input-color/input-color-fixed-content-view.js on lines 140..145
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 54..59
lib/assets/javascripts/builder/components/modals/dataset-metadata/dataset-metadata-view.js on lines 64..69
lib/assets/javascripts/builder/editor/layers/basemap-content-views/basemap-select-view.js on lines 104..109
lib/assets/javascripts/cartodb/common/dialogs/create/listing/datasets_view.js on lines 68..73
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 87..92
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 96..101

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

  url: function () {
    var baseUrl = this._configModel.get('base_url');
    return baseUrl + '/api/v1/maps/' + this._mapId + '/layers';
  },
lib/assets/javascripts/builder/data/analysis-definitions-collection.js on lines 32..35
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 49..52
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 62..65
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 73..76
lib/assets/javascripts/builder/data/widget-definitions-collection.js on lines 75..78
lib/assets/javascripts/dashboard/data/visualization-model.js on lines 265..268

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

    var formView = new FormView({
      visDefinitionModel: this._visDefinitionModel,
      visMetadataModel: this._visMetadataModel,
      configModel: this._configModel,
      isLocked: this._isLocked
lib/assets/javascripts/builder/components/input-color/input-color-fixed-content-view.js on lines 140..145
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 45..50
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 54..59
lib/assets/javascripts/builder/editor/layers/basemap-content-views/basemap-select-view.js on lines 104..109
lib/assets/javascripts/cartodb/common/dialogs/create/listing/datasets_view.js on lines 68..73
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 87..92
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 96..101

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

  mapcapsURL: function () {
    var baseUrl = this._configModel.get('base_url');
    return baseUrl + '/api/v3/viz/' + this.id + '/mapcaps';
  }
Severity: Major
Found in lib/assets/javascripts/dashboard/data/visualization-model.js and 6 other locations - About 40 mins to fix
lib/assets/javascripts/builder/data/analysis-definitions-collection.js on lines 32..35
lib/assets/javascripts/builder/data/layer-definitions-collection.js on lines 33..36
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 49..52
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 62..65
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 73..76
lib/assets/javascripts/builder/data/widget-definitions-collection.js on lines 75..78

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

    var pagination = new CategoryPaginatorView({
      widgetModel: this.model,
      dataviewModel: this._dataviewModel,
      itemsPerPage: this._ITEMS_PER_PAGE,
      paginatorModel: this._paginatorModel
lib/assets/javascripts/builder/components/input-color/input-color-fixed-content-view.js on lines 140..145
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 45..50
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 54..59
lib/assets/javascripts/builder/components/modals/dataset-metadata/dataset-metadata-view.js on lines 64..69
lib/assets/javascripts/builder/editor/layers/basemap-content-views/basemap-select-view.js on lines 104..109
lib/assets/javascripts/cartodb/common/dialogs/create/listing/datasets_view.js on lines 68..73
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 87..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 48.

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

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

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

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

Refactorings

Further Reading

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

    var listView = new DatasetsList({
      user: this.user,
      createModel: this.createModel,
      routerModel: this.routerModel,
      collection: this.collection
lib/assets/javascripts/builder/components/input-color/input-color-fixed-content-view.js on lines 140..145
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 45..50
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 54..59
lib/assets/javascripts/builder/components/modals/dataset-metadata/dataset-metadata-view.js on lines 64..69
lib/assets/javascripts/builder/editor/layers/basemap-content-views/basemap-select-view.js on lines 104..109
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 87..92
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 96..101

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

  stateURL: function () {
    var baseUrl = this._configModel.get('base_url');
    return baseUrl + '/api/v3/viz/' + this.id + '/state';
  },
Severity: Major
Found in lib/assets/javascripts/builder/data/vis-definition-model.js and 6 other locations - About 40 mins to fix
lib/assets/javascripts/builder/data/analysis-definitions-collection.js on lines 32..35
lib/assets/javascripts/builder/data/layer-definitions-collection.js on lines 33..36
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 49..52
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 62..65
lib/assets/javascripts/builder/data/widget-definitions-collection.js on lines 75..78
lib/assets/javascripts/dashboard/data/visualization-model.js on lines 265..268

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

  mapcapsURL: function () {
    var baseUrl = this._configModel.get('base_url');
    return baseUrl + '/api/v3/viz/' + this.id + '/mapcaps';
  },
Severity: Major
Found in lib/assets/javascripts/builder/data/vis-definition-model.js and 6 other locations - About 40 mins to fix
lib/assets/javascripts/builder/data/analysis-definitions-collection.js on lines 32..35
lib/assets/javascripts/builder/data/layer-definitions-collection.js on lines 33..36
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 62..65
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 73..76
lib/assets/javascripts/builder/data/widget-definitions-collection.js on lines 75..78
lib/assets/javascripts/dashboard/data/visualization-model.js on lines 265..268

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

  builderURL: function () {
    var baseUrl = this._configModel.get('base_url');
    return baseUrl + '/builder/' + this.id + '/';
  },
Severity: Major
Found in lib/assets/javascripts/builder/data/vis-definition-model.js and 6 other locations - About 40 mins to fix
lib/assets/javascripts/builder/data/analysis-definitions-collection.js on lines 32..35
lib/assets/javascripts/builder/data/layer-definitions-collection.js on lines 33..36
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 49..52
lib/assets/javascripts/builder/data/vis-definition-model.js on lines 73..76
lib/assets/javascripts/builder/data/widget-definitions-collection.js on lines 75..78
lib/assets/javascripts/dashboard/data/visualization-model.js on lines 265..268

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

    var contentView = new InputColorFileView({
      model: this.model,
      userModel: this._userModel,
      configModel: this._configModel,
      modals: this._modals
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 45..50
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 54..59
lib/assets/javascripts/builder/components/modals/dataset-metadata/dataset-metadata-view.js on lines 64..69
lib/assets/javascripts/builder/editor/layers/basemap-content-views/basemap-select-view.js on lines 104..109
lib/assets/javascripts/cartodb/common/dialogs/create/listing/datasets_view.js on lines 68..73
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 87..92
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 96..101

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

    var privacyTogglerView = new PrivacyTogglerView({
      privacyModel: this._privacyModel,
      userModel: this._userModel,
      createModel: this._createModel,
      configModel: this._configModel
lib/assets/javascripts/builder/components/input-color/input-color-fixed-content-view.js on lines 140..145
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 45..50
lib/assets/javascripts/builder/components/modals/dataset-metadata/dataset-metadata-view.js on lines 64..69
lib/assets/javascripts/builder/editor/layers/basemap-content-views/basemap-select-view.js on lines 104..109
lib/assets/javascripts/cartodb/common/dialogs/create/listing/datasets_view.js on lines 68..73
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 87..92
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 96..101

Duplicated Code

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

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

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

Tuning

This issue has a mass of 48.

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

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

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

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

Refactorings

Further Reading

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

    var dataList = new CategoryItemsView({
      widgetModel: this.model,
      dataviewModel: this._dataviewModel,
      itemsPerPage: this._ITEMS_PER_PAGE,
      paginatorModel: this._paginatorModel
lib/assets/javascripts/builder/components/input-color/input-color-fixed-content-view.js on lines 140..145
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 45..50
lib/assets/javascripts/builder/components/modals/add-layer/footer/footer-view.js on lines 54..59
lib/assets/javascripts/builder/components/modals/dataset-metadata/dataset-metadata-view.js on lines 64..69
lib/assets/javascripts/builder/editor/layers/basemap-content-views/basemap-select-view.js on lines 104..109
lib/assets/javascripts/cartodb/common/dialogs/create/listing/datasets_view.js on lines 68..73
lib/assets/javascripts/deep-insights/widgets/category/content-view.js on lines 96..101

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

Severity
Category
Status
Source
Language