taye/interact.js

View on GitHub
packages/modifiers/base.ts

Summary

Maintainability
C
1 day
Test Coverage
A
97%

File base.ts has 398 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Scope } from '@interactjs/core/scope'
import extend from '@interactjs/utils/extend'

declare module '@interactjs/core/scope' {
  interface Scope {
Severity: Minor
Found in packages/modifiers/base.ts - About 5 hrs to fix

    Function setAll has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function setAll (arg: Partial<Interact.SignalArg>) {
      const {
        interaction,
        modifiersState = interaction.modifiers,
        prevCoords = modifiersState.result
    Severity: Major
    Found in packages/modifiers/base.ts - About 2 hrs to fix

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

      function install (scope: Scope) {
        const {
          interactions,
        } = scope
      
      
      Severity: Minor
      Found in packages/modifiers/base.ts - About 1 hr to fix

        Function beforeEnd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function beforeEnd (arg: Interact.SignalArg): void | false {
          const { interaction, event, noPreEnd } = arg
          const states = interaction.modifiers.states
        
          if (noPreEnd || !states || !states.length) {
        Severity: Minor
        Found in packages/modifiers/base.ts - About 45 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 setAll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function setAll (arg: Partial<Interact.SignalArg>) {
          const {
            interaction,
            modifiersState = interaction.modifiers,
            prevCoords = modifiersState.result
        Severity: Minor
        Found in packages/modifiers/base.ts - About 45 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 makeModifier has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function makeModifier<
          Defaults extends { enabled?: boolean },
          Name extends string
        > (
          module: { defaults?: Defaults, [key: string]: any },
        Severity: Minor
        Found in packages/modifiers/base.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 shouldDo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function shouldDo (options, preEnd?: boolean, requireEndOnly?: boolean, phase?: string) {
          return options
            ? options.enabled !== false &&
              (preEnd || !options.endOnly) &&
              (!requireEndOnly || options.endOnly || options.alwaysOnEnd) &&
        Severity: Minor
        Found in packages/modifiers/base.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

        There are no issues that match your filters.

        Category
        Status