CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/builder/editor/style/style-view.js

Summary

Maintainability
F
5 days
Test Coverage

File style-view.js has 407 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var _ = require('underscore');
var Backbone = require('backbone');
var CoreView = require('backbone/core-view');
var PanelWithOptionsView = require('builder/components/view-options/panel-with-options-view');
var StyleContentView = require('./style-content-view');
Severity: Minor
Found in lib/assets/javascripts/builder/editor/style/style-view.js - About 5 hrs to fix

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

      _initViews: function () {
        var self = this;
    
        var infoboxSstates = [
          {
    Severity: Major
    Found in lib/assets/javascripts/builder/editor/style/style-view.js - About 2 hrs to fix

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

      module.exports = CoreView.extend({
      
        initialize: function (opts) {
          checkAndBuildOpts(opts, REQUIRED_OPTS, this);
      
      
      Severity: Minor
      Found in lib/assets/javascripts/builder/editor/style/style-view.js - About 2 hrs to fix

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

          _configPanes: function () {
            var self = this;
            var tabPaneTabs = [{
              selected: !this._layerDefinitionModel.get('cartocss_custom'),
              createContentView: function () {
        Severity: Major
        Found in lib/assets/javascripts/builder/editor/style/style-view.js - About 2 hrs to fix

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

            initialize: function (opts) {
              checkAndBuildOpts(opts, REQUIRED_OPTS, this);
          
              this._styleModel = this._layerDefinitionModel.styleModel;
              this._cartocssModel = this._layerDefinitionModel.cartocssModel;
          Severity: Minor
          Found in lib/assets/javascripts/builder/editor/style/style-view.js - About 1 hr to fix

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

              _saveCartoCSS: function (cb) {
                var content = this._codemirrorModel.get('content');
                var parser = new ParserCSS(content);
                var errors = parser.errors();
            
            
            Severity: Minor
            Found in lib/assets/javascripts/builder/editor/style/style-view.js - About 1 hr to fix

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

                  if (!edition && cartocss_custom && !isAutoStyleApplied) {
                    this._infoboxModel.set({ state: 'confirm' });
                    this._overlayModel.set({ visible: true });
                  } else if (this._isLayerHidden()) {
                    this._infoboxModel.set({ state: 'layer-hidden' });
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 2 other locations - About 5 hrs to fix
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 341..352
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 329..340

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

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

                  var panelWithOptionsView = new PanelWithOptionsView({
                    className: 'Editor-content',
                    editorModel: self._editorModel,
                    infoboxModel: self._infoboxModel,
                    infoboxCollection: infoboxCollection,
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 3 other locations - About 4 hrs to fix
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 406..427
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 121..142
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 251..272

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

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

                _onChangeEdition: function () {
                  this._infoboxState();
              
                  var edition = this._editorModel.get('edition');
                  var index = edition ? 1 : 0;
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 3 other locations - About 3 hrs to fix
              lib/assets/javascripts/builder/dataset/dataset-options/dataset-options-view.js on lines 126..133
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 284..291
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 308..315

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

              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

                    }, {
                      state: 'torque-exists',
                      createContentView: function () {
                        return Infobox.createWithAction({
                          type: 'alert',
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 2 other locations - About 3 hrs to fix
              lib/assets/javascripts/builder/editor/layers/layer-content-views/analyses/analyses-view.js on lines 98..112
              lib/assets/javascripts/builder/editor/style/style-view.js on lines 151..165

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

              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

                    {
                      state: 'confirm',
                      createContentView: function () {
                        return Infobox.createWithAction({
                          type: 'alert',
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 2 other locations - About 3 hrs to fix
              lib/assets/javascripts/builder/editor/layers/layer-content-views/analyses/analyses-view.js on lines 98..112
              lib/assets/javascripts/builder/editor/style/style-view.js on lines 178..192

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

              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

                  this._togglerModel = new Backbone.Model({
                    labels: [_t('editor.style.style-toggle.values'), _t('editor.style.style-toggle.cartocss')],
                    active: this._editorModel.isEditing(),
                    disabled: this._editorModel.isDisabled(),
                    isDisableable: true,
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 2 other locations - About 2 hrs to fix
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 77..83
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 62..68

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

              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

                render: function () {
                  this._launchOnboarding();
                  this.clearSubViews();
                  this.$el.empty();
              
              
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 2 other locations - About 1 hr to fix
              lib/assets/javascripts/builder/components/inline-editor/inline-editor-view.js on lines 33..40
              lib/assets/javascripts/builder/editor/layers/layer-content-views/analyses/analyses-view.js on lines 64..73

              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

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

                  this._onboardingLauncher = new OnboardingLauncher({
                    view: OnboardingView,
                    onboardingNotification: this._onboardingNotification,
                    notificationKey: ONBOARDING_KEY,
                    onboardings: this._onboardings
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 2 other locations - About 1 hr to fix
              lib/assets/javascripts/builder/editor/layers/layer-content-views/analyses/analyses-view.js on lines 49..57
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 77..85

              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

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

                _showHiddenLayer: function () {
                  var savingOptions = {
                    shouldPreserveAutoStyle: true
                  };
                  this._layerDefinitionModel.toggleVisible();
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 5 other locations - About 1 hr to fix
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 455..461
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 355..361
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindows-view.js on lines 225..231
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 278..284
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legends-view.js on lines 218..224

              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

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

                    if (!this._editorModel.isEditing() && !canBeGeoreferenced && hasGeom) {
                      this._onboardingLauncher.launch({
                        geom: this._queryGeometryModel.get('simple_geom'),
                        type: this._styleModel.get('type')
                      });
              Severity: Minor
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 1 other location - About 55 mins to fix
              lib/assets/javascripts/builder/components/modals/add-layer/content/datasets/datasets-pagination-view.js on lines 61..66

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

                    MetricsTracker.track(MetricsTypes.APPLIED_CARTOCSS, {
                      layer_id: this._layerDefinitionModel.get('id'),
                      cartocss: this._layerDefinitionModel.get('cartocss')
                    });
              Severity: Minor
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 1 other location - About 50 mins to fix
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 247..250

              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

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

                _onTogglerChanged: function () {
                  var checked = this._togglerModel.get('active');
                  this._editorModel.set({ edition: checked });
                },
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 9 other locations - About 45 mins to fix
              lib/assets/javascripts/builder/dataset/dataset-options/dataset-options-view.js on lines 135..138
              lib/assets/javascripts/builder/dataset/dataset-options/dataset-options-view.js on lines 140..143
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 293..296
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 298..301
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 317..320
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 322..325
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 193..196
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 198..201
              lib/assets/javascripts/builder/editor/style/style-view.js on lines 335..338

              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

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

                _onChangeDisabled: function () {
                  var disabled = this._editorModel.get('disabled');
                  this._togglerModel.set({ disabled: disabled });
                },
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 9 other locations - About 45 mins to fix
              lib/assets/javascripts/builder/dataset/dataset-options/dataset-options-view.js on lines 135..138
              lib/assets/javascripts/builder/dataset/dataset-options/dataset-options-view.js on lines 140..143
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 293..296
              lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 298..301
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 317..320
              lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 322..325
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 193..196
              lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 198..201
              lib/assets/javascripts/builder/editor/style/style-view.js on lines 340..343

              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

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

                  this._userActions.moveLayer({
                    from: this._layerDefinitionModel.get('order'),
                    to: this._layerDefinitionsCollection.getTopDataLayerIndex()
                  });
              Severity: Major
              Found in lib/assets/javascripts/builder/editor/style/style-view.js and 2 other locations - About 40 mins to fix
              lib/assets/javascripts/builder/components/pagination-search/pagination-search-view.js on lines 96..99
              lib/assets/javascripts/builder/editor/style/style-content-view.js on lines 247..250

              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

              There are no issues that match your filters.

              Category
              Status