ant-design/ant-design

View on GitHub

Showing 1,098 of 3,488 total issues

Function Transfer has 329 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Transfer = <RecordType extends TransferItem = TransferItem>(
  props: TransferProps<RecordType>,
) => {
  const {
    dataSource,
Severity: Major
Found in components/transfer/index.tsx - About 1 day to fix

    Function Base has 325 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
      const {
        prefixCls: customizePrefixCls,
        className,
        style,
    Severity: Major
    Found in components/typography/Base/index.tsx - About 1 day to fix

      Function Footer has 322 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Footer: React.FC = () => {
        const location = useLocation();
        const [locale, lang] = useLocale(locales);
        const { styles } = useStyle();
      
      
      Severity: Major
      Found in .dumi/theme/slots/Footer/index.tsx - About 1 day to fix

        File index.ts has 702 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import type { CSSObject } from '@ant-design/cssinjs';
        import { unit } from '@ant-design/cssinjs';
        
        import { clearFix, resetComponent } from '../../style';
        import { genCompactItemStyle } from '../../style/compact-item';
        Severity: Major
        Found in components/input/style/index.ts - About 1 day to fix

          Function GlobalDemoStyles has 308 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const GlobalDemoStyles: React.FC = () => {
            const token = useTheme();
          
            const { antCls, iconCls } = token;
          
          
          Severity: Major
          Found in .dumi/theme/common/styles/Demo.tsx - About 1 day to fix

            File index.ts has 670 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import type { CSSProperties } from 'react';
            import type { CSSObject } from '@ant-design/cssinjs';
            import { unit } from '@ant-design/cssinjs';
            import { TinyColor } from '@ctrl/tinycolor';
            import type { CssUtil } from 'antd-style';
            Severity: Major
            Found in components/menu/style/index.ts - About 1 day to fix

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

              import React, { useEffect, useMemo, useState } from 'react';
              import { createEvent, fireEvent, render } from '@testing-library/react';
              import { spyElementPrototypes } from 'rc-util/lib/test/domHook';
              
              import { resetWarned } from '../../_util/warning';
              Severity: Major
              Found in components/color-picker/__tests__/index.test.tsx - About 1 day to fix

                Function getColumns has 299 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const getColumns = React.useMemo<FooterColumn[]>(() => {
                    const isZhCN = lang === 'cn';
                
                    const col1 = {
                      title: <FormattedMessage id="app.footer.resources" />,
                Severity: Major
                Found in .dumi/theme/slots/Footer/index.tsx - About 1 day to fix

                  Function InternalTable has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const InternalTable = <RecordType extends AnyObject = AnyObject>(
                    props: InternalTableProps<RecordType>,
                    ref: React.MutableRefObject<HTMLDivElement>,
                  ) => {
                    const {
                  Severity: Minor
                  Found in components/table/InternalTable.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 index.test.tsx has 641 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React from 'react';
                  import type { SingleValueType } from 'rc-cascader/lib/Cascader';
                  
                  import type { BaseOptionType, DefaultOptionType } from '..';
                  import Cascader from '..';
                  Severity: Major
                  Found in components/cascader/__tests__/index.test.tsx - About 1 day to fix

                    Function transformColumns has 279 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        (columns: ColumnsType<RecordType>): ColumnsType<RecordType> => {
                          // >>>>>>>>>>> Skip if not exists `rowSelection`
                          if (!rowSelection) {
                            warning(
                              !columns.includes(SELECTION_COLUMN),
                    Severity: Major
                    Found in components/table/hooks/useSelection.tsx - About 1 day to fix

                      Function FilterDropdown has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
                        const {
                          tablePrefixCls,
                          prefixCls,
                          column,
                      Severity: Minor
                      Found in components/table/hooks/useFilter/FilterDropdown.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 TransferList has 272 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const TransferList = <RecordType extends KeyWiseTransferItem>(
                        props: TransferListProps<RecordType>,
                      ) => {
                        const {
                          prefixCls,
                      Severity: Major
                      Found in components/transfer/list.tsx - About 1 day to fix

                        Function useSelection has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const useSelection = <RecordType extends AnyObject = AnyObject>(
                          config: UseSelectionConfig<RecordType>,
                          rowSelection?: TableRowSelection<RecordType>,
                        ): readonly [TransformColumns<RecordType>, Set<Key>] => {
                          const {
                        Severity: Minor
                        Found in components/table/hooks/useSelection.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 useSelection.tsx has 606 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import * as React from 'react';
                        import { useCallback, useMemo } from 'react';
                        import DownOutlined from '@ant-design/icons/DownOutlined';
                        import classNames from 'classnames';
                        import { INTERNAL_COL_DEFINE } from 'rc-table';
                        Severity: Major
                        Found in components/table/hooks/useSelection.tsx - About 1 day to fix

                          Function genInputNumberStyles has 258 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const genInputNumberStyles: GenerateStyle<InputNumberToken> = (token: InputNumberToken) => {
                            const {
                              componentCls,
                              lineWidth,
                              lineType,
                          Severity: Major
                          Found in components/input-number/style/index.ts - About 1 day to fix

                            Function InternalFormItem has 255 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function InternalFormItem<Values = any>(props: FormItemProps<Values>): React.ReactElement {
                              const {
                                name,
                                noStyle,
                                className,
                            Severity: Major
                            Found in components/form/FormItem/index.tsx - About 1 day to fix

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

                              export const genBaseStyle = (prefixCls: string, token: TreeToken): CSSObject => {
                                const { treeCls, treeNodeCls, treeNodePadding, titleHeight, nodeSelectedBg, nodeHoverBg } = token;
                                const treeCheckBoxMarginHorizontal = token.paddingXS;
                              
                                return {
                              Severity: Major
                              Found in components/tree/style/index.ts - About 1 day to fix

                                File panel.ts has 583 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import { unit } from '@ant-design/cssinjs';
                                import type { CSSObject } from '@ant-design/cssinjs';
                                import { TinyColor } from '@ctrl/tinycolor';
                                
                                import type { GenerateStyle } from '../../theme/internal';
                                Severity: Major
                                Found in components/date-picker/style/panel.ts - About 1 day to fix

                                  Function Theme has 248 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const Theme: React.FC = () => {
                                    const { styles } = useStyle();
                                    const [locale, lang] = useLocale(locales);
                                    const isZhCN = lang === 'cn';
                                    const { search } = useLocation();
                                  Severity: Major
                                  Found in .dumi/pages/index/components/Theme/index.tsx - About 1 day to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language