taye/interact.js

View on GitHub

Showing 156 of 156 total issues

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

function fire<T extends string> (
  arg: {
    pointer: Interact.PointerType | PointerEvent<any>
    event: Interact.PointerEventType | PointerEvent<any>
    eventTarget: Interact.EventTarget
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 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 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 inertiaTick has 35 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 _ForOfStatementArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function _ForOfStatementArray(path) {
        const { node, scope } = path
        const nodes = []
        let right = node.right
    
    
    Severity: Minor
    Found in scripts/babelTransformForOfArray.js - About 1 hr to fix

      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
      > (
      Severity: Minor
      Found in packages/@interactjs/modifiers/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
              (requireEndOnly && !options.endOnly) ||
        Severity: Critical
        Found in packages/@interactjs/modifiers/Modification.ts - About 1 hr to fix

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

          function startReflow<T extends Interact.ActionName> (scope: Scope, interactable: Interactable, element: Interact.Element, action: ActionProps<T>, event: any) {
            const interaction = scope.interactions.new({ pointerType: 'reflow' })
            const signalArg = {
              interaction,
              event,
          Severity: Minor
          Found in packages/@interactjs/reflow/plugin.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/@interactjs/actions/drop/plugin.ts - About 1 hr to fix

              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 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: Interact.Rect = extend({
                  left: 0,
              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 onInteractionMove has a Cognitive Complexity of 11 (exceeds 5 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

              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: Interact.Interactable, scope: Interact.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: 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

              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 transformImportsToAbsolute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function transformImportsToAbsolute () {
                const resolve = require('resolve')
              
                const fixImportSource = ({ node: { source } }, { opts, filename }) => {
                  if (!source || (opts.ignore && opts.ignore(filename, source.value))) { return }
              Severity: Minor
              Found in scripts/utils.js - About 1 hr to fix

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

                  start (arg) {
                    const { state, rect, edges: originalEdges, pageCoords: coords } = arg
                    let { ratio } = state.options
                    const { equalDelta, modifiers } = state.options
                
                
                Severity: Minor
                Found in packages/@interactjs/modifiers/aspectRatio.ts - About 1 hr to fix

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

                  function install (scope: Scope) {
                    const {
                      actions,
                      /** @lends module:interact */
                      interactStatic: interact,
                  Severity: Minor
                  Found in packages/@interactjs/actions/drop/plugin.ts - About 1 hr to fix

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

                      Function start has 30 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)
                      Severity: Minor
                      Found in packages/@interactjs/modifiers/snap/pointer.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language