CartoDB/cartodb20

View on GitHub
lib/assets/javascripts/cartodb/table/actions_menu.js

Summary

Maintainability
D
2 days
Test Coverage

File actions_menu.js has 437 lines of code (exceeds 250 allowed). Consider refactoring.
Open


  /**
   *  Actions menu view, aka LayersPanel
   *
   *  - It needs at least visualization and user models.
Severity: Minor
Found in lib/assets/javascripts/cartodb/table/actions_menu.js - About 6 hrs to fix

    LayersPanel has 37 functions (exceeds 20 allowed). Consider refactoring.
    Open

      cdb.admin.LayersPanel = cdb.ui.common.TabPane.extend({
    
        className: 'table_panel',
        animation_time: 300,
    
    
    Severity: Minor
    Found in lib/assets/javascripts/cartodb/table/actions_menu.js - About 4 hrs to fix

      Function _sortChange has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          _sortChange: function(e, ui) {
            var isAnyTorque = _.contains(this.map.layers.pluck('type'), 'torque');
            var isLayerTorque = $(ui.item).attr('layer-type') == "torque";
            var active_height = $(ui.item).outerHeight();
      
      
      Severity: Minor
      Found in lib/assets/javascripts/cartodb/table/actions_menu.js - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _switchTo has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          _switchTo: function(l, open) {
            // If there is any change within layer tabs
            if (this.activePane) this.activePane.unbind('tabChanged', null, null);
            l.bind('tabChanged', this.movePanel, this);
      
      
      Severity: Minor
      Found in lib/assets/javascripts/cartodb/table/actions_menu.js - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _sortChange has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _sortChange: function(e, ui) {
            var isAnyTorque = _.contains(this.map.layers.pluck('type'), 'torque');
            var isLayerTorque = $(ui.item).attr('layer-type') == "torque";
            var active_height = $(ui.item).outerHeight();
      
      
      Severity: Minor
      Found in lib/assets/javascripts/cartodb/table/actions_menu.js - About 1 hr to fix

        Function _switchTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _switchTo: function(l, open) {
              // If there is any change within layer tabs
              if (this.activePane) this.activePane.unbind('tabChanged', null, null);
              l.bind('tabChanged', this.movePanel, this);
        
        
        Severity: Minor
        Found in lib/assets/javascripts/cartodb/table/actions_menu.js - About 1 hr to fix

          Function _setDefaultLayer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              _setDefaultLayer: function() {
                var layer_id = this.vis.get('active_layer_id');
                var layer = _.last(this.layer_panels);
          
                // Get layer from layer_id
          Severity: Minor
          Found in lib/assets/javascripts/cartodb/table/actions_menu.js - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          There are no issues that match your filters.

          Category
          Status