Showing 7 of 7 total issues
Function default
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function (x) {
const isArray = Array.isArray || _isArray;
if (!x) {
return false;
}
- Read upRead up
- Create a ticketCreate a ticket
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 registerListener
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
registerListener(listener, scope, once) {
const _listeners = this.listenerBoxes.filter(box => box.listener === listener && box.scope === scope);
if (!_listeners.length) {
if (this.listenersNeedCloning) {
- Read upRead up
- Create a ticketCreate a ticket
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 arityFn
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const arityFn=(function (FUNCTIONS) {
return (arity, fn) => {
if (typeof arity !== 'number') {
throw new TypeError('Expected arity to be a number, got ' + arity);
}
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this function. Open
return !!x.length;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return true;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return false;
- Create a ticketCreate a ticket