packages/sdk/src/components/cell-value/CellValue.tsx
Function CellValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
export const CellValue = (props: ICellValueContainer) => {
const { field, value, maxWidth, maxLine, className, itemClassName, formatImageUrl } = props;
const { type, options, cellValueType } = field;
switch (type) {
- 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
Open
return (
<CellSelect
value={value as ISingleSelectCellValue | IMultipleSelectCellValue}
options={transformSelectOptions(options.choices)}
className={className}
Avoid too many return
statements within this function. Open
Open
return <CellCheckbox value={value as boolean | boolean[]} className={className} />;
Avoid too many return
statements within this function. Open
Open
return <CellCheckbox value={value as boolean | boolean[]} className={className} />;
Avoid too many return
statements within this function. Open
Open
return (
<CellNumber
value={value as number}
formatting={options.formatting as INumberFormatting}
className={className}
Avoid too many return
statements within this function. Open
Open
return <CellText value={value as string} className={className} />;
Avoid too many return
statements within this function. Open
Open
return (
<CellDate
value={value as string}
formatting={options.formatting as IDatetimeFormatting}
className={className}
Avoid too many return
statements within this function. Open
Open
return (
<CellDate value={value as string} formatting={options.formatting} className={className} />
);
Avoid too many return
statements within this function. Open
Open
return (
<CellRating
value={value as number}
options={options as IRatingFieldOptions}
className={className}
Avoid too many return
statements within this function. Open
Open
return (
<CellUser
value={value as IUserCellValue | IUserCellValue[]}
className={className}
itemClassName={itemClassName}
Avoid too many return
statements within this function. Open
Open
return (
<CellAttachment
value={value as IAttachmentCellValue}
className={className}
itemClassName={itemClassName}
Avoid too many return
statements within this function. Open
Open
return (
<CellLink
value={value as ILinkCellValue | ILinkCellValue[]}
className={className}
itemClassName={itemClassName}