taye/interact.js

View on GitHub

Showing 156 of 156 total issues

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 packages/@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 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 packages/@interactjs/actions/drop/plugin.ts - About 1 hr to fix

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

      updatePointer (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Node, down?: boolean) {
        const id = pointerUtils.getPointerId(pointer)
        let pointerIndex = this.getPointerIndex(pointer)
        let pointerInfo = this.pointers[pointerIndex]
    
    
    Severity: Minor
    Found in packages/@interactjs/core/Interaction.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 packages/@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 packages/@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 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 packages/@interactjs/actions/drop/plugin.ts - About 1 hr to fix

          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 packages/@interactjs/modifiers/Modification.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 packages/@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 packages/@interactjs/utils/browser.ts - 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 packages/@interactjs/core/events.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 packages/@interactjs/reflow/plugin.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: Node) {
                        if (!this.simulation && !(this.modification && this.modification.endResult)) {
                          this.updatePointer(pointer, event, eventTarget, false)
                        }
                    
                    
                    Severity: Minor
                    Found in packages/@interactjs/core/Interaction.ts - About 1 hr to fix

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

                        usePlugin (plugin: Plugin, options?: { [key: string]: any }) {
                          if (!this.isInitialized) {
                            return this
                          }
                      
                      
                      Severity: Minor
                      Found in packages/@interactjs/core/scope.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 transformImportsToRelative has 39 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 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 packages/@interactjs/auto-scroll/plugin.ts - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language