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
) => {
- Read upRead up
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,
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
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
) => {
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);
Function useHandlesDown
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const useHandlesDown = ({
currentRotation,
initialPosition,
initialSize,
// limitLeft,
- Read upRead up
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) => {
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(
- Read upRead up
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
- Read upRead up
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;
}
- Read upRead up
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
) => {
- Read upRead up
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;