Function inverse
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function inverse (bufferSize, buffer, output) {
var n = bufferSize
var x = output || new Float64Array(bufferSize)
var TWO_PI = 2 * Math.PI
var n2, n4, n8, nn,
Function inverse
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export default function inverse (bufferSize, buffer, output) {
var n = bufferSize
var x = output || new Float64Array(bufferSize)
var TWO_PI = 2 * Math.PI
var n2, n4, n8, nn,
- 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
Unexpected use of comma operator. Open
while (h = h >> 1, !((r ^= h) & h)) ;
- Read upRead up
- Exclude checks
Disallow Use of the Comma Operator (no-sequences)
The comma operator includes multiple expressions where only one is expected. It evaluates each operand from left to right and returns the value of the last operand. However, this frequently obscures side effects, and its use is often an accident. Here are some examples of sequences:
var a = (3, 5); // a = 5
a = b += 5, a + b;
while (a = next(), a && a.length);
(0, eval)("doSomething();");
Rule Details
This rule forbids the use of the comma operator, with the following exceptions:
- In the initialization or update portions of a
for
statement. - If the expression sequence is explicitly wrapped in parentheses.
Examples of incorrect code for this rule:
/*eslint no-sequences: "error"*/
foo = doSomething(), val;
0, eval("doSomething();");
do {} while (doSomething(), !!test);
for (; doSomething(), !!test; );
if (doSomething(), !!test);
switch (val = foo(), val) {}
while (val = foo(), val < 42);
with (doSomething(), val) {}
Examples of correct code for this rule:
/*eslint no-sequences: "error"*/
foo = (doSomething(), val);
(0, eval)("doSomething();");
do {} while ((doSomething(), !!test));
for (i = 0, j = 10; i < j; i++, j--);
if ((doSomething(), !!test));
switch ((val = foo(), val)) {}
while ((val = foo(), val < 42));
// with ((doSomething(), val)) {}
When Not To Use It
Disable this rule if sequence expressions with the comma operator are acceptable. Source: http://eslint.org/docs/rules/