ant-design/ant-design

View on GitHub

Showing 3,543 of 3,543 total issues

File panel.ts has 580 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

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

    import { unit } from '@ant-design/cssinjs';
    import type { CSSObject } from '@ant-design/cssinjs';
    
    import {
      genBasicInputStyle,
    Severity: Major
    Found in components/pagination/style/index.ts - About 1 day to fix

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

      const genBaseStyle: GenerateStyle<DropdownToken> = (token) => {
        const {
          componentCls,
          menuCls,
          zIndexPopup,
      Severity: Major
      Found in components/dropdown/style/index.ts - About 1 day to fix

        Function genSpinStyle has 242 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          const GlobalHolderWrapper = React.forwardRef<GlobalHolderRef, unknown>((_, ref) => {
            const [messageConfig, setMessageConfig] = React.useState<ConfigOptions>(getGlobalContext);
          
            const sync = () => {
              setMessageConfig(getGlobalContext);
          Severity: Major
          Found in components/message/index.tsx and 1 other location - About 1 day to fix
          components/notification/index.tsx on lines 94..115

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 228.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          const GlobalHolderWrapper = React.forwardRef<GlobalHolderRef, unknown>((_, ref) => {
            const [notificationConfig, setNotificationConfig] =
              React.useState<GlobalConfigProps>(getGlobalContext);
          
            const sync = () => {
          Severity: Major
          Found in components/notification/index.tsx and 1 other location - About 1 day to fix
          components/message/index.tsx on lines 101..121

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 228.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('should not lost focus when clear input', () => {
              const onBlur = jest.fn();
              const { container, unmount } = render(
                <TextArea allowClear defaultValue="value" onBlur={onBlur} />,
                {
          Severity: Major
          Found in components/input/__tests__/textarea.test.tsx and 1 other location - About 1 day to fix
          components/input/__tests__/index.test.tsx on lines 379..395

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 227.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('should not lost focus when clear input', () => {
              const onBlur = jest.fn();
              const { container, unmount } = render(
                <Input allowClear defaultValue="value" onBlur={onBlur} />,
                {
          Severity: Major
          Found in components/input/__tests__/index.test.tsx and 1 other location - About 1 day to fix
          components/input/__tests__/textarea.test.tsx on lines 413..429

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 227.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function Header has 239 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            const columns: ColumnsType<DataType> = [
              {
                title: 'Name',
                dataIndex: 'name',
              },
            Severity: Major
            Found in components/table/demo/dynamic-settings.tsx and 1 other location - About 1 day to fix
            components/table/demo/component-token.tsx on lines 21..62

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 226.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            const columns: ColumnsType<DataType> = [
              {
                title: 'Name',
                dataIndex: 'name',
              },
            Severity: Major
            Found in components/table/demo/component-token.tsx and 1 other location - About 1 day to fix
            components/table/demo/dynamic-settings.tsx on lines 21..62

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 226.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function getBaseStyle has 237 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const getBaseStyle: GenerateStyle<MenuToken> = (token) => {
              const {
                antCls,
                componentCls,
                fontSize,
            Severity: Major
            Found in components/menu/style/index.ts - About 1 day to fix

              File Table.pagination.test.tsx has 557 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              
              import type { TablePaginationConfig, TableProps } from '..';
              import Table from '..';
              import scrollTo from '../../_util/scrollTo';
              Severity: Major
              Found in components/table/__tests__/Table.pagination.test.tsx - About 1 day to fix

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

                import * as React from 'react';
                import { defaultAlgorithm, defaultTheme } from '@ant-design/compatible';
                import {
                  BellOutlined,
                  FolderOutlined,
                Severity: Major
                Found in .dumi/pages/index/components/Theme/index.tsx - About 1 day to fix

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                  const items: MenuItem[] = [
                    {
                      label: 'Navigation One',
                      key: 'mail',
                      icon: <MailOutlined />,
                  Severity: Major
                  Found in components/menu/demo/horizontal-dark.tsx and 2 other locations - About 1 day to fix
                  components/menu/demo/component-token.tsx on lines 15..58
                  components/menu/demo/horizontal.tsx on lines 8..51

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 218.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      <Flex gap="4px 0" wrap>
                        <Tag color="magenta">magenta</Tag>
                        <Tag color="red">red</Tag>
                        <Tag color="volcano">volcano</Tag>
                        <Tag color="orange">orange</Tag>
                  Severity: Major
                  Found in components/tag/demo/colorful.tsx and 1 other location - About 1 day to fix
                  components/tag/demo/colorful-inverse.tsx on lines 5..17

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 218.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                  const items: MenuItem[] = [
                    {
                      label: 'Navigation One',
                      key: 'mail',
                      icon: <MailOutlined />,
                  Severity: Major
                  Found in components/menu/demo/horizontal.tsx and 2 other locations - About 1 day to fix
                  components/menu/demo/component-token.tsx on lines 15..58
                  components/menu/demo/horizontal-dark.tsx on lines 8..51

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 218.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                  const items: MenuItem[] = [
                    {
                      label: 'Navigation One',
                      key: 'mail',
                      icon: <MailOutlined />,
                  Severity: Major
                  Found in components/menu/demo/component-token.tsx and 2 other locations - About 1 day to fix
                  components/menu/demo/horizontal-dark.tsx on lines 8..51
                  components/menu/demo/horizontal.tsx on lines 8..51

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 218.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    <Flex gap="4px 0" wrap>
                      <Tag color="magenta-inverse">magenta</Tag>
                      <Tag color="red-inverse">red</Tag>
                      <Tag color="volcano-inverse">volcano</Tag>
                      <Tag color="orange-inverse">orange</Tag>
                  Severity: Major
                  Found in components/tag/demo/colorful-inverse.tsx and 1 other location - About 1 day to fix
                  components/tag/demo/colorful.tsx on lines 7..19

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 218.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      it('vertical with click', () => {
                        const defaultTestProps: MenuProps = { mode: 'vertical', triggerSubMenuAction: 'click' };
                        const Demo: React.FC = () => (
                          <Menu {...defaultTestProps}>
                            <SubMenu key="1" title="submenu1">
                  Severity: Major
                  Found in components/menu/__tests__/index.test.tsx and 1 other location - About 1 day to fix
                  components/menu/__tests__/index.test.tsx on lines 648..668

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 217.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language