taye/interact.js

View on GitHub

Showing 163 of 163 total issues

Function updateEventAxes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function updateEventAxes({
  iEvent,
  interaction,
}: {
  iEvent: InteractEvent<any, any>
Severity: Minor
Found in packages/@interactjs/actions/resize/plugin.ts - About 55 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

Function getTouchPair has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function getTouchPair(event: TouchEvent | PointerType[]) {
  const touches: PointerType[] = []

  // array of touches is supplied
  if (is.array(event)) {
Severity: Minor
Found in packages/@interactjs/utils/pointerUtils.ts - About 55 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

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)
Severity: Minor
Found in packages/@interactjs/actions/resize/plugin.ts - About 55 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

Function beforeEnd has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  beforeEnd(arg: Omit<DoAnyPhaseArg, 'iEvent'> & { state?: ModifierState }): void | false {
    const { interaction, event } = arg
    const states = this.states

    if (!states || !states.length) {
Severity: Minor
Found in packages/@interactjs/modifiers/Modification.ts - About 55 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

Function idle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  idle({ pointerType, scope }: SearchDetails) {
    for (const interaction of scope.interactions.list) {
      // if there's already a pointer held down
      if (interaction.pointers.length === 1) {
        const target = interaction.interactable
Severity: Minor
Found in packages/@interactjs/core/interactionFinder.ts - About 55 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

Function forEachMatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  forEachMatch<T>(node: Node, callback: (interactable: Interactable) => T): T | void {
    for (const interactable of this.list) {
      let ret: T

      if (
Severity: Minor
Found in packages/@interactjs/core/InteractableSet.ts - About 55 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

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

  interaction: Interaction,
  pointer: PointerType,
  event: PointerEventType,
  matches: Interactable[],
  matchElements: Element[],
Severity: Major
Found in packages/@interactjs/auto-start/base.ts - About 50 mins to fix

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

        _dragEvent: Interact.Element, // related dragmove or dragend
        _event: Event, // Touch, Pointer or Mouse Event
        dropped: boolean, // bool default checker result
        _dropzone: Interact.Interactable, // dropzone Interactable
        dropElement: Interact.Element, // dropzone elemnt
    Severity: Major
    Found in test/fixtures/dependentTsProject/index.ts - About 50 mins to fix

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

        interactable: Interactable,
        dragEvent: InteractEvent,
        event: PointerEventType,
        draggable: Interactable,
        draggableElement: Element,
      Severity: Major
      Found in packages/@interactjs/actions/drop/plugin.ts - About 50 mins to fix

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

          name: string,
          value: any,
          page: Point,
          element: Node,
          interactableElement: Element,
        Severity: Major
        Found in packages/@interactjs/actions/resize/plugin.ts - About 50 mins 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 dropCheck has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                this: Interactable,
                dragEvent,
                event,
                draggable,
                draggableElement,
            Severity: Major
            Found in packages/@interactjs/actions/drop/plugin.ts - About 50 mins to fix

              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
              Severity: Minor
              Found in packages/@interactjs/auto-start/base.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

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

                setAll(arg: MethodArg & Partial<ModifierArg>): ModificationResult {
                  const { phase, preEnd, skipModifiers, rect: unmodifiedRect, edges: unmodifiedEdges } = arg
              
                  arg.coords = extend({}, arg.pageCoords)
                  arg.rect = extend({}, unmodifiedRect)
              Severity: Minor
              Found in packages/@interactjs/modifiers/Modification.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

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

              export function makeModifier<
                Defaults extends { enabled?: boolean },
                State extends ModifierState,
                Name extends string,
                Result,
              Severity: Minor
              Found in packages/@interactjs/modifiers/base.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

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

                pointerMove(pointer: PointerType, event: PointerEventType, eventTarget: Node) {
                  if (!this.simulation && !(this.modification && this.modification.endResult)) {
                    this.updatePointer(pointer, event, eventTarget, false)
                  }
              
              
              Severity: Minor
              Found in packages/@interactjs/core/Interaction.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

              Avoid deeply nested control flow statements.
              Open

                          if (optionsMatch(entry.options, options)) {
                            entry.func(fakeEvent)
                          }
              Severity: Major
              Found in packages/@interactjs/core/events.ts - About 45 mins to fix

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

                  off(type: string, listener: ListenersArg) {
                    const listeners = normalize(type, listener)
                
                    for (type in listeners) {
                      const eventList = this.types[type]
                Severity: Minor
                Found in packages/@interactjs/core/Eventable.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

                Avoid deeply nested control flow statements.
                Open

                        if (deps[name] === previousVersion) {
                          deps[name] = currentVersion
                        } else {
                          console.warn(`${file}: not updating "${name}" from "${deps[name]}"`)
                        }
                Severity: Major
                Found in scripts/bin/version.js - About 45 mins to fix

                  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 ||
                  Severity: Minor
                  Found in packages/@interactjs/auto-start/base.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

                  Severity
                  Category
                  Status
                  Source
                  Language