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.
LayersPanel
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
cdb.admin.LayersPanel = cdb.ui.common.TabPane.extend({
className: 'table_panel',
animation_time: 300,
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();
- Read upRead up
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);
- Read upRead up
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();
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);
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
- Read upRead up
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"