dekk-app/react-mops

View on GitHub

Showing 12 of 3,908 total issues

Function toSiblings has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

export const toSiblings = (siblings: Mops.Sibling[]): Mops.SnapHandler => (
    {position, size, rotation},
    {addGuides, removeGuides, updateGuide, guides},
    model = position
) => {
Severity: Minor
Found in packages/react-mops/src/guides/snapping.ts - About 6 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

File box.tsx has 307 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from "react";
import {BoundingBox, Content, Handle, Handles, PropProvider, Wrapper} from "./elements";
import {
    listenRR,
    useCursorSlice,
Severity: Minor
Found in packages/react-mops/src/box.tsx - About 3 hrs to fix

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

    export const useMouseMove = (
        onMouseUp: Mops.MouseHandler,
        onMouseMove: Mops.MouseHandler,
        scale: number,
        rotation?: Mops.RotationModel
    Severity: Major
    Found in packages/react-mops/src/hooks/mouse-event-hooks.ts - About 2 hrs to fix

      Function useMouseMoveEvent has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useMouseMoveEvent = (
          onMouseUp: (event: MouseEvent) => void,
          onMouseMove: (event: MouseEvent) => void,
          onMouseDown: (event: React.MouseEvent<HTMLElement>) => void
      ) => {
      Severity: Major
      Found in packages/react-mops/src/hooks/mouse-event-hooks.ts - About 2 hrs to fix

        Function Guides has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        > = React.forwardRef(({...props}, ref: React.Ref<HTMLDivElement>) => {
            const sizeRef = React.useRef<HTMLDivElement>();
        
            const [height, setHeight] = React.useState(0);
            const [width, setWidth] = React.useState(0);
        Severity: Major
        Found in packages/react-mops/src/guides/guides.tsx - About 2 hrs to fix

          Function useHandlesDown has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          export const useHandlesDown = ({
              currentRotation,
              initialPosition,
              initialSize,
              // limitLeft,
          Severity: Minor
          Found in packages/react-mops/src/hooks/with-handle-hooks.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

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

          export const useMeta = () => {
              const [metaKey, setMetaKey] = React.useState(false);
              const key = isOSX() ? "Meta" : "Control";
              const handleKeyDown = React.useCallback(
                  (e: KeyboardEvent) => {
          Severity: Minor
          Found in packages/react-mops/src/hooks/use-hooks.ts - About 1 hr to fix

            Function GuidesProvider has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            }> = ({children, guideRequests, containerSize}) => {
                const [guides, setGuides] = React.useState<Mops.Guide[]>([]);
                const addGuides = guideModels => {
                    setGuides(state => {
                        const newGuides = guideModels.filter(
            Severity: Minor
            Found in packages/react-mops/src/guides/guides.tsx - 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 useMouseMove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export const useMouseMove = (
                onMouseUp: Mops.MouseHandler,
                onMouseMove: Mops.MouseHandler,
                scale: number,
                rotation?: Mops.RotationModel
            Severity: Minor
            Found in packages/react-mops/src/hooks/mouse-event-hooks.ts - About 55 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 getOS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            const getOS = () => {
                if ("navigator" in global) {
                    if (navigator.appVersion.indexOf("Win") !== -1) {
                        return WINDOWS;
                    }
            Severity: Minor
            Found in packages/react-mops/src/hooks/use-hooks.ts - About 55 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 useMouseMoveEvent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export const useMouseMoveEvent = (
                onMouseUp: (event: MouseEvent) => void,
                onMouseMove: (event: MouseEvent) => void,
                onMouseDown: (event: React.MouseEvent<HTMLElement>) => void
            ) => {
            Severity: Minor
            Found in packages/react-mops/src/hooks/mouse-event-hooks.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

            Avoid too many return statements within this function.
            Open

                return NODE;
            Severity: Major
            Found in packages/react-mops/src/hooks/use-hooks.ts - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language