Showing 41 of 85 total issues
Function has too many statements (32). Maximum allowed is 30. Open
base.findGridPlace = function(size,grid,scale){
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
enforce a maximum number of statements allowed in function blocks (max-statements)
The max-statements
rule allows you to specify the maximum number of statements allowed in a function.
function foo() {
var bar = 1; // one statement
var baz = 2; // two statements
var qux = 3; // three statements
}
Rule Details
This rule enforces a maximum number of statements allowed in function blocks.
Options
This rule has a number or object option:
-
"max"
(default10
) enforces a maximum number of statements allows in function blocks
Deprecated: The object property maximum
is deprecated; please use the object property max
instead.
This rule has an object option:
-
"ignoreTopLevelFunctions": true
ignores top-level functions
max
Examples of incorrect code for this rule with the default { "max": 10 }
option:
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
};
Examples of correct code for this rule with the default { "max": 10 }
option:
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
ignoreTopLevelFunctions
Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true }
options:
/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11;
}
Related Rules
- [complexity](complexity.md)
- [max-depth](max-depth.md)
- [max-len](max-len.md)
- [max-nested-callbacks](max-nested-callbacks.md)
- [max-params](max-params.md) Source: http://eslint.org/docs/rules/
Function has too many statements (32). Maximum allowed is 30. Open
base.getSettingsFromData = function(that){
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
enforce a maximum number of statements allowed in function blocks (max-statements)
The max-statements
rule allows you to specify the maximum number of statements allowed in a function.
function foo() {
var bar = 1; // one statement
var baz = 2; // two statements
var qux = 3; // three statements
}
Rule Details
This rule enforces a maximum number of statements allowed in function blocks.
Options
This rule has a number or object option:
-
"max"
(default10
) enforces a maximum number of statements allows in function blocks
Deprecated: The object property maximum
is deprecated; please use the object property max
instead.
This rule has an object option:
-
"ignoreTopLevelFunctions": true
ignores top-level functions
max
Examples of incorrect code for this rule with the default { "max": 10 }
option:
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11; // Too many.
};
Examples of correct code for this rule with the default { "max": 10 }
option:
/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
let foo = () => {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
return function () {
// The number of statements in the inner function does not count toward the
// statement maximum.
return 42;
};
}
ignoreTopLevelFunctions
Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true }
options:
/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/
function foo() {
var foo1 = 1;
var foo2 = 2;
var foo3 = 3;
var foo4 = 4;
var foo5 = 5;
var foo6 = 6;
var foo7 = 7;
var foo8 = 8;
var foo9 = 9;
var foo10 = 10;
var foo11 = 11;
}
Related Rules
- [complexity](complexity.md)
- [max-depth](max-depth.md)
- [max-len](max-len.md)
- [max-nested-callbacks](max-nested-callbacks.md)
- [max-params](max-params.md) Source: http://eslint.org/docs/rules/
Function getSettingsFromData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
base.getSettingsFromData = function(that){
var i,j,k,x,y,z;
var attrs = that.attributes;
var data;
if(typeof attrs !== "undefined"){
- Create a ticketCreate a ticket
Function getsize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
base.getsize = function(optionSize,defaultSize){
var size = [];
if(optionSize){
if(Array.isArray(optionSize)){
if(optionSize.length === 0){
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(typeof data === "undefined"){data={};}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
}else if(typeof data !== "undefined" && typeof data[i] !== "undefined"){
for(j in data[i]){
if(
data[i].hasOwnProperty(j) &&
base.settings.adaptivMedia.hasOwnProperty(j)
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(z.length>1){
for(k=1;k<z.length;k++){
z[k] = z[k].slice(0,1).toUpperCase() + z[k].slice(1).toLowerCase();
}
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(typeof data === "undefined"){data={};}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(typeof data === "undefined"){data={};}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for(i=y;i<y+size[1];i++){
for(j=x;j<x+size[0];j++){
if(grid[i][j]){
g = false;
break;
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(typeof data.adaptivMedia === "undefined"){data.adaptivMedia={};}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(typeof data === "undefined"){data={};}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
switch(i){
case "adaptivSize":
if(typeof settings.tiles[data.id][i] !== "undefined"){
for(j in settings.tiles[data.id][i]){
if(settings.tiles[data.id][i].hasOwnProperty(j)){
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(z.length>1){
for(k=1;k<z.length;k++){
z[k] = z[k].slice(0,1).toUpperCase() + z[k].slice(1).toLowerCase();
}
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(typeof data.adaptivSize === "undefined"){data.adaptivSize={};}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(typeof data === "undefined"){data={};}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for(j in settings[i]){
if(
settings[i].hasOwnProperty(j) &&
base.settings.adaptivMedia.hasOwnProperty(j)
) {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(optionSize[1]*1 && optionSize[1]*1 > 0){
size[1] = optionSize[1]*1;
}else{
size[1] = defaultSize[1];
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(g){
f = true;
break;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for(x=gridSize[0];x>0;x--){
for(y=gridSize[0];y>0;y--){
fainder = base.findGridPlace([x,y],grid,false);
if(fainder){
size = [x,y];
- Create a ticketCreate a ticket