ant-design/ant-design

View on GitHub

Showing 1,102 of 3,485 total issues

File InternalTable.tsx has 509 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as React from 'react';
import classNames from 'classnames';
import { INTERNAL_HOOKS } from 'rc-table';
import type { Reference as RcReference, TableProps as RcTableProps } from 'rc-table';
import { convertChildrenToColumns } from 'rc-table/lib/hooks/useColumns';
Severity: Major
Found in components/table/InternalTable.tsx - About 1 day to fix

    Function getThemeStyle has 204 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation => {
      const {
        componentCls,
        itemColor,
        itemSelectedColor,
    Severity: Major
    Found in components/menu/style/theme.ts - About 1 day to fix

      Function Transfer has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
      Open

      const Transfer = <RecordType extends TransferItem = TransferItem>(
        props: TransferProps<RecordType>,
      ) => {
        const {
          dataSource,
      Severity: Minor
      Found in components/transfer/index.tsx - About 1 day 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 Anchor has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
      Open

      const Anchor: React.FC<AnchorProps> = (props) => {
        const {
          rootClassName,
          prefixCls: customPrefixCls,
          className,
      Severity: Minor
      Found in components/anchor/Anchor.tsx - About 1 day 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 generateCalendar has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
      Open

      function generateCalendar<DateType extends AnyObject>(generateConfig: GenerateConfig<DateType>) {
        function isSameYear(date1: DateType, date2: DateType) {
          return date1 && date2 && generateConfig.getYear(date1) === generateConfig.getYear(date2);
        }
      
      
      Severity: Minor
      Found in components/calendar/generateCalendar.tsx - About 1 day 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

      File direction.tsx has 502 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { useState } from 'react';
      import {
        DownloadOutlined,
        LeftOutlined,
        MinusOutlined,
      Severity: Major
      Found in components/config-provider/demo/direction.tsx - About 1 day to fix

        Function genBaseStyle has 201 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const genBaseStyle: GenerateStyle<SliderToken> = (token) => {
          const {
            componentCls,
            antCls,
            controlSize,
        Severity: Major
        Found in components/slider/style/index.ts - About 1 day to fix

          Function genSpinStyle has 201 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const genSpinStyle: GenerateStyle<SpinToken> = (token: SpinToken): CSSObject => {
            const { componentCls, calc } = token;
            return {
              [`${componentCls}`]: {
                ...resetComponent(token),
          Severity: Major
          Found in components/spin/style/index.ts - About 1 day to fix

            Function genMentionsStyle has 200 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const genMentionsStyle: GenerateStyle<MentionsToken> = (token) => {
              const {
                componentCls,
                colorTextDisabled,
                controlItemBgHover,
            Severity: Major
            Found in components/mentions/style/index.ts - About 1 day to fix

              File FilterDropdown.tsx has 497 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import * as React from 'react';
              import FilterFilled from '@ant-design/icons/FilterFilled';
              import classNames from 'classnames';
              import type { FieldDataNode } from 'rc-tree';
              import isEqual from 'rc-util/lib/isEqual';
              Severity: Minor
              Found in components/table/hooks/useFilter/FilterDropdown.tsx - About 7 hrs to fix

                Function InternalUpload has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                Open

                const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (props, ref) => {
                  const {
                    fileList,
                    defaultFileList,
                    onRemove,
                Severity: Minor
                Found in components/upload/Upload.tsx - About 7 hrs 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 genPositionStyle has 196 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const genPositionStyle: GenerateStyle<TabsToken> = (token: TabsToken): CSSObject => {
                  const {
                    componentCls,
                    margin,
                    colorBorderSecondary,
                Severity: Major
                Found in components/tabs/style/index.ts - About 7 hrs to fix

                  Function Watermark has 196 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Watermark: React.FC<WatermarkProps> = (props) => {
                    const {
                      /**
                       * The antd content layer zIndex is basically below 10
                       * https://github.com/ant-design/ant-design/blob/6192403b2ce517c017f9e58a32d58774921c10cd/components/style/themes/default.less#L335
                  Severity: Major
                  Found in components/watermark/index.tsx - About 7 hrs to fix

                    Function InternalUploadList has 195 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const InternalUploadList: React.ForwardRefRenderFunction<UploadListRef, UploadListProps> = (
                      props,
                      ref,
                    ) => {
                      const {
                    Severity: Major
                    Found in components/upload/UploadList/index.tsx - About 7 hrs to fix

                      Function App has 195 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const App: React.FC = () => {
                        const [showModal, setShowModal] = useState(false);
                        const [showDrawer, setShowDrawer] = useState(false);
                        return (
                          <Space direction="vertical">
                      Severity: Major
                      Found in components/space/demo/compact-debug.tsx - About 7 hrs to fix

                        File index.test.tsx has 491 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React, { useState } from 'react';
                        import { createPortal } from 'react-dom';
                        
                        // eslint-disable-next-line import/no-unresolved
                        import type { InputProps, InputRef } from '..';
                        Severity: Minor
                        Found in components/input/__tests__/index.test.tsx - About 7 hrs to fix

                          Function getRadioButtonStyle has 194 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const getRadioButtonStyle: GenerateStyle<RadioToken> = (token) => {
                            const {
                              buttonColor,
                              controlHeight,
                              componentCls,
                          Severity: Major
                          Found in components/radio/style/index.ts - About 7 hrs to fix

                            Function genBaseStyle has 194 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const genBaseStyle: GenerateStyle<TourToken> = (token) => {
                              const {
                                componentCls,
                                lineHeight,
                                padding,
                            Severity: Major
                            Found in components/tour/style/index.ts - About 7 hrs to fix

                              Function Dropdown has 193 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const Dropdown: CompoundedComponent = (props) => {
                                const {
                                  menu,
                                  arrow,
                                  prefixCls: customizePrefixCls,
                              Severity: Major
                              Found in components/dropdown/dropdown.tsx - About 7 hrs to fix

                                Function printLog has 191 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                async function printLog() {
                                  const tags = await git.tags();
                                  const { fromVersion } = await inquirer.prompt([
                                    {
                                      type: 'list',
                                Severity: Major
                                Found in scripts/print-changelog.ts - About 7 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language