Showing 95 of 332 total issues
Function RegexInputWidget
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(props: RegexInputWidgetProps, ref): JSX.Element => {
const {
name,
helpText,
targetPayload,
File AsyncDualSelectWidget.tsx
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Flex, usePrevious } from '@chakra-ui/react'
import React, { useCallback, useEffect, useState } from 'react'
import type { Provider } from 'admin/providers/interfaces'
import type { Pagination } from 'admin/providers/pagination/interfaces'
import { ArrowLeft, ArrowRight } from 'react-feather'
Function DateWidget
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DateWidget = (props: DateWidgetProps): JSX.Element => {
const {
name,
helpText,
style,
Function DateTimeWidget
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DateTimeWidget = (props: DateTimeWidgetProps): JSX.Element => {
const {
name,
helpText,
style,
Function RowWidget
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const RowWidget = (props: RowWidgetProps): JSX.Element => {
const {
setInitialValue,
submitChange,
resourceName,
Function ReadOnlyWidget
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ReadOnlyWidget = (props: ReadOnlyWidgetProps): JSX.Element => {
const {
containerStore,
style,
helpText,
Function CheckboxWidget
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CheckboxWidget = (
props: WidgetProps & { isDisabled?: Accessor<boolean>; isReadOnly?: Accessor<boolean> }
): JSX.Element => {
const {
name,
Function RadioButtonWidget
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const RadioButtonWidget = (props: RadioButtonWidgetProps): JSX.Element => {
const {
name,
mainDetailObject,
containerStore,
Function EmailChipInputWidget
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const EmailChipInputWidget = (props: EmailChipInputWidgetProps): JSX.Element => {
const {
name,
helpText,
targetPayload,
Function PhoneChipInputWidget
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PhoneChipInputWidget = (props: PhoneChipInputWidgetProps): JSX.Element => {
const {
name,
helpText,
targetPayload,
Function WizardContainer
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const WizardContainer = (props: WizardContainerProps): JSX.Element => {
const {
wizard,
provider,
mainDetailObject,
Function handleFileSelect
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(event: ChangeEvent<HTMLInputElement>) => {
setFileErrors([])
const uploadingPromises = Array.from(event.target.files || []).map(
(file: File): Promise<CombinedFileDescriptor | null> => {
const start = new Date()
Function mountWizards
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const mountWizards = (kwargs: MountWizardsKwargs): JSX.Element => {
/*
Function mounts widgets for Wizard View.
Widgets of Wizard View type use store.
Function DateTimeRangeWidget
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
const DateTimeRangeWidget = (props: DateTimeRangeWidgetProps): JSX.Element => {
const {
name,
helpText,
targetPayload,
- 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 MultiSelectFilter
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MultiSelectFilter = (params: ResourceFilterProps): JSX.Element => {
const [options, setOptions] = React.useState<any>([])
const [storedOptions, setStoredOptions] = React.useState<Model[]>([])
const { name, label, filterResource, resourceName, gotoPage, provider, cacheTime, className } = params
const history = useHistory()
Function useArrayValidation
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function useArrayValidation(
rootHook: (
array: ArrayErrors,
onChange: (updater: Updater<ArrayErrors>) => void,
getKey: (value: unknown, index: number) => string | number
Function TextValidationWidget
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TextValidationWidget = (props: WidgetProps & { validateValue?: Accessor<any> }): JSX.Element => {
const {
containerStore,
style,
helpText,
Function Wizard
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Wizard = <Key extends string, Action extends string, StepData extends object>(
props: WizardProps<Key, Action, StepData>
): JSX.Element => {
const { start, steps, onFinish, onRestart, name, map } = props
const [currentStep, setCurrentStep] = useState(start.step)
Function makeTable
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function makeTable(
TableComponent: StyledContainer | string = 'table',
RowComponent: StyledContainer | string = 'tr',
HeadComponent: StyledContainer | string = 'th',
CellComponent: StyledContainer | string = 'td'
Function useResourcesMenu
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
export const useResourcesMenu = (
resources: ResourceComposerChildType | (ResourceComposerChildType | false)[] | false,
permissions: string[]
): Array<MenuItemMeta> => {
const menuItems = useMemo(
- 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"