packages/sdk/src/components/grid/InteractionLayer.tsx
Function InteractionLayerBase
has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring. Open
Open
> = (props, ref) => {
const {
theme,
width,
height,
- 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 InteractionLayerBase
has 649 lines of code (exceeds 300 allowed). Consider refactoring. Open
Open
> = (props, ref) => {
const {
theme,
width,
height,
File InteractionLayer.tsx
has 740 lines of code (exceeds 300 allowed). Consider refactoring. Open
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';
Avoid too many return
statements within this function. Open
Open
return setCursor('pointer');
Avoid too many return
statements within this function. Open
Open
return setCursor('grabbing');
Avoid too many return
statements within this function. Open
Open
return onCollapsedGroupChanged?.(newCollapsedGroupIds);
Avoid too many return
statements within this function. Open
Open
if (linearRow.type !== LinearRowType.Group) return;
Avoid too many return
statements within this function. Open
Open
return onCollapsedGroupChanged?.(new Set([id]));
Avoid too many return
statements within this function. Open
Open
return setCursor('not-allowed');
Avoid too many return
statements within this function. Open
Open
return setCursor('not-allowed');
Avoid too many return
statements within this function. Open
Open
return onCollapsedGroupChanged?.(new Set([...collapsedGroupIds, id]));
Avoid too many return
statements within this function. Open
Open
return;
Avoid too many return
statements within this function. Open
Open
return setCursor('pointer');