FowApps/fow.ui

View on GitHub

Showing 56 of 169 total issues

Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const language = this.context.language;

        const customButtons: { [key: string]: CustomButtonInput } = {
            today: {
Severity: Minor
Found in src/components/molecules/Calendar/Calendar.tsx - About 45 mins 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 setColor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const setColor = (progress: number, reverse: boolean): any => {
    if (progress >= 70) {
        return css`
            background-color: ${(props) =>
                props.theme.fow.colors[reverse ? 'error' : 'success'].dark};
Severity: Minor
Found in src/components/atoms/ProgressBar/styles/color.ts - About 45 mins 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 Group has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    (props, ref) => {
        const [value, setValue] = useMergedState(props.defaultValue, {
            value: props.value,
        });
Severity: Minor
Found in src/components/atoms/Radio/Radio.tsx - About 45 mins 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 createDragHoverCallback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    (ref, currentItem, onDrop) => (otherItem, monitor) => {
        const dragIndex = otherItem.index;
        const hoverIndex = currentItem.index;

        if (dragIndex === hoverIndex) {
Severity: Minor
Found in src/components/molecules/GridLayout/GridLayout.tsx - About 45 mins 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

Avoid deeply nested control flow statements.
Open

                            if (Array.isArray(formValues)) {
                                setFormValues((prevState) => [
                                    ...prevState,
                                    option,
                                ]);
Severity: Major
Found in src/components/molecules/SelectV2/SelectV2.tsx - About 45 mins to fix

    Function setType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const setType = (color: ColorTypes, type: TypeTypes): any => {
        switch (type) {
            case 'outlined':
                return css`
                    border: 1px solid
    Severity: Minor
    Found in src/components/atoms/Chip/styles/type.ts - About 45 mins 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

    Consider simplifying this complex logical expression.
    Open

                    if (showSelection) {
                        rowSelection = {
                            id: 'indeterminate',
                            minWidth: 32,
                            width: 32,
    Severity: Major
    Found in src/components/molecules/Table/Table.tsx - About 40 mins to fix

      Function setDotType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export const setDotType = (type: Type, isActive: boolean) => {
          switch (type) {
              case 'filled':
                  return css`
                      background-color: ${(props) =>
      Severity: Minor
      Found in src/components/molecules/Timeline/styles/dotType.ts - About 35 mins 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 Step has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const Step = ({
          onClick,
          onStepClick,
          stepIndex,
          disabled,
      Severity: Minor
      Found in src/components/molecules/Stepper/Step.tsx - About 35 mins 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 Accordion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const Accordion = ({
          defaultIndex,
          bordered = true,
          borderRadius = 0,
          onItemClick,
      Severity: Minor
      Found in src/components/molecules/Accordion/Accordion.tsx - About 35 mins 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 Menu has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const Menu = ({
          onClick,
          children,
          title,
          ...rest
      Severity: Minor
      Found in src/components/molecules/Menu/Menu.tsx - About 35 mins 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

      Avoid too many return statements within this function.
      Open

                  return field.label || '';
      Severity: Major
      Found in src/components/atoms/Form/FormBuilder.tsx - About 30 mins to fix

        Function useControlledState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function useControlledState<T, R = T>(
            defaultStateValue: T | (() => T),
            option?: {
                defaultValue?: T | (() => T);
                value: T;
        Severity: Minor
        Found in src/hooks/useMergedState/useMergedState.ts - About 25 mins 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 Button has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const Button = (
            {
                color = 'primary',
                variant = 'contained',
                size = 'medium',
        Severity: Minor
        Found in src/components/atoms/Button/Button.tsx - About 25 mins 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 Page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const Page = ({
            title,
            icon,
            customHeader,
            customFooter,
        Severity: Minor
        Found in src/components/molecules/Page/Page.tsx - About 25 mins 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 Confirm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const Confirm = ({
            type,
            title,
            description,
            cancelable,
        Severity: Minor
        Found in src/components/molecules/Confirm/Confirm.tsx - About 25 mins 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

        Severity
        Category
        Status
        Source
        Language