taye/interact.js

View on GitHub

Showing 163 of 163 total issues

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

  inertiaTick() {
    const { interaction } = this
    const options = getOptions(interaction)
    const lambda = options.resistance
    const t = (interaction._now() - this.t0) / 1000
Severity: Minor
Found in packages/@interactjs/inertia/plugin.ts - About 1 hr to fix

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

    function move({ iEvent, interaction }: { iEvent: 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 packages/@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

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

      onInteractionMove<T extends ActionName>({
        interaction,
        pointer,
      }: {
        interaction: Interaction<T>
    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 constructor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

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

    function fire<T extends string>(
      arg: {
        pointer: PointerType | PointerEvent<any>
        event: PointerEventType | PointerEvent<any>
        eventTarget: Node
    Severity: Minor
    Found in packages/@interactjs/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/@interactjs/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 makeModifier has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function makeModifier<
      Defaults extends { enabled?: boolean },
      State extends ModifierState,
      Name extends string,
      Result,
    Severity: Minor
    Found in packages/@interactjs/modifiers/base.ts - About 1 hr to fix

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

      function install(scope: Scope) {
        const { actions, interactStatic: interact, Interactable, defaults } = scope
      
        scope.usePlugin(drag)
      
      
      Severity: Minor
      Found in packages/@interactjs/actions/drop/plugin.ts - About 1 hr to fix

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

        function withinInteractionLimit<T extends ActionName>(
          interactable: Interactable,
          element: Element,
          action: ActionProps<T>,
          scope: Scope,
        Severity: Minor
        Found in packages/@interactjs/auto-start/base.ts - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

              if (
                // ignore disabled modifiers
                !options ||
                options.enabled === false ||
                // check if we require endOnly option to fire move before end
          Severity: Critical
          Found in packages/@interactjs/modifiers/Modification.ts - About 1 hr to fix

            Function _onOff has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _onOff(
                method: OnOffMethod,
                typeArg: EventTypes,
                listenerArg?: ListenersArg | null,
                options?: any,
            Severity: Minor
            Found in packages/@interactjs/core/Interactable.ts - About 1 hr to fix

              Function start has 32 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 origin = options.offsetWithOrigin ? getOrigin(arg) : { x: 0, y: 0 }
              
              
              Severity: Minor
              Found in packages/@interactjs/modifiers/snap/pointer.ts - About 1 hr to fix

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

                module.exports = function transformImportsToRelative() {
                  const fixImportSource = ({ node: { source } }, { opts, filename }) => {
                    if (!source || (opts.ignore && opts.ignore(filename))) return
                
                    const { moduleDirectory = getModuleDirectories() } = opts
                Severity: Minor
                Found in scripts/babel/relative-imports.js - About 1 hr to fix

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

                  function startReflow<T extends ActionName>(
                    scope: Scope,
                    interactable: Interactable,
                    element: Element,
                    action: ActionProps<T>,
                  Severity: Minor
                  Found in packages/@interactjs/reflow/plugin.ts - About 1 hr to fix

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

                      Function start has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function start({ rect, startOffset, state, interaction, pageCoords }: ModifierArg<RestrictState>) {
                        const { options } = state
                        const { elementRect } = options
                        const offset: Rect = extend(
                          {
                      Severity: Minor
                      Found in packages/@interactjs/modifiers/restrict/pointer.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 checkAndPreventDefault has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function checkAndPreventDefault(interactable: Interactable, scope: Scope, event: Event) {
                        const setting = interactable.options.preventDefault
                      
                        if (setting === 'never') return
                      
                      
                      Severity: Minor
                      Found in packages/@interactjs/core/interactablePreventDefault.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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function getDropEvents(interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {
                        const dropState = interaction.dropState!
                        const dropEvents: Record<string, DropEvent | null> = {
                          enter: null,
                          leave: null,
                      Severity: Minor
                      Found in packages/@interactjs/actions/drop/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 set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function set(arg) {
                        const { interaction, state, coords } = arg
                        const { options, offsets } = state
                        const relative = {
                          x: coords.x - offsets[0].x,
                      Severity: Minor
                      Found in packages/@interactjs/modifiers/snap/size.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 getEsnextBabelOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function getEsnextBabelOptions(presetEnvOptions) {
                        return {
                          babelrc: false,
                          configFile: false,
                          sourceMaps: true,
                      Severity: Minor
                      Found in scripts/utils.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language