teableio/teable

View on GitHub
packages/sdk/src/components/grid/InteractionLayer.tsx

Summary

Maintainability
F
6 days
Test Coverage

Function InteractionLayerBase has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring.
Open

> = (props, ref) => {
  const {
    theme,
    width,
    height,
Severity: Minor
Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 2 days 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 InteractionLayerBase has 649 lines of code (exceeds 300 allowed). Consider refactoring.
Open

> = (props, ref) => {
  const {
    theme,
    width,
    height,
Severity: Major
Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 1 day to fix

    File InteractionLayer.tsx has 740 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    /* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
    import { isEqual } from 'lodash';
    import type { Dispatch, ForwardRefRenderFunction, SetStateAction } from 'react';
    import { useState, useRef, forwardRef, useImperativeHandle, useMemo, useLayoutEffect } from 'react';
    import { useClickAway, useMouse } from 'react-use';
    Severity: Major
    Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 1 day to fix

      Avoid too many return statements within this function.
      Open

              return setCursor('pointer');
      Severity: Major
      Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return setCursor('grabbing');
        Severity: Major
        Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return onCollapsedGroupChanged?.(newCollapsedGroupIds);
          Severity: Major
          Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    if (linearRow.type !== LinearRowType.Group) return;
            Severity: Major
            Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        return onCollapsedGroupChanged?.(new Set([id]));
              Severity: Major
              Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return setCursor('not-allowed');
                Severity: Major
                Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return setCursor('not-allowed');
                  Severity: Major
                  Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return onCollapsedGroupChanged?.(new Set([...collapsedGroupIds, id]));
                    Severity: Major
                    Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return;
                      Severity: Major
                      Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return setCursor('pointer');
                        Severity: Major
                        Found in packages/sdk/src/components/grid/InteractionLayer.tsx - About 30 mins to fix

                          There are no issues that match your filters.

                          Category
                          Status