taye/interact.js

View on GitHub

Showing 154 of 154 total issues

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

function set (arg: ModifierArg<SnapState>) {
  const { interaction, coords, state } = arg
  const { options, offsets } = state

  const origin = getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name)
Severity: Major
Found in @interactjs/modifiers/snap/pointer.ts - About 2 hrs to fix

    Function exports has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (options) {
      const browserify = require('browserify')
      const plugins = (options.watch)
        ? [
          require('watchify'),
    Severity: Major
    Found in scripts/bundler.js - About 2 hrs to fix

      Interaction has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class Interaction<T extends ActionName = ActionName> {
        // current interactable being interacted with
        interactable: Interactable = null
      
        // the target element of the interactable
      Severity: Minor
      Found in @interactjs/core/Interaction.ts - About 2 hrs to fix

        Function doOnInteractions has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function doOnInteractions (method, scope) {
          return function (event) {
            const interactions = scope.interactions.list
        
            const pointerType = pointerUtils.getPointerType(event)
        Severity: Major
        Found in @interactjs/core/interactions.ts - About 2 hrs to fix

          Function install has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          function install (scope: Interact.Scope) {
            const listeners = {} as any
          
            for (const method of methodNames) {
              listeners[method] = doOnInteractions(method, scope)
          Severity: Minor
          Found in @interactjs/core/interactions.ts - About 2 hrs 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 init has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function init (window: any) {
            const Element = domObjects.Element
            const navigator  = win.window.navigator
          
            // Does the browser support touch input?
          Severity: Minor
          Found in @interactjs/utils/browser.ts - About 2 hrs 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 withinInteractionLimit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function withinInteractionLimit<T extends Interact.ActionName> (
            interactable: Interact.Interactable,
            element: Interact.Element,
            action: Interact.ActionProps<T>,
            scope: Interact.Scope,
          Severity: Minor
          Found in @interactjs/auto-start/base.ts - About 2 hrs 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 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor (
              interaction: Interaction,
              event: Interact.PointerEventType,
              actionName: T,
              phase: P,
          Severity: Major
          Found in @interactjs/core/InteractEvent.ts - About 2 hrs to fix

            Function _generate has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function _generate (changedSources) {
                for (const sourceFilename of changedSources) {
                  queue.add(async () => {
                    const shimResult = shim && await shim(sourceFilename)
                    const moduleName = getModuleName(sourceFilename)
            Severity: Major
            Found in scripts/esnext.js - About 2 hrs to fix

              Interactable has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class Interactable implements Partial<Eventable> {
                /** @internal */ get _defaults (): Defaults {
                  return {
                    base: {},
                    perAction: {},
              Severity: Minor
              Found in @interactjs/core/Interactable.ts - About 2 hrs to fix

                Function reflow has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                function reflow<T extends Interact.ActionName> (interactable: Interactable, action: ActionProps<T>, scope: Scope): Promise<Interactable> {
                  const elements = (is.string(interactable.target)
                    ? arr.from(interactable._context.querySelectorAll(interactable.target))
                    : [interactable.target]) as Interact.Element[]
                
                
                Severity: Minor
                Found in @interactjs/reflow/plugin.ts - About 2 hrs 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 mouseOrPen has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  mouseOrPen ({ pointerId, pointerType, eventType, scope }: SearchDetails) {
                    if (pointerType !== 'mouse' && pointerType !== 'pen') {
                      return null
                    }
                
                
                Severity: Minor
                Found in @interactjs/core/interactionFinder.ts - About 2 hrs 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 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function fire<T extends string> (
                  arg: {
                    pointer: Interact.PointerType | PointerEvent<any>
                    event: Interact.PointerEventType | PointerEvent<any>
                    eventTarget: Interact.EventTarget
                Severity: Major
                Found in @interactjs/pointer-events/base.ts - About 2 hrs to fix

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

                    start (event: Interact.PointerEventType) {
                      const { interaction } = this
                      const options = getOptions(interaction)
                  
                      if (!options || !options.enabled) {
                  Severity: Minor
                  Found in @interactjs/inertia/plugin.ts - About 2 hrs to fix

                    Function resizeChecker has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function resizeChecker (arg) {
                      const { interaction, interactable, element, rect, buttons } = arg
                    
                      if (!rect) { return undefined }
                    
                    
                    Severity: Minor
                    Found in @interactjs/actions/resize/plugin.ts - About 1 hr to fix

                      Function transformImportsToRelative has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function transformImportsToRelative () {
                        const resolve = require('resolve')
                      
                        const fixImportSource = ({ node: { source } }, { opts, filename }) => {
                          if (!source || (opts.ignore && opts.ignore(filename))) { return }
                      Severity: Minor
                      Found in scripts/utils.js - 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 unset has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        unset () {
                          if (is.string(this.target)) {
                            // remove delegated events
                            for (const type in this._scopeEvents.delegatedEvents) {
                              const delegated = this._scopeEvents.delegatedEvents[type]
                      Severity: Minor
                      Found in @interactjs/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 on has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        on (type: string | Interact.EventTypes, listener: Interact.ListenersArg, options?: object) {
                          if (is.string(type) && type.search(' ') !== -1) {
                            type = type.trim().split(/ +/)
                          }
                      
                      
                      Severity: Minor
                      Found in @interactjs/core/InteractStatic.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 normalize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function normalize (
                        type: Interact.EventTypes,
                        listeners?: Interact.ListenersArg | Interact.ListenersArg[],
                        result?: NormalizedListeners,
                      ): NormalizedListeners {
                      Severity: Minor
                      Found in @interactjs/utils/normalizeListeners.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 updatePointer has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        updatePointer (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, down?: boolean) {
                          const id = pointerUtils.getPointerId(pointer)
                          let pointerIndex = this.getPointerIndex(pointer)
                          let pointerInfo = this.pointers[pointerIndex]
                      
                      
                      Severity: Minor
                      Found in @interactjs/core/Interaction.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language