Showing 23 of 64 total issues
Function compareLists
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function compareLists (list1, list2) {
const difference = []
let event
let exists
for ( let x = 0, l = list1.length; x < l; x++ ) {
- 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 dragOverHandler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
dragOverHandler (event) {
const targetOrder = parseInt(event.target.style.order, 10)
const targetParentClass = event.target.parentElement.classList
const targetId = event.target.id
if ( !this.state.dragging )
- 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 sortMessages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
sortMessages (messages) {
const sortedMessages = messages.map(m => ({...m}))
for ( let x = 0, l = sortedMessages.length - 1; x < l; x++ )
for ( let y = x + 1, l = sortedMessages.length; y < l; y++ )
if ( sortedMessages[x].timestamp < sortedMessages[y].timestamp )
- 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"