packages/@interactjs/inertia/plugin.ts
File plugin.ts
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
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'
Function start
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
start(event: PointerEventType) {
const { interaction } = this
const options = getOptions(interaction)
if (!options || !options.enabled) {
Function inertiaTick
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
inertiaTick() {
const { interaction } = this
const options = getOptions(interaction)
const lambda = options.resistance
const t = (interaction._now() - this.t0) / 1000
Function getQuadraticCurvePoint
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
startX: number,
startY: number,
cpX: number,
cpY: number,
endX: number,
Function start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
start(event: PointerEventType) {
const { interaction } = this
const options = getOptions(interaction)
if (!options || !options.enabled) {
- 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"