taye/interact.js

View on GitHub

Showing 154 of 154 total issues

Function getDropEvents has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getDropEvents (interaction: Interact.Interaction, _pointerEvent, dragEvent) {
  const { dropState } = interaction
  const dropEvents = {
    enter     : null,
    leave     : null,
Severity: Minor
Found in @interactjs/actions/drop/plugin.ts - About 1 hr to fix

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

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

      Function setPerAction has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        setPerAction (actionName: Interact.ActionName, options: Interact.OrBoolean<Options>) {
          const defaults = this._defaults
      
          // for all the default per-action options
          for (const optionName_ in options) {
      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 setAll has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        setAll (arg: MethodArg & Partial<ModifierArg>): ModificationResult {
          this.fillArg(arg)
      
          const {
            phase,
      Severity: Minor
      Found in @interactjs/modifiers/Modification.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 (is.object(options)) {
            interactable.options.drop.enabled = options.enabled !== false
        
            if (options.listeners) {
        Severity: Minor
        Found in @interactjs/actions/drop/plugin.ts - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

            if (rect && !('x' in rect && 'y' in rect)) {
              rect = extend({}, rect)
          
              rect.x      = rect.left || 0
              rect.y      = rect.top  || 0
          Severity: Critical
          Found in @interactjs/utils/rect.ts - About 1 hr to fix

            Function init has 41 lines of code (exceeds 25 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 1 hr to fix

              Function transformImportsToRelative has 41 lines of code (exceeds 25 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

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

                  function remove (eventTarget: EventTarget, type: string, listener?: 'all' | Listener, optionalArg?: boolean | any) {
                    const options = getOptions(optionalArg)
                    const targetIndex = arr.findIndex(targets, t => t.eventTarget === eventTarget)
                    const target = targets[targetIndex]
                
                
                Severity: Minor
                Found in @interactjs/core/events.ts - About 1 hr to fix

                  Function pointerMove has 40 lines of code (exceeds 25 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 @interactjs/core/Interaction.ts - About 1 hr to fix

                    Function reflow has 40 lines of code (exceeds 25 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 1 hr to fix

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

                        off (type: Interact.EventTypes, listener: any, 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 scroll has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        scroll () {
                          const { interaction } = autoScroll
                          const { interactable, element } = interaction
                          const actionName = interaction.prepared.name
                          const options = interactable.options[actionName].autoScroll
                      Severity: Minor
                      Found in @interactjs/auto-scroll/plugin.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 _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 @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 transformInlineEnvironmentVariables has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function transformInlineEnvironmentVariables ({ types: t }) {
                        return {
                          visitor: {
                            // eslint-disable-next-line no-shadow
                            MemberExpression (path, { opts: { include, exclude, env } = {} }) {
                      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 pushComputedPropsLoose has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function pushComputedPropsLoose(path, file) {
                          const { node, scope, parent } = path
                          const { left } = node
                          let declar, id, intermediate
                      
                      
                      Severity: Minor
                      Found in scripts/babelTransformForOfArray.js - About 1 hr to fix

                        Function combine has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function combine (options) {
                          const headerContent = options.content || ''
                          const { destDir, filename } = options
                          const combiner = combineSourceMap.create()
                          const combinedCode = headerContent + options.code
                        Severity: Minor
                        Found in scripts/bundleHeader.js - About 1 hr to fix

                          Function onInteractionMove has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            onInteractionMove<T extends Interact.ActionName> ({ interaction, pointer }: { interaction: Interact.Interaction<T>, pointer: Interact.PointerType }) {
                              if (!(interaction.interacting() &&
                                    autoScroll.check(interaction.interactable, interaction.prepared.name))) {
                                return
                              }
                          Severity: Minor
                          Found in @interactjs/auto-scroll/plugin.ts - About 1 hr to fix

                            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 @interactjs/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 move has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function move ({ iEvent, interaction }: { iEvent: Interact.InteractEvent<any, any>, interaction: Interaction }) {
                              if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }
                            
                              const resizeEvent = iEvent as ResizeEvent
                              const resizeOptions = interaction.interactable.options.resize
                            Severity: Minor
                            Found in @interactjs/actions/resize/plugin.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

                            Severity
                            Category
                            Status
                            Source
                            Language