ant-design/ant-design

View on GitHub

Showing 1,102 of 3,485 total issues

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

const App: React.FC = () => {
  const [hide, setHide] = useState(true);
  const [size, setSize] = useState<SizeType>('large');
  const [scale, setScale] = useState(1);

Severity: Minor
Found in components/avatar/demo/toggle-debug.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 locale!.timePickerLocale.placeholder;
Severity: Major
Found in components/date-picker/util.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return locale.lang.rangeWeekPlaceholder;
    Severity: Major
    Found in components/date-picker/util.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return locale!.timePickerLocale.rangePlaceholder;
      Severity: Major
      Found in components/date-picker/util.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return {
                points: direction === 'rtl' ? ['tr', 'br'] : ['tl', 'bl'],
                offset: [0, 4],
                overflow,
              };
        Severity: Major
        Found in components/date-picker/util.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return true;
          Severity: Major
          Found in components/upload/utils.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return locale.lang.weekPlaceholder;
            Severity: Major
            Found in components/date-picker/util.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return locale.lang.placeholder;
              Severity: Major
              Found in components/date-picker/util.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return locale.lang.rangePlaceholder;
                Severity: Major
                Found in components/date-picker/util.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return alert?.closeIcon;
                  Severity: Major
                  Found in components/alert/Alert.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return <CaretDownFilled className={switcherCls} />;
                    Severity: Major
                    Found in components/tree/utils/iconUtil.tsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          if (mode === 'right') return `${prefixCls}-item-right`;
                      Severity: Major
                      Found in components/timeline/TimelineItemList.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            if (position === 'right') return `${prefixCls}-item-right`;
                        Severity: Major
                        Found in components/timeline/TimelineItemList.tsx - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return cloneElement(switcher, {
                                className: classNames(switcher.props.className || '', switcherCls),
                              });
                          Severity: Major
                          Found in components/tree/utils/iconUtil.tsx - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return switcher as unknown as React.ReactElement;
                            Severity: Major
                            Found in components/tree/utils/iconUtil.tsx - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return !!alert?.closable;
                              Severity: Major
                              Found in components/alert/Alert.tsx - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return showLeafIcon ? (
                                      <FileOutlined className={`${prefixCls}-switcher-line-icon`} />
                                    ) : (
                                      <span className={`${prefixCls}-switcher-leaf-line`} />
                                    );
                                Severity: Major
                                Found in components/tree/utils/iconUtil.tsx - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return expanded ? (
                                        <MinusSquareOutlined className={`${prefixCls}-switcher-line-icon`} />
                                      ) : (
                                        <PlusSquareOutlined className={`${prefixCls}-switcher-line-icon`} />
                                      );
                                  Severity: Major
                                  Found in components/tree/utils/iconUtil.tsx - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                        return '';
                                    Severity: Major
                                    Found in components/timeline/TimelineItemList.tsx - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                            return tooltipProps.title;
                                      Severity: Major
                                      Found in components/typography/Base/index.tsx - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language