taye/interact.js

View on GitHub
packages/@interactjs/inertia/plugin.ts

Summary

Maintainability
C
1 day
Test Coverage

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'
Severity: Minor
Found in packages/@interactjs/inertia/plugin.ts - About 4 hrs to fix

    Function start has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      start(event: PointerEventType) {
        const { interaction } = this
        const options = getOptions(interaction)
    
        if (!options || !options.enabled) {
    Severity: Minor
    Found in packages/@interactjs/inertia/plugin.ts - About 1 hr to fix

      Function inertiaTick has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        inertiaTick() {
          const { interaction } = this
          const options = getOptions(interaction)
          const lambda = options.resistance
          const t = (interaction._now() - this.t0) / 1000
      Severity: Minor
      Found in packages/@interactjs/inertia/plugin.ts - About 1 hr to fix

        Function getQuadraticCurvePoint has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          startX: number,
          startY: number,
          cpX: number,
          cpY: number,
          endX: number,
        Severity: Major
        Found in packages/@interactjs/inertia/plugin.ts - About 50 mins to fix

          Function start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            start(event: PointerEventType) {
              const { interaction } = this
              const options = getOptions(interaction)
          
              if (!options || !options.enabled) {
          Severity: Minor
          Found in packages/@interactjs/inertia/plugin.ts - About 45 mins to fix

          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

          There are no issues that match your filters.

          Category
          Status