ant-design/ant-design

View on GitHub

Showing 3,485 of 3,485 total issues

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

  it('should not show pager if pagination.hideOnSinglePage is true and only 1 page', () => {
    const { container, rerender } = render(
      createTable({ pagination: { pageSize: 3, hideOnSinglePage: true } }),
    );
    expect(container.querySelectorAll('.ant-pagination')).toHaveLength(1);
Severity: Major
Found in components/table/__tests__/Table.pagination.test.tsx and 1 other location - About 1 day to fix
components/list/__tests__/pagination.test.tsx on lines 47..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 334.

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 FilterDropdown has 364 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
  const {
    tablePrefixCls,
    prefixCls,
    column,
Severity: Major
Found in components/table/hooks/useFilter/FilterDropdown.tsx - About 1 day to fix

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

    import * as React from 'react';
    import { SmileOutlined } from '@ant-design/icons';
    import CSSMotion from 'rc-motion';
    import { genCSSMotion } from 'rc-motion/lib/CSSMotion';
    import KeyCode from 'rc-util/lib/KeyCode';
    Severity: Major
    Found in components/modal/__tests__/confirm.test.tsx - About 1 day to fix

      Function genPickerStyle has 353 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const genPickerStyle: GenerateStyle<PickerToken> = (token) => {
        const {
          componentCls,
          antCls,
          controlHeight,
      Severity: Major
      Found in components/date-picker/style/index.ts - About 1 day to fix

        Function InternalUpload has 352 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (props, ref) => {
          const {
            fileList,
            defaultFileList,
            onRemove,
        Severity: Major
        Found in components/upload/Upload.tsx - About 1 day to fix

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

          import React, { useCallback, useEffect, useState } from 'react';
          import { fireEvent, render, waitFor } from '@testing-library/react';
          import type { DefaultRecordType } from 'rc-table/lib/interface';
          
          import type { SelectAllLabel, TransferProps } from '..';
          Severity: Major
          Found in components/transfer/__tests__/index.test.tsx - About 1 day to fix

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

              it('should be controlled by open', () => {
                jest.useFakeTimers();
                const popconfirm = render(
                  <Popconfirm title="code">
                    <span>show me your code</span>
            Severity: Major
            Found in components/popconfirm/__tests__/index.test.tsx and 1 other location - About 1 day to fix
            components/popconfirm/__tests__/index.test.tsx on lines 132..162

            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 309.

            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 be controlled by visible', () => {
                jest.useFakeTimers();
                const popconfirm = render(
                  <Popconfirm title="code">
                    <span>show me your code</span>
            Severity: Major
            Found in components/popconfirm/__tests__/index.test.tsx and 1 other location - About 1 day to fix
            components/popconfirm/__tests__/index.test.tsx on lines 100..130

            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 309.

            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 Base has 330 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 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 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

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

                    it('should exist crossorigin attribute when set file.crossorigin in case of listType="picture"', () => {
                      const list = [
                        {
                          uid: '0',
                          name: 'xxx.png',
                  Severity: Major
                  Found in components/upload/__tests__/uploadlist.test.tsx and 1 other location - About 1 day to fix
                  components/upload/__tests__/uploadlist.test.tsx on lines 1525..1564

                  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 289.

                  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 exist crossorigin attribute when set file.crossorigin in case of listType="picture-card"', () => {
                      const list = [
                        {
                          uid: '0',
                          name: 'xxx.png',
                  Severity: Major
                  Found in components/upload/__tests__/uploadlist.test.tsx and 1 other location - About 1 day to fix
                  components/upload/__tests__/uploadlist.test.tsx on lines 1461..1500

                  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 289.

                  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: TableColumnsType<DataType> = [
                    {
                      title: 'Full Name',
                      width: 100,
                      dataIndex: 'name',
                  Severity: Major
                  Found in components/table/demo/sticky.tsx and 1 other location - About 1 day to fix
                  components/table/demo/fixed-columns-header.tsx on lines 12..77

                  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 286.

                  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: TableColumnsType<DataType> = [
                    {
                      title: 'Full Name',
                      width: 100,
                      dataIndex: 'name',
                  Severity: Major
                  Found in components/table/demo/fixed-columns-header.tsx and 1 other location - About 1 day to fix
                  components/table/demo/sticky.tsx on lines 12..77

                  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 286.

                  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

                  File index.ts has 689 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

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

                        it('should justify by responsive justify prop', () => {
                          const matchMediaSpy = jest.spyOn(window, 'matchMedia');
                          matchMediaSpy.mockImplementation(
                            (query) =>
                              ({
                      Severity: Major
                      Found in components/grid/__tests__/index.test.tsx and 1 other location - About 1 day to fix
                      components/grid/__tests__/index.test.tsx on lines 174..192

                      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 280.

                      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 align by responsive align prop', () => {
                          const matchMediaSpy = jest.spyOn(window, 'matchMedia');
                          matchMediaSpy.mockImplementation(
                            (query) =>
                              ({
                      Severity: Major
                      Found in components/grid/__tests__/index.test.tsx and 1 other location - About 1 day to fix
                      components/grid/__tests__/index.test.tsx on lines 194..212

                      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 280.

                      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 ColorHsbInput work correct', () => {
                          const handleAlphaChange = jest.fn();
                          const { container } = render(<ColorHsbInput prefixCls="test" onChange={handleAlphaChange} />);
                          expect(container.querySelector('.test-hsb-input')).toBeTruthy();
                          const hsbInputEls = container.querySelectorAll('.test-hsb-input input');
                      Severity: Major
                      Found in components/color-picker/__tests__/components.test.tsx and 1 other location - About 1 day to fix
                      components/color-picker/__tests__/components.test.tsx on lines 76..96

                      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 279.

                      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