File region.ts
has 393 lines of code (exceeds 300 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/naming-convention */
import { GRID_DEFAULT } from '../configs';
import { LinearRowType, RegionType, RowControlType } from '../interface';
import type {
IActiveCellBound,
Function checkIsColumnHeader
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const checkIsColumnHeader = (props: ICheckRegionProps): IRegionData | null => {
const {
position,
scrollState,
coordInstance,
- 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 getColumnStatisticData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const getColumnStatisticData = (
props: Pick<
IRenderLayerProps,
'height' | 'scrollState' | 'coordInstance' | 'columnStatistics' | 'getLinearRow'
> & {
- 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 checkIsRowHeader
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const checkIsRowHeader = (props: ICheckRegionProps): IRegionData | null => {
const { position, theme, rowControls, scrollState, coordInstance } = props;
const { x, y, rowIndex, columnIndex } = position;
if (rowIndex <= -1 || columnIndex !== -1) return null;
- 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 { ...BLANK_REGION_DATA, type: RegionType.RowHeader };
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return {
type: RegionType.ColumnHeader,
x: startOffsetX,
y: 0,
width,