File base.ts
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { Interactable } from '@interactjs/core/Interactable'
import type { Interaction } from '@interactjs/core/Interaction'
import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'
import type {
CursorChecker,
Function withinInteractionLimit
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function withinInteractionLimit<T extends ActionName>(
interactable: Interactable,
element: Element,
action: ActionProps<T>,
scope: Scope,
- 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 withinInteractionLimit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function withinInteractionLimit<T extends ActionName>(
interactable: Interactable,
element: Element,
action: ActionProps<T>,
scope: Scope,
Function getActionInfo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getActionInfo(
interaction: Interaction,
pointer: PointerType,
event: PointerEventType,
eventTarget: Node,
Function validateMatches
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
interaction: Interaction,
pointer: PointerType,
event: PointerEventType,
matches: Interactable[],
matchElements: Element[],
Function setInteractionCursor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function setInteractionCursor<T extends ActionName>(interaction: Interaction<T>, scope: Scope) {
const { interactable, element, prepared } = interaction
if (!(interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor)) {
// clear previous target element cursor
- 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 startOnMove
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function startOnMove(arg: SignalArgs['interactions:move'], scope: Scope) {
const { interaction } = arg
if (
!interaction.pointerIsDown ||
- 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 validateAction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
action: ActionProps<T>,
interactable: Interactable,
element: Element,
eventTarget: Node,
scope: Scope,
Function getActionInfo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
interaction: Interaction,
pointer: PointerType,
event: PointerEventType,
eventTarget: Node,
scope: Scope,
Avoid too many return
statements within this function. Open
return autoStartMax > 0