taye/interact.js

View on GitHub

Showing 156 of 156 total issues

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

      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 }))) {
            continue
      Severity: Major
      Found in packages/@interactjs/actions/drop/plugin.ts - About 40 mins to fix

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

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

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

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

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

              function addDelegate (selector: string, context: Node, type: string, listener: Listener, 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: Interact.ActionProps<T>,
                interactable: Interact.Interactable,
                element: Interact.Element,
                eventTarget: Node,
                scope: Interact.Scope,
              Severity: Minor
              Found in packages/@interactjs/auto-start/base.ts - About 35 mins to fix

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

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

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

                    interaction: Interact.Interaction,
                    pointer: Interact.PointerType,
                    event: Interact.PointerEventType,
                    eventTarget: Node,
                    scope: Interact.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: Interact.Interactable,
                        pointer: Interact.PointerType,
                        event: Interact.PointerEventType,
                        interaction: Interact.Interaction,
                        element: Interact.Element,
                    Severity: Minor
                    Found in packages/@interactjs/auto-start/InteractableMethods.ts - About 35 mins to fix

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

                      function set (arg: ModifierArg<RestrictSizeState>) {
                        const { interaction, state, rect, edges } = arg
                        const { options } = state
                      
                        if (!edges) {
                      Severity: Minor
                      Found in packages/@interactjs/modifiers/restrict/size.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 new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        new (target: Interact.Target, options?: any): Interactable {
                          options = extend(options || {}, {
                            actions: this.scope.actions,
                          })
                          const interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events)
                      Severity: Minor
                      Found in packages/@interactjs/core/InteractableSet.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 exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = function (options) {
                        const browserify = require('browserify')
                        const plugins = (options.watch)
                          ? [
                            require('watchify'),
                      Severity: Minor
                      Found in scripts/bundler.js - 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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        get (target: Interact.Target, options?: Interact.Options) {
                          const context = (options && options.context) || this.scope.document
                          const isSelector = is.string(target)
                          const targetMappings: InteractableScopeProp[] = isSelector
                            ? this.selectorMap[target as string]
                      Severity: Minor
                      Found in packages/@interactjs/core/InteractableSet.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 setAll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        setAll (arg: MethodArg & Partial<ModifierArg>): ModificationResult {
                          this.fillArg(arg)
                      
                          const {
                            phase,
                      Severity: Minor
                      Found in packages/@interactjs/modifiers/Modification.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 getCursor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        getCursor ({ edges, axis, name }: Interact.ActionProps) {
                          const cursors = resize.cursors
                          let result: string = null
                      
                          if (axis) {
                      Severity: Minor
                      Found in packages/@interactjs/actions/resize/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

                      Avoid too many return statements within this function.
                      Open

                          return null
                      Severity: Major
                      Found in packages/@interactjs/core/interactionFinder.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          return autoStartMax > 0
                        Severity: Major
                        Found in packages/@interactjs/auto-start/base.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return
                          Severity: Major
                          Found in packages/@interactjs/core/interactablePreventDefault.ts - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language