Method '_mouseMove' has a complexity of 15. Open
_mouseMove: function( event ) {
- Read upRead up
- Exclude checks
Limit Cyclomatic Complexity (complexity)
Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.
function a(x) {
if (true) {
return x; // 1st path
} else if (false) {
return x+1; // 2nd path
} else {
return 4; // 3rd path
}
}
Rule Details
This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20
).
Examples of incorrect code for a maximum of 2:
/*eslint complexity: ["error", 2]*/
function a(x) {
if (true) {
return x;
} else if (false) {
return x+1;
} else {
return 4; // 3rd path
}
}
Examples of correct code for a maximum of 2:
/*eslint complexity: ["error", 2]*/
function a(x) {
if (true) {
return x;
} else {
return 4;
}
}
Options
Optionally, you may specify a max
object property:
"complexity": ["error", 2]
is equivalent to
"complexity": ["error", { "max": 2 }]
Deprecated: the object property maximum
is deprecated. Please use the property max
instead.
When Not To Use It
If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.
Further Reading
Related Rules
- [max-depth](max-depth.md)
- [max-len](max-len.md)
- [max-nested-callbacks](max-nested-callbacks.md)
- [max-params](max-params.md)
- [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/
Method '_mouseDown' has a complexity of 11. Open
_mouseDown: function( event ) {
- Read upRead up
- Exclude checks
Limit Cyclomatic Complexity (complexity)
Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.
function a(x) {
if (true) {
return x; // 1st path
} else if (false) {
return x+1; // 2nd path
} else {
return 4; // 3rd path
}
}
Rule Details
This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20
).
Examples of incorrect code for a maximum of 2:
/*eslint complexity: ["error", 2]*/
function a(x) {
if (true) {
return x;
} else if (false) {
return x+1;
} else {
return 4; // 3rd path
}
}
Examples of correct code for a maximum of 2:
/*eslint complexity: ["error", 2]*/
function a(x) {
if (true) {
return x;
} else {
return 4;
}
}
Options
Optionally, you may specify a max
object property:
"complexity": ["error", 2]
is equivalent to
"complexity": ["error", { "max": 2 }]
Deprecated: the object property maximum
is deprecated. Please use the property max
instead.
When Not To Use It
If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.
Further Reading
Related Rules
- [max-depth](max-depth.md)
- [max-len](max-len.md)
- [max-nested-callbacks](max-nested-callbacks.md)
- [max-params](max-params.md)
- [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/
Function _mouseDown
has 43 lines of code (exceeds 40 allowed). Consider refactoring. Open
_mouseDown: function( event ) {
// don't let more than one widget handle mouseStart
if ( mouseHandled ) {
return;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return !this._mouseStarted;
Avoid too many return
statements within this function. Open
return event.preventDefault();
Avoid too many return
statements within this function. Open
return true;
Shadowing of global property 'undefined'. Open
], function ($, undefined) {
- Read upRead up
- Exclude checks
Disallow Shadowing of Restricted Names (no-shadow-restricted-names)
ES5 §15.1.1 Value Properties of the Global Object (NaN
, Infinity
, undefined
) as well as strict mode restricted identifiers eval
and arguments
are considered to be restricted names in JavaScript. Defining them to mean something else can have unintended consequences and confuse others reading the code. For example, there's nothing prevent you from writing:
var undefined = "foo";
Then any code used within the same scope would not get the global undefined
, but rather the local version with a very different meaning.
Rule Details
Examples of incorrect code for this rule:
/*eslint no-shadow-restricted-names: "error"*/
function NaN(){}
!function(Infinity){};
var undefined;
try {} catch(eval){}
Examples of correct code for this rule:
/*eslint no-shadow-restricted-names: "error"*/
var Object;
function f(a, b){}
Further Reading
Related Rules
- [no-shadow](no-shadow.md) Source: http://eslint.org/docs/rules/
TODO found Open
// TODO: make sure destroying one instance of mouse doesn't mess with
- Exclude checks