File cartodb_layer.js
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
cdb.admin.CartoDBLayer = cdb.geo.CartoDBLayer.extend({
MAX_HISTORY: 5,
MAX_HISTORY_QUERY: 5,
MAX_HISTORY_TILE_STYLE: 5,
CartoDBLayer
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
cdb.admin.CartoDBLayer = cdb.geo.CartoDBLayer.extend({
MAX_HISTORY: 5,
MAX_HISTORY_QUERY: 5,
MAX_HISTORY_TILE_STYLE: 5,
Function initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function() {
this.sync = _.debounce(this.sync, 1000);
this.error = false;
this.set('use_server_style', true);
Function _manageInteractivity
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
_manageInteractivity: function() {
var interactivity = null;
if (this.wizard_properties.supportsInteractivity()) {
if(this.table.containsColumn('cartodb_id')) {
interactivity = ['cartodb_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"
Further reading
Function toJSON
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
toJSON: function() {
var c = _.clone(this.attributes);
// remove api key
if(c.extra_params) {
c.extra_params = _.clone(this.attributes.extra_params);
Function parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
parse: function(data, xhr) {
var c = {};
// in case this is a response of saving the layer discard
// values from the server
if (!data || this._saving && !this.isNew()) {
- 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 toJSON
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
toJSON: function() {
var c = _.clone(this.attributes);
// remove api key
if(c.extra_params) {
c.extra_params = _.clone(this.attributes.extra_params);
- 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 isHistoryAtFirstPosition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
isHistoryAtFirstPosition: function(property) {
if(this.get(property+'_history').length === 0) {
return true;
}
var stored = this[property+'_storage'].get();
- 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"