taye/interact.js

View on GitHub
packages/modifiers/snap/pointer.ts

Summary

Maintainability
B
6 hrs
Test Coverage
A
96%

Function set has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Wontfix

function set (arg: Interact.SignalArg) {
  const { interaction, coords, state } = arg
  const { options, offsets } = state

  const origin = utils.getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name)
Severity: Minor
Found in packages/modifiers/snap/pointer.ts - About 5 hrs 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 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function set (arg: Interact.SignalArg) {
  const { interaction, coords, state } = arg
  const { options, offsets } = state

  const origin = utils.getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name)
Severity: Major
Found in packages/modifiers/snap/pointer.ts - About 2 hrs to fix

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

    function start (arg: Interact.SignalArg) {
      const { interaction, interactable, element, rect, state, startOffset } = arg
      const { options } = state
      const offsets = []
      const origin = options.offsetWithOrigin
    Severity: Minor
    Found in packages/modifiers/snap/pointer.ts - About 1 hr to fix

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

      function start (arg: Interact.SignalArg) {
        const { interaction, interactable, element, rect, state, startOffset } = arg
        const { options } = state
        const offsets = []
        const origin = options.offsetWithOrigin
      Severity: Minor
      Found in packages/modifiers/snap/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

      Consider simplifying this complex logical expression.
      Open

          if (!closest.target || (inRange
            // is the closest target in range?
            ? (closest.inRange && range !== Infinity
              // the pointer is relatively deeper in this target
              ? distance / range < closest.distance / closest.range
      Severity: Major
      Found in packages/modifiers/snap/pointer.ts - About 40 mins to fix

        There are no issues that match your filters.

        Category
        Status