Showing 95 of 332 total issues
Function ChipInput
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const ChipInput = forwardRef<HTMLInputElement, ChipInputProps>((props, ref): JSX.Element => {
const {
value: inputValue,
onChange,
placeholder,
- 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 withSelectViaFirstColumn
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function withSelectViaFirstColumn(SelectHandler: ComponentType<SelectHandlerProps>): TablePlugin<SelectProps> {
return {
before: ({ value = [], onChange, data = [], columns, ...restProps }) => {
const selectedAll = data.every((item) => value.includes(item))
const setSelectedAll = (v: boolean): void => onChange(v ? [...data] : [])
- 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 validateRequiredWidgets
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const validateRequiredWidgets = (
widgets: WidgetType[],
mainWizardObject: WizardObject,
wizardContext: { [key: string]: any }
): 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
Function pushAnalytics
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const pushAnalytics = (params: WidgetAnalyticsParams): void => {
const {
eventName,
widgetName,
widgetType,
Function TextEditorWidget
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TextEditorWidget = (props: TextEditorProps): JSX.Element => {
const {
name,
helpText,
targetPayload,
Function BooleanFilter
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const BooleanFilter = (params: BooleanFilterProps): JSX.Element => {
const {
name,
label,
resourceName,
Function useCreateTestId
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useCreateTestId(config: UseTestIdProps = {}): UseCreateTestIdResult {
const { name: configName, 'data-test-id': configDataTestId, prefix: configPrefix, postfix: configPostfix } = config
const { config: testIdConfig } = useTestIdConfig() ?? {}
Function makeByGetSet
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function makeByGetSet<T>(
get: () => readonly T[],
set: (val: T[]) => void,
calcPK: (val: T) => string | number
): CRUDProvider<T> {
Function WizardStepComponents
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const WizardStepComponents = (props: WizardStepComponentsProps): JSX.Element => {
const state = useStore(containerStore)
const {
elements,
Function SelectWidget
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SelectWidget = forwardRef<HTMLSelectElement, SelectWidgetProps>((props: SelectWidgetProps, ref): JSX.Element => {
const {
name,
displayValue,
containerStore,
Function getNewDateRange
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const getNewDateRange = (
dateKind: string,
choosedDate: OptionalDate,
startDate: OptionalDate,
endDate: OptionalDate,
- 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 RenderDetail
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const RenderDetail = (props: RenderDetailProps): JSX.Element => {
/*
Entry point for displaying components in https://myspa.com/some-url/100500 route format.
Here we fetch data from the backend using the url that we specified in a
- 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 AsyncSelectWidget
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const AsyncSelectWidget = ({
dataResourceUrl,
handleChange,
value,
getOptionLabel,
- 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 convertZodRecord
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function convertZodRecord(schema: ZodType, level: number): RecordValidator {
return (val) => {
if (typeof val !== 'object' || val === null) {
throw TypeError(`Validator wait for record but got "${JSON.stringify(val)}"`)
}
Function LinkWidget
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const LinkWidget = (props: LinkWidgetProps): JSX.Element => {
const { name, mainDetailObject, href, helpText, style, containerStore, target = '_blank', linkProps } = props
const context = containerStore.getState()
const { content, widgetDescription } = useWidgetInitialization({ ...props, context })
Function ToClipboard
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const ToClipboard = ({ value, onClick, notifier, children, ...rest }: ToClipboardProps): JSX.Element => {
const handleClick = useCallback(() => {
let realValue: string | undefined
if (typeof value === 'function') {
realValue = value()
- 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 useCreateTestId
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function useCreateTestId(config: UseTestIdProps = {}): UseCreateTestIdResult {
const { name: configName, 'data-test-id': configDataTestId, prefix: configPrefix, postfix: configPostfix } = config
const { config: testIdConfig } = useTestIdConfig() ?? {}
- 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 useArrayValidation
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function useArrayValidation(
rootHook: (
array: ArrayErrors,
onChange: (updater: Updater<ArrayErrors>) => void,
getKey: (value: unknown, index: number) => string | number
- 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 pushAnalytics
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const pushAnalytics = (params: WidgetAnalyticsParams): void => {
const {
eventName,
widgetName,
widgetType,
- 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 withSortingInHeader
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function withSortingInHeader(OrderHandler: ComponentType<SortHandlerProps>): TablePlugin<SortingProps> {
return {
after: (normalizedProps) => {
const { orderedColumnNames, ordering, onOrderChange, ...restTableProps } = normalizedProps.table
const result = {