taye/interact.js

View on GitHub

Showing 163 of 163 total issues

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

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

Consider simplifying this complex logical expression.
Open

    if (
      (is.element(accept) && accept !== draggableElement) ||
      (is.string(accept) && !domUtils.matchesSelector(draggableElement, accept)) ||
      (is.func(accept) && !accept({ dropzone, draggableElement }))
    ) {
Severity: Major
Found in packages/@interactjs/actions/drop/plugin.ts - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

        if (
          !closest.target ||
          (inRange
            ? // is the closest target in range?
              closest.inRange && range !== Infinity
    Severity: Major
    Found in packages/@interactjs/modifiers/snap/pointer.ts - About 40 mins to fix

      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/babel/inline-env-vars.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

          Consider simplifying this complex logical expression.
          Open

                if (!browser.supportsPointerEvent && /mouse/.test(event.type)) {
                  // ignore mouse events while touch interactions are active
                  for (let i = 0; i < interactions.length && !invalidPointer; i++) {
                    invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown
                  }
          Severity: Major
          Found in packages/@interactjs/core/interactions.ts - About 40 mins to fix

            Function _onOff has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              Interactable.prototype._onOff = function (method, typeArg, listenerArg, options, filter) {
            Severity: Minor
            Found in packages/@interactjs/dev-tools/plugin.ts - About 35 mins to fix

              Function startReflow has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                scope: Scope,
                interactable: Interactable,
                element: Element,
                action: ActionProps<T>,
                event: any,
              Severity: Minor
              Found in packages/@interactjs/reflow/plugin.ts - About 35 mins to fix

                Function addDelegate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    selector: string,
                    context: Node,
                    type: string,
                    listener: ListenerEntry['func'],
                    optionalArg?: any,
                Severity: Minor
                Found in packages/@interactjs/core/events.ts - About 35 mins to fix

                  Function validateAction has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    action: ActionProps<T>,
                    interactable: Interactable,
                    element: Element,
                    eventTarget: Node,
                    scope: Scope,
                  Severity: Minor
                  Found in packages/@interactjs/auto-start/base.ts - About 35 mins to fix

                    Function removeDelegate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        selector: string,
                        context: Document | Element,
                        type: string,
                        listener?: ListenerEntry['func'],
                        optionalArg?: any,
                    Severity: Minor
                    Found in packages/@interactjs/core/events.ts - About 35 mins to fix

                      Function getActionInfo has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        interaction: Interaction,
                        pointer: PointerType,
                        event: PointerEventType,
                        eventTarget: Node,
                        scope: Scope,
                      Severity: Minor
                      Found in packages/@interactjs/auto-start/base.ts - About 35 mins to fix

                        Function getAction has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            this: Interactable,
                            pointer: PointerType,
                            event: PointerEventType,
                            interaction: Interaction,
                            element: Element,
                        Severity: Minor
                        Found in packages/@interactjs/auto-start/InteractableMethods.ts - About 35 mins to fix

                          Function defaultActionChecker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            interactable: Interactable,
                            event: PointerEventType,
                            interaction: Interaction,
                            element: Element,
                            scope: Scope,
                          Severity: Minor
                          Found in packages/@interactjs/auto-start/InteractableMethods.ts - About 35 mins to fix

                            Function shallowEqual has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export default function shallowEqual(left: any, right: any) {
                              if (left === right) {
                                return true
                              }
                            
                            
                            Severity: Minor
                            Found in packages/@interactjs/utils/shallowEqual.ts - About 35 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 updateGestureProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function updateGestureProps({ interaction, iEvent, phase }: GestureSignalArg) {
                              if (interaction.prepared.name !== 'gesture') return
                            
                              const pointers = interaction.pointers.map((p) => p.pointer)
                              const starting = phase === 'start'
                            Severity: Minor
                            Found in packages/@interactjs/actions/gesture/plugin.ts - About 35 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 getPointerType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function getPointerType(pointer: { pointerType?: string; identifier?: number; type?: string }) {
                              return is.string(pointer.pointerType)
                                ? pointer.pointerType
                                : is.number(pointer.pointerType)
                                  ? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType]!
                            Severity: Minor
                            Found in packages/@interactjs/utils/pointerUtils.ts - About 35 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 set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              set(options: OptionsArg) {
                                const defaults = this._defaults
                            
                                if (!is.object(options)) {
                                  options = {}
                            Severity: Minor
                            Found in packages/@interactjs/core/Interactable.ts - About 35 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