taye/interact.js

View on GitHub

Showing 163 of 163 total issues

Function doReflow has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function doReflow<T extends ActionName>(
  interactable: Interactable,
  action: ActionProps<T>,
  scope: Scope,
): Promise<Interactable> {
Severity: Minor
Found in packages/@interactjs/reflow/plugin.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

Function remove has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function remove(
    eventTarget: PartialEventTarget,
    type: string,
    listener?: 'all' | ListenerEntry['func'],
    optionalArg?: boolean | EventOptions,
Severity: Minor
Found in packages/@interactjs/core/events.ts - About 1 hr to fix

    Function checkResizeEdge has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function checkResizeEdge(
      name: string,
      value: any,
      page: Point,
      element: Node,
    Severity: Minor
    Found in packages/@interactjs/actions/resize/plugin.ts - About 1 hr to fix

      Function getDropEvents has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getDropEvents(interaction: Interaction, _pointerEvent, dragEvent: DragEvent) {
        const dropState = interaction.dropState!
        const dropEvents: Record<string, DropEvent | null> = {
          enter: null,
          leave: null,
      Severity: Minor
      Found in packages/@interactjs/actions/drop/plugin.ts - About 1 hr to fix

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

          start(event: PointerEventType) {
            const { interaction } = this
            const options = getOptions(interaction)
        
            if (!options || !options.enabled) {
        Severity: Minor
        Found in packages/@interactjs/inertia/plugin.ts - About 1 hr to fix

          Function setPerAction has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            setPerAction(actionName: ActionName, options: OrBoolean<Options>) {
              const defaults = this._defaults
          
              // for all the default per-action options
              for (const optionName_ in options) {
          Severity: Minor
          Found in packages/@interactjs/core/Interactable.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

          Function transformInlineEnvironmentVariables has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function transformInlineEnvironmentVariables({ types: t }) {
            return {
              name: '@interactjs/_dev:inline-env-vars',
              visitor: {
                // eslint-disable-next-line no-shadow
          Severity: Minor
          Found in scripts/babel/inline-env-vars.js - 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

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

          function install(scope: Scope, { logger }: { logger?: Logger } = {}) {
            const { Interactable, defaults } = scope
          
            scope.logger = logger || console
          
          
          Severity: Minor
          Found in packages/@interactjs/dev-tools/plugin.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

          Function scroll has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            scroll() {
              const { interaction } = autoScroll
              const { interactable, element } = interaction
              const actionName = interaction.prepared.name
              const options = interactable.options[actionName].autoScroll
          Severity: Minor
          Found in packages/@interactjs/auto-scroll/plugin.ts - About 1 hr to fix

            Function init has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function init(window: any) {
              const Element = domObjects.Element
              const navigator: Partial<Navigator> = window.navigator || {}
            
              // Does the browser support touch input?
            Severity: Minor
            Found in packages/@interactjs/utils/browser.ts - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                if (rect && !('x' in rect && 'y' in rect)) {
                  rect = extend({}, rect)
              
                  rect.x = rect.left || 0
                  rect.y = rect.top || 0
              Severity: Critical
              Found in packages/@interactjs/utils/rect.ts - About 1 hr to fix

                Function pointerMove has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  pointerMove(pointer: PointerType, event: PointerEventType, eventTarget: Node) {
                    if (!this.simulation && !(this.modification && this.modification.endResult)) {
                      this.updatePointer(pointer, event, eventTarget, false)
                    }
                
                
                Severity: Minor
                Found in packages/@interactjs/core/Interaction.ts - About 1 hr to fix

                  Function doReflow has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function doReflow<T extends ActionName>(
                    interactable: Interactable,
                    action: ActionProps<T>,
                    scope: Scope,
                  ): Promise<Interactable> {
                  Severity: Minor
                  Found in packages/@interactjs/reflow/plugin.ts - About 1 hr to fix

                    Function coordsToEvent has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function coordsToEvent(coords: MockCoords) {
                      const event = {
                        coords,
                        get page() {
                          return this.coords.page
                    Severity: Minor
                    Found in packages/@interactjs/utils/pointerUtils.ts - About 1 hr to fix

                      Function updatePointer has 40 lines of code (exceeds 25 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 1 hr to fix

                        Function scroll has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                          scroll() {
                            const { interaction } = autoScroll
                            const { interactable, element } = interaction
                            const actionName = interaction.prepared.name
                            const options = interactable.options[actionName].autoScroll
                        Severity: Minor
                        Found in packages/@interactjs/auto-scroll/plugin.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

                        Function usePlugin has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                          usePlugin(plugin: Plugin, options?: { [key: string]: any }) {
                            if (!this.isInitialized) {
                              return this
                            }
                        
                        
                        Severity: Minor
                        Found in packages/@interactjs/core/scope.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

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

                          setAll(arg: MethodArg & Partial<ModifierArg>): ModificationResult {
                            const { phase, preEnd, skipModifiers, rect: unmodifiedRect, edges: unmodifiedEdges } = arg
                        
                            arg.coords = extend({}, arg.pageCoords)
                            arg.rect = extend({}, unmodifiedRect)
                        Severity: Minor
                        Found in packages/@interactjs/modifiers/Modification.ts - About 1 hr to fix

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

                            start(arg) {
                              const { state, rect, edges, pageCoords: coords } = arg
                              let { ratio, enabled } = state.options
                              const { equalDelta, modifiers } = state.options
                          
                          
                          Severity: Minor
                          Found in packages/@interactjs/modifiers/aspectRatio.ts - About 1 hr to fix

                            Function onInteractionMove has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              onInteractionMove<T extends ActionName>({
                                interaction,
                                pointer,
                              }: {
                                interaction: Interaction<T>
                            Severity: Minor
                            Found in packages/@interactjs/auto-scroll/plugin.ts - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language