taye/interact.js

View on GitHub

Showing 142 of 156 total issues

Function scroll has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  scroll () {
    const { interaction } = autoScroll
    const { interactable, element } = interaction
    const options = interactable.options[autoScroll.interaction.prepared.name].autoScroll
    const container = getContainer(options.container, interactable, element)
Severity: Minor
Found in packages/auto-scroll/index.ts - About 1 hr to fix

    Function dropzoneMethod has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function dropzoneMethod (interactable: Interact.Interactable, options?: Interact.DropzoneOptions | boolean) {
      if (utils.is.object(options)) {
        interactable.options.drop.enabled = options.enabled !== false
    
        if (options.listeners) {
    Severity: Minor
    Found in packages/actions/drop/index.ts - About 1 hr to fix

      Function init has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function init (window) {
        const Element = domObjects.Element
        const navigator  = win.window.navigator
      
        // Does the browser support touch input?
      Severity: Minor
      Found in packages/utils/browser.ts - About 1 hr to fix

        Function remove has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function remove (element: EventTarget, type: string, listener?: 'all' | Listener, optionalArg?: boolean | any) {
          const options = getOptions(optionalArg)
          const elementIndex = elements.indexOf(element)
          const target = targets[elementIndex]
        
        
        Severity: Minor
        Found in packages/utils/events.ts - About 1 hr to fix

          Function install has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function install (scope: Scope) {
            const {
              actions,
              Interactable,
              interactions,
          Severity: Minor
          Found in packages/actions/gesture.ts - About 1 hr to fix

            Function reflow has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function reflow (interactable: Interactable, action: ActionProps, scope: Scope): Promise<Interactable> {
              const elements = is.string(interactable.target)
                ? arr.from(interactable._context.querySelectorAll(interactable.target))
                : [interactable.target]
            
            
            Severity: Minor
            Found in packages/reflow/index.ts - About 1 hr to fix

              Function _onOff has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                _onOff (method: 'on' | 'off', typeArg: Interact.EventTypes, listenerArg?: Interact.ListenersArg | null, options?: any) {
                  if (is.object(typeArg) && !is.array(typeArg)) {
                    options = listenerArg
                    listenerArg = null
                  }
              Severity: Minor
              Found in packages/core/Interactable.ts - About 1 hr 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 scroll has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                scroll () {
                  const { interaction } = autoScroll
                  const { interactable, element } = interaction
                  const options = interactable.options[autoScroll.interaction.prepared.name].autoScroll
                  const container = getContainer(options.container, interactable, element)
              Severity: Minor
              Found in packages/auto-scroll/index.ts - About 1 hr 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 on has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function on (type: string | Interact.EventTypes, listener: Interact.ListenersArg, options?) {
                if (utils.is.string(type) && type.search(' ') !== -1) {
                  type = type.trim().split(/ +/)
                }
              
              
              Severity: Minor
              Found in packages/interact/interact.ts - About 1 hr 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 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                pointerMove (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Node) {
                  if (!this.simulation && !(this.modifiers && this.modifiers.endPrevented)) {
                    this.updatePointer(pointer, event, eventTarget, false)
                    utils.pointer.setCoords(this.coords.cur, this.pointers.map(p => p.pointer), this._now())
                  }
              Severity: Minor
              Found in packages/core/Interaction.ts - About 1 hr to fix

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

                function start (arg: ModifierArg<SnapState>) {
                  const { interaction, interactable, element, rect, state, startOffset } = arg
                  const { options } = state
                  const offsets = []
                  const origin = options.offsetWithOrigin
                Severity: Minor
                Found in packages/modifiers/snap/pointer.ts - About 1 hr to fix

                  Function prepare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function prepare (interaction: Interact.Interaction, { action, interactable, element }, scope: Interact.Scope) {
                    action = action || {}
                  
                    if (interaction.interactable && interaction.interactable.options.styleCursor) {
                      setCursor(interaction.element as HTMLElement, '', scope)
                  Severity: Minor
                  Found in packages/auto-start/base.ts - About 1 hr 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 fire has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function fire<T extends string> (arg: {
                    interaction: Interaction
                    pointer: Interact.PointerType
                    event: Interact.PointerEventType
                    eventTarget: Interact.EventTarget
                  Severity: Minor
                  Found in packages/pointer-events/base.ts - About 1 hr 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 simulationResume has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    simulationResume ({ pointerType, eventType, eventTarget, scope }: SearchDetails) {
                      if (!/down|start/i.test(eventType)) {
                        return null
                      }
                  
                  
                  Severity: Minor
                  Found in packages/core/interactionFinder.ts - About 1 hr 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 constructor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    constructor (
                      interaction: Interaction,
                      event: Interact.PointerEventType,
                      actionName: T,
                      phase: P,
                  Severity: Minor
                  Found in packages/core/InteractEvent.ts - About 1 hr 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 release has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function release<T extends Interact.ActionName> (
                    { interaction, event, noPreEnd }: Interact.SignalArg,
                    scope: Interact.Scope
                  ) {
                    const state = interaction.inertia
                  Severity: Minor
                  Found in packages/inertia/index.ts - About 1 hr 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 onInteractionMove has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    onInteractionMove ({ interaction, pointer }) {
                      if (!(interaction.interacting() &&
                            autoScroll.check(interaction.interactable, interaction.prepared.name))) {
                        return
                      }
                  Severity: Minor
                  Found in packages/auto-scroll/index.ts - About 1 hr to fix

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

                    function inertiaTick (interaction: Interact.Interaction) {
                      updateInertiaCoords(interaction)
                      utils.pointer.setCoordDeltas(interaction.coords.delta, interaction.coords.prev, interaction.coords.cur)
                      utils.pointer.setCoordVelocity(interaction.coords.velocity, interaction.coords.delta)
                    
                    
                    Severity: Minor
                    Found in packages/inertia/index.ts - About 1 hr to fix

                      Function dropCheckMethod has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function dropCheckMethod (
                        interactable: Interact.Interactable,
                        dragEvent: InteractEvent,
                        event: Interact.PointerEventType,
                        draggable: Interact.Interactable,
                      Severity: Minor
                      Found in packages/actions/drop/index.ts - About 1 hr to fix

                        Function set has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function set (arg: ModifierArg<RestrictSizeState>) {
                          const { interaction, state } = arg
                          const { options } = state
                          const edges = interaction.prepared._linkedEdges || interaction.prepared.edges
                        
                        
                        Severity: Minor
                        Found in packages/modifiers/restrict/size.ts - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language