Function checkResizeEdge
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
function checkResizeEdge(
name: string,
value: any,
page: Point,
element: Node,
- 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
File plugin.ts
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { Interactable } from '@interactjs/core/Interactable'
import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'
import type { Interaction } from '@interactjs/core/Interaction'
import type { PerActionDefaults } from '@interactjs/core/options'
import type { Scope, Plugin } from '@interactjs/core/scope'
Function resizeChecker
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function resizeChecker(arg) {
const { interaction, interactable, element, rect, buttons } = arg
if (!rect) {
return undefined
- 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 resizeChecker
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resizeChecker(arg) {
const { interaction, interactable, element, rect, buttons } = arg
if (!rect) {
return undefined
Function checkResizeEdge
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkResizeEdge(
name: string,
value: any,
page: Point,
element: Node,
Function move
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function move({ iEvent, interaction }: { iEvent: InteractEvent<any, any>; interaction: Interaction }) {
if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) return
const resizeEvent = iEvent as ResizeEvent
const resizeOptions = interaction.interactable.options.resize
- 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 initCursors
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initCursors(browser: typeof import('@interactjs/utils/browser').default) {
return browser.isIe9
? {
x: 'e-resize',
y: 's-resize',
Function resizable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function resizable(interactable: Interactable, options: OrBoolean<ResizableOptions> | boolean, scope: Scope) {
if (is.object(options)) {
interactable.options.resize.enabled = options.enabled !== false
interactable.setPerAction('resize', options)
interactable.setOnEvents('resize', options)
- 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 updateEventAxes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function updateEventAxes({
iEvent,
interaction,
}: {
iEvent: InteractEvent<any, any>
- 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 checkResizeEdge
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
name: string,
value: any,
page: Point,
element: Node,
interactableElement: Element,
Consider simplifying this complex logical expression. Open
if (is.object(resizeOptions.edges)) {
const resizeEdges = {
left: false,
right: false,
top: false,
Function getCursor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getCursor({ edges, axis, name }: ActionProps) {
const cursors = resize.cursors
let result: string = null
if (axis) {
- 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
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return page.y > (height >= 0 ? rect.bottom : rect.top) - margin
Avoid too many return
statements within this function. Open
return is.element(value)
? // the value is an element to use as a resize handle
value === element
: // otherwise check if element matches value as selector
dom.matchesUpTo(element, value, interactableElement)