Showing 163 of 163 total issues
Function install
has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring. Open
function install(scope: Scope) {
const targets: Array<{
eventTarget: PartialEventTarget
events: { [type: string]: ListenerEntry[] }
}> = []
- 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 509 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, DoPhaseArg } from '@interactjs/core/Interaction'
import type { PerActionDefaults } from '@interactjs/core/options'
import type { Scope, Plugin } from '@interactjs/core/scope'
Function install
has 204 lines of code (exceeds 25 allowed). Consider refactoring. Open
function install(scope: Scope) {
const targets: Array<{
eventTarget: PartialEventTarget
events: { [type: string]: ListenerEntry[] }
}> = []
Function createInteractStatic
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
export function createInteractStatic(scope: Scope): InteractStatic {
const interact = ((target: Target, options: Options) => {
let interactable = scope.interactables.getExisting(target, options)
if (!interactable) {
- 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 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 Interaction.ts
has 432 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as arr from '@interactjs/utils/arr'
import extend from '@interactjs/utils/extend'
import hypot from '@interactjs/utils/hypot'
import { warnOnce, copyAction } from '@interactjs/utils/misc'
import * as pointerUtils from '@interactjs/utils/pointerUtils'
Function set
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
function set(arg: ModifierArg<SnapState>) {
const { interaction, coords, state } = arg
const { options, offsets } = state
const origin = getOriginXY(interaction.interactable!, interaction.element!, interaction.prepared.name)
- 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 indexOfDeepestElement
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
export function indexOfDeepestElement(elements: Element[] | NodeListOf<globalThis.Element>) {
let deepestNodeParents: Node[] = []
let deepestNodeIndex: number
for (let i = 0; i < elements.length; i++) {
- 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 dropzoneMethod
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
function dropzoneMethod(interactable: Interactable, options?: DropzoneOptions | boolean) {
if (is.object(options)) {
interactable.options.drop.enabled = options.enabled !== false
if (options.listeners) {
- 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 createInteractStatic
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createInteractStatic(scope: Scope): InteractStatic {
const interact = ((target: Target, options: Options) => {
let interactable = scope.interactables.getExisting(target, options)
if (!interactable) {
File plugin.ts
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'
import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'
import type { ActionName, Point, PointerEventType } from '@interactjs/core/types'
/* eslint-disable import/no-duplicates -- for typescript module augmentations */
import '@interactjs/modifiers/base'
File Modification.ts
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { EventPhase } from '@interactjs/core/InteractEvent'
import type { Interaction, DoAnyPhaseArg } from '@interactjs/core/Interaction'
import type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'
import clone from '@interactjs/utils/clone'
import extend from '@interactjs/utils/extend'
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,
File Interactable.ts
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable no-dupe-class-members */
import * as arr from '@interactjs/utils/arr'
import browser from '@interactjs/utils/browser'
import clone from '@interactjs/utils/clone'
import { getElementRect, matchesUpTo, nodeContains, trySelector } from '@interactjs/utils/domUtils'
File base.ts
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type { Eventable } from '@interactjs/core/Eventable'
import type { Interaction } from '@interactjs/core/Interaction'
import type { PerActionDefaults } from '@interactjs/core/options'
import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'
import type { Point, PointerType, PointerEventType, Element } from '@interactjs/core/types'
Function _onOff
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
_onOff(
method: OnOffMethod,
typeArg: EventTypes,
listenerArg?: ListenersArg | null,
options?: 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 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 beforeStart
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function beforeStart({ interaction, eventTarget, dx, dy }: SignalArgs['interactions:move'], scope: Scope) {
if (interaction.prepared.name !== 'drag') return
// check if a drag is in the correct axis
const absX = Math.abs(dx)
- 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 start
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
start(arg) {
const { state, rect, edges, pageCoords: coords } = arg
let { ratio, enabled } = state.options
const { equalDelta, modifiers } = state.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"