taye/interact.js

View on GitHub

Showing 163 of 163 total issues

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 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 clone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function clone<T extends Object>(source: T): Partial<T> {
  const dest = {} as Partial<T>

  for (const prop in source) {
    const value = source[prop]
Severity: Minor
Found in packages/@interactjs/utils/clone.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