taye/interact.js

View on GitHub
packages/core/interactions.ts

Summary

Maintainability
C
1 day
Test Coverage
A
92%

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

function install (scope: Scope) {
  const signals = new Signals()

  const listeners = {} as any

Severity: Major
Found in packages/core/interactions.ts - About 3 hrs to fix

    Function doOnInteractions has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function doOnInteractions (method, scope) {
      return function (event) {
        const interactions = scope.interactions.list
    
        const pointerType = pointerUtils.getPointerType(event)
    Severity: Major
    Found in packages/core/interactions.ts - About 2 hrs to fix

      Function install has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function install (scope: Scope) {
        const signals = new Signals()
      
        const listeners = {} as any
      
      
      Severity: Minor
      Found in packages/core/interactions.ts - About 2 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

      Consider simplifying this complex logical expression.
      Open

            if (!browser.supportsPointerEvent && /mouse/.test(event.type)) {
              // ignore mouse events while touch interactions are active
              for (let i = 0; i < interactions.length && !invalidPointer; i++) {
                invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown
              }
      Severity: Major
      Found in packages/core/interactions.ts - About 40 mins to fix

        There are no issues that match your filters.

        Category
        Status