taye/interact.js

View on GitHub

Showing 156 of 156 total issues

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

function updateEventAxes ({ iEvent, interaction }: { iEvent: Interact.InteractEvent<any, any>, interaction: Interaction }) {
  if (interaction.prepared.name !== 'resize' || !interaction.resizeAxes) { return }

  const options = interaction.interactable.options
  const resizeEvent = iEvent as ResizeEvent
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 dropCheck has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  Interactable.prototype.dropCheck = function (this: Interact.Interactable, dragEvent, event, draggable, draggableElement, dropElement, rect) {
Severity: Major
Found in packages/@interactjs/actions/drop/plugin.ts - About 50 mins to fix

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

      interactable: Interact.Interactable,
      dragEvent: InteractEvent,
      event: Interact.PointerEventType,
      draggable: Interact.Interactable,
      draggableElement: Interact.Element,
    Severity: Major
    Found in packages/@interactjs/actions/drop/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, endY: number, position: number) {
      Severity: Major
      Found in packages/@interactjs/inertia/plugin.ts - About 50 mins to fix

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

          name: string,
          value: any,
          page: Interact.Point,
          element: Node,
          interactableElement: Interact.Element,
        Severity: Major
        Found in packages/@interactjs/actions/resize/plugin.ts - About 50 mins to fix

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

            interaction: Interact.Interaction,
            pointer: Interact.PointerType,
            event: Interact.PointerEventType,
            matches: Interact.Interactable[],
            matchElements: Interact.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/testProject/index.ts - About 50 mins to fix

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

                off (type: string, listener: Interact.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

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

              async function generate ({
                sources,
                shim,
                babelOptions = getBabelOptions(),
                filter,
              Severity: Minor
              Found in scripts/esnext.js - 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: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {
                  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 (!listeners.length) {
                            delegates.splice(index, 1)
              
                            // remove delegate function from context
                            remove(context, type, delegateListener)
              Severity: Major
              Found in packages/@interactjs/core/events.ts - About 45 mins to fix

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

                function setInteractionCursor<T extends Interact.ActionName> (interaction: Interact.Interaction<T>, scope: Interact.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 forEachMatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  forEachMatch<T> (node: Node, callback: (interactable: Interact.Interactable) => T) {
                    for (const interactable of this.list) {
                      let ret: void | T
                
                      if ((is.string(interactable.target)
                Severity: Minor
                Found in packages/@interactjs/core/InteractableSet.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 startOnMove has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function startOnMove (arg: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {
                  const { interaction } = arg
                
                  if (!interaction.pointerIsDown ||
                      interaction.interacting() ||
                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

                Avoid deeply nested control flow statements.
                Open

                            if (capture === options.capture && passive === options.passive) {
                              fn(fakeEvent)
                            }
                Severity: Major
                Found in packages/@interactjs/core/events.ts - About 45 mins to fix

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

                    start (event: Interact.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

                  Avoid deeply nested control flow statements.
                  Open

                              if (typeListeners.length === 0) {
                                delete target.events[type]
                                typeIsEmpty = true
                              }
                  Severity: Major
                  Found in packages/@interactjs/core/events.ts - About 45 mins to fix

                    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
                    > (
                    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

                    Consider simplifying this complex logical expression.
                    Open

                              if (
                                t.isStringLiteral(key) &&
                                (!include || include.indexOf(key.value) !== -1) &&
                                (!exclude || exclude.indexOf(key.value) === -1)
                              ) {
                    Severity: Major
                    Found in scripts/utils.js - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                        if (is.object(resizeOptions.edges)) {
                          const resizeEdges = {
                            left: false,
                            right: false,
                            top: false,
                      Severity: Major
                      Found in packages/@interactjs/actions/resize/plugin.ts - About 40 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language