taye/interact.js

View on GitHub

Showing 163 of 163 total issues

Function new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  new(target: Target, options?: any): Interactable {
    options = extend(options || {}, {
      actions: this.scope.actions,
    })
    const interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events)
Severity: Minor
Found in packages/@interactjs/core/InteractableSet.ts - About 35 mins 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 shallowEqual has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function shallowEqual(left: any, right: any) {
  if (left === right) {
    return true
  }

Severity: Minor
Found in packages/@interactjs/utils/shallowEqual.ts - About 35 mins 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 getCursor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  getCursor({ edges, axis, name }: ActionProps) {
    const cursors = resize.cursors
    let result: string = null

    if (axis) {
Severity: Minor
Found in packages/@interactjs/actions/resize/plugin.ts - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

  set(options: OptionsArg) {
    const defaults = this._defaults

    if (!is.object(options)) {
      options = {}
Severity: Minor
Found in packages/@interactjs/core/Interactable.ts - About 35 mins 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

Avoid too many return statements within this function.
Open

    return false
Severity: Major
Found in packages/@interactjs/core/Interactable.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return autoStartMax > 0
    Severity: Major
    Found in packages/@interactjs/auto-start/base.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return page.y > (height >= 0 ? rect.bottom : rect.top) - margin
      Severity: Major
      Found in packages/@interactjs/actions/resize/plugin.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return
        Severity: Major
        Found in packages/@interactjs/core/interactablePreventDefault.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return null
          Severity: Major
          Found in packages/@interactjs/core/interactionFinder.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return is.element(value)
                ? // the value is an element to use as a resize handle
                  value === element
                : // otherwise check if element matches value as selector
                  dom.matchesUpTo(element, value, interactableElement)
            Severity: Major
            Found in packages/@interactjs/actions/resize/plugin.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return true
              Severity: Major
              Found in packages/@interactjs/utils/shallowEqual.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return false
                Severity: Major
                Found in packages/@interactjs/actions/resize/plugin.ts - About 30 mins to fix

                  Function init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function init(global: Window | typeof globalThis) {
                    request = global.requestAnimationFrame
                    cancel = global.cancelAnimationFrame
                  
                    if (!request) {
                  Severity: Minor
                  Found in packages/@interactjs/utils/raf.ts - About 25 mins 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 draggable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const draggable: Interactable['draggable'] = function draggable(
                    this: Interactable,
                    options?: DraggableOptions | boolean,
                  ): any {
                    if (is.object(options)) {
                  Severity: Minor
                  Found in packages/@interactjs/actions/drag/plugin.ts - About 25 mins 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 interactions:action-start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          'interactions:action-start': ({ interaction }, scope) => {
                            for (const check of checks) {
                              const options = interaction.interactable && interaction.interactable.options
                  
                              if (
                  Severity: Minor
                  Found in packages/@interactjs/dev-tools/plugin.ts - About 25 mins 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 6 (exceeds 5 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 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    start<A extends ActionName>(action: ActionProps<A>, interactable: Interactable, element: Element): boolean {
                      if (
                        this.interacting() ||
                        !this.pointerIsDown ||
                        this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||
                  Severity: Minor
                  Found in packages/@interactjs/core/Interaction.ts - About 25 mins 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    updatePointer(pointer: PointerType, event: 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 25 mins 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 shouldDo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    shouldDo(options, preEnd?: boolean, phase?: string, requireEndOnly?: boolean) {
                      if (
                        // ignore disabled modifiers
                        !options ||
                        options.enabled === false ||
                  Severity: Minor
                  Found in packages/@interactjs/modifiers/Modification.ts - About 25 mins 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 reject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    reject() {
                      const { dropState } = this._interaction
                  
                      if (
                        this.type !== 'dropactivate' &&
                  Severity: Minor
                  Found in packages/@interactjs/actions/drop/DropEvent.ts - About 25 mins 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