CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/builder/editor/layers/layer-content-views/analyses/analyses-view.js

Summary

Maintainability
D
2 days
Test Coverage

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

  _initViews: function () {
    var self = this;
    var infoboxSstates = [
      {
        state: 'layer-hidden',

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

            return new AnalysesContentView({
              className: 'Editor-content',
              userActions: self._userActions,
              analysisDefinitionNodesCollection: self._analysisDefinitionNodesCollection,
              userModel: self._userModel,
    lib/assets/javascripts/builder/editor/layers/layer-content-view.js on lines 369..382

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

    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: 'deleting-analysis',
            createContentView: function () {
              return Infobox.createWithAction({
                type: 'alert',
    lib/assets/javascripts/builder/editor/style/style-view.js on lines 151..165
    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 8 locations. Consider refactoring.
    Open

          {
            state: 'layer-hidden',
            createContentView: function () {
              return Infobox.createWithAction({
                type: 'alert',
    lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 366..379
    lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 388..401
    lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 90..103
    lib/assets/javascripts/builder/editor/layers/layer-content-views/infowindow/infowindow-base-view.js on lines 103..116
    lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 207..220
    lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 220..233
    lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legend-base-type-view.js on lines 233..246

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

    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

      _initBinds: function () {
        this.listenTo(this._layerDefinitionModel, 'change:visible', this._infoboxState);
        this.listenTo(this._deleteAnalysisModel, 'change:analysisId', this._infoboxState);
        this.listenTo(this._analysisFormsCollection, 'reset remove', this._getQueryAndCheckState);
      },
    lib/assets/javascripts/builder/components/input-color/assets-picker/assets-view.js on lines 111..115
    lib/assets/javascripts/builder/components/input-color/input-quantitative-ramps/input-ramp-list-view.js on lines 72..76
    lib/assets/javascripts/builder/editor/layers/layer-content-views/legend/legends-view.js on lines 76..80
    lib/assets/javascripts/builder/editor/layers/layers-view.js on lines 78..82
    lib/assets/javascripts/builder/editor/widgets/widgets-form/widgets-form-view.js on lines 43..47
    lib/assets/javascripts/dashboard/views/organization/icon-picker/organization-icon-picker-view.js on lines 50..54
    lib/assets/javascripts/deep-insights/widgets/formula/content-view.js on lines 112..116

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

    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();
    
    
    lib/assets/javascripts/builder/components/inline-editor/inline-editor-view.js on lines 33..40
    lib/assets/javascripts/builder/editor/style/style-view.js on lines 98..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 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
    lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 77..85
    lib/assets/javascripts/builder/editor/style/style-view.js on lines 84..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 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 6 locations. Consider refactoring.
    Open

        if (this._isLayerHidden()) {
          this._infoboxModel.set({ state: 'layer-hidden' });
          this._overlayModel.set({ visible: true });
        } else if (this._deleteAnalysisModel.get('analysisId')) {
          this._infoboxModel.set({ state: 'deleting-analysis' });
    lib/assets/javascripts/builder/editor/layers/layer-content-views/analyses/analyses-view.js on lines 172..178
    lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 445..452
    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
    lib/assets/javascripts/builder/editor/style/style-view.js on lines 453..464

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

    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

        } else if (this._deleteAnalysisModel.get('analysisId')) {
          this._infoboxModel.set({ state: 'deleting-analysis' });
          this._overlayModel.set({ visible: true });
        } else {
          this._infoboxModel.set({ state: '' });
    lib/assets/javascripts/builder/editor/layers/layer-content-views/analyses/analyses-view.js on lines 169..178
    lib/assets/javascripts/builder/editor/layers/layer-content-views/data/data-view.js on lines 445..452
    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
    lib/assets/javascripts/builder/editor/style/style-view.js on lines 453..464

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

    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