CartoDB/cartodb20

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

Summary

Maintainability
D
1 day
Test Coverage

File editor-header.js has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var CoreView = require('backbone/core-view');
var _ = require('underscore');
var template = require('./editor-header.tpl');
var moment = require('moment');
var ConfirmationView = require('builder/components/modals/confirmation/modal-confirmation-view');
Severity: Minor
Found in lib/assets/javascripts/builder/editor/editor-header.js - About 2 hrs to fix

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

      _initViews: function () {
        var self = this;
        this._inlineEditor = new InlineEditorView({
          template: templateInlineEditor,
          renderOptions: {
    Severity: Major
    Found in lib/assets/javascripts/builder/editor/editor-header.js - About 2 hrs to fix

      exports has 21 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/editor-header.js - About 2 hrs to fix

        Function _duplicateMap has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _duplicateMap: function () {
            var self = this;
            var mapName = this._visDefinitionModel.get('name');
        
            this._modals.create(function (modalModel) {
        Severity: Minor
        Found in lib/assets/javascripts/builder/editor/editor-header.js - About 1 hr to fix

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

            _canDuplicatePublic: function () {
              var hasPublicMapsLimits = this.options.userModel.hasPublicMapsLimits();
              var hasRemainingPublicMaps = this.options.userModel.hasRemainingPublicMaps();
              if (hasPublicMapsLimits && !hasRemainingPublicMaps) {
                return false;
          Severity: Major
          Found in lib/assets/javascripts/builder/editor/editor-header.js and 1 other location - About 1 hr to fix
          lib/assets/javascripts/builder/editor/editor-header.js on lines 148..155

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

            _canDuplicatePrivate: function () {
              var hasPrivateMapsLimits = this.options.userModel.hasPrivateMapsLimits();
              var hasRemainingPrivateMaps = this.options.userModel.hasRemainingPrivateMaps();
              if (hasPrivateMapsLimits && !hasRemainingPrivateMaps) {
                return false;
          Severity: Major
          Found in lib/assets/javascripts/builder/editor/editor-header.js and 1 other location - About 1 hr to fix
          lib/assets/javascripts/builder/editor/editor-header.js on lines 157..164

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

              var shareWith = new ShareWith({
                visDefinitionModel: this._visDefinitionModel,
                userModel: this._userModel,
                separationClass: 'u-rSpace--m',
                clickPrivacyAction: this._onClickPrivacy.bind(this)
          Severity: Minor
          Found in lib/assets/javascripts/builder/editor/editor-header.js and 1 other location - About 50 mins to fix
          lib/assets/javascripts/builder/dataset/dataset-header/dataset-header-view.js on lines 135..140

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 52.

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

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

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

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

          Refactorings

          Further Reading

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

            _onRenameSuccess: function (newName) {
              this.$('.js-title').text(newName).show();
              this._inlineEditor.hide();
            },
          Severity: Major
          Found in lib/assets/javascripts/builder/editor/editor-header.js and 4 other locations - About 50 mins to fix
          lib/assets/javascripts/builder/editor/editor-header.js on lines 300..303
          lib/assets/javascripts/builder/editor/layers/layer-header-view.js on lines 403..406
          lib/assets/javascripts/builder/editor/layers/layer-views/data-layer-view.js on lines 465..468
          lib/assets/javascripts/builder/editor/layers/layer-views/data-layer-view.js on lines 470..473

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

            _onRenameError: function (oldName) {
              this.$('.js-title').text(oldName).show();
              this._inlineEditor.hide();
            },
          Severity: Major
          Found in lib/assets/javascripts/builder/editor/editor-header.js and 4 other locations - About 50 mins to fix
          lib/assets/javascripts/builder/editor/editor-header.js on lines 295..298
          lib/assets/javascripts/builder/editor/layers/layer-header-view.js on lines 403..406
          lib/assets/javascripts/builder/editor/layers/layer-views/data-layer-view.js on lines 465..468
          lib/assets/javascripts/builder/editor/layers/layer-views/data-layer-view.js on lines 470..473

          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

          There are no issues that match your filters.

          Category
          Status