best-doctor/ke

View on GitHub

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,
Severity: Minor
Found in src/django-spa/components/controls/ChipInput/ChipInput.tsx - About 1 hr to fix

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] : [])
Severity: Minor
Found in src/django-spa/plugins/table/withSelectViaFirstColumn.tsx - About 1 hr to fix

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 => {
Severity: Minor
Found in src/WizardMaster/utils.tsx - About 1 hr to fix

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,
Severity: Minor
Found in src/integration/analytics/utils.ts - About 1 hr to fix

    Function TextEditorWidget has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const TextEditorWidget = (props: TextEditorProps): JSX.Element => {
      const {
        name,
        helpText,
        targetPayload,
    Severity: Minor
    Found in src/DetailView/widgets/TextEditorWidget.tsx - About 1 hr to fix

      Function BooleanFilter has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const BooleanFilter = (params: BooleanFilterProps): JSX.Element => {
        const {
          name,
          label,
          resourceName,
      Severity: Minor
      Found in src/ListView/components/Table/filters.tsx - About 1 hr to fix

        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() ?? {}
        
        
        Severity: Minor
        Found in src/django-spa/aspects/test-id/hooks/useCreateTestId.ts - About 1 hr to fix

          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> {
          Severity: Minor
          Found in src/django-spa/cdk/Providers/CRUD/GetSet.factory.ts - About 1 hr to fix

            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,
              Severity: Minor
              Found in src/DetailView/widgets/SelectWidget.tsx - About 1 hr to fix

                Function getNewDateRange has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                const getNewDateRange = (
                  dateKind: string,
                  choosedDate: OptionalDate,
                  startDate: OptionalDate,
                  endDate: OptionalDate,
                Severity: Minor
                Found in src/DetailView/utils/dateUtils.ts - About 1 hr to fix

                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
                Severity: Minor
                Found in src/DetailView/RenderDetail.tsx - About 1 hr to fix

                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,
                Severity: Minor
                Found in src/common/components/AsyncSelectWidget.tsx - About 1 hr to fix

                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)}"`)
                    }
                Severity: Minor
                Found in src/django-spa/cdk/Validation/Zod.ts - About 1 hr to fix

                  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 })
                  Severity: Minor
                  Found in src/DetailView/widgets/LinkWidget.tsx - About 1 hr to fix

                    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()
                    Severity: Minor
                    Found in src/common/components/ToClipboard.tsx - About 1 hr to fix

                    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() ?? {}
                    
                    
                    Severity: Minor
                    Found in src/django-spa/aspects/test-id/hooks/useCreateTestId.ts - About 1 hr to fix

                    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
                    Severity: Minor
                    Found in src/django-spa/cdk/Forms/Validation/Array.hook.ts - About 1 hr to fix

                    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,
                    Severity: Minor
                    Found in src/integration/analytics/utils.ts - About 1 hr to fix

                    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 = {
                    Severity: Minor
                    Found in src/django-spa/plugins/table/withSortingInHeader.tsx - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language