ant-design/ant-design

View on GitHub
components/progress/__tests__/index.test.tsx

Summary

Maintainability
F
3 days
Test Coverage

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

import React, { useState } from 'react';
import { Tooltip } from 'antd';

import type { ProgressProps } from '..';
import Progress from '..';
Severity: Minor
Found in components/progress/__tests__/index.test.tsx - About 4 hrs to fix

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

      it('should warnning if pass number[] into `size` in type Circle', () => {
        const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
        render(<Progress size={[60, 20]} type="circle" />);
        expect(errorSpy).toHaveBeenCalledWith(
          'Warning: [antd: Progress] Type "circle" and "dashboard" do not accept array as `size`, please use number or preset size instead.',
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 1 other location - About 2 hrs to fix
    components/progress/__tests__/index.test.tsx on lines 275..281

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

    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 warnning if pass number[] into `size` in type dashboard', () => {
        const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
        render(<Progress size={[60, 20]} type="dashboard" />);
        expect(errorSpy).toHaveBeenCalledWith(
          'Warning: [antd: Progress] Type "circle" and "dashboard" do not accept array as `size`, please use number or preset size instead.',
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 1 other location - About 2 hrs to fix
    components/progress/__tests__/index.test.tsx on lines 260..266

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

    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 warnning if use `strokeWidth` prop in type Line', () => {
        const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
        render(<Progress percent={60} strokeWidth={10} />);
        expect(errorSpy).toHaveBeenCalledWith(
          'Warning: [antd: Progress] `strokeWidth` is deprecated. Please use `size` instead.',
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 1 other location - About 2 hrs to fix
    components/progress/__tests__/index.test.tsx on lines 236..242

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

    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 warnning if use `width` prop', () => {
        const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
        render(<Progress percent={60} width={100} />);
        expect(errorSpy).toHaveBeenCalledWith(
          'Warning: [antd: Progress] `width` is deprecated. Please use `size` instead.',
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 1 other location - About 2 hrs to fix
    components/progress/__tests__/index.test.tsx on lines 244..250

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

    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('render successColor progress type="dashboard"', () => {
        const { container: wrapper } = render(
          <Progress percent={60} type="dashboard" success={{ percent: 30, strokeColor: '#ffffff' }} />,
        );
        expect(wrapper.firstChild).toMatchSnapshot();
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 1 other location - About 2 hrs to fix
    components/progress/__tests__/index.test.tsx on lines 111..116

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

    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('render successColor progress type="circle"', () => {
        const { container: wrapper } = render(
          <Progress percent={60} type="circle" success={{ percent: 30, strokeColor: '#ffffff' }} />,
        );
        expect(wrapper.firstChild).toMatchSnapshot();
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 1 other location - About 2 hrs to fix
    components/progress/__tests__/index.test.tsx on lines 118..123

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

    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

      it('render dashboard 295 gapDegree', () => {
        const { container: wrapper } = render(<Progress type="dashboard" gapDegree={295} />);
        expect(wrapper.firstChild).toMatchSnapshot();
      });
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 2 other locations - About 1 hr to fix
    components/progress/__tests__/index.test.tsx on lines 125..128
    components/progress/__tests__/index.test.tsx on lines 135..138

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

    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

      it('render dashboard 296 gapDegree', () => {
        const { container: wrapper } = render(<Progress type="dashboard" gapDegree={296} />);
        expect(wrapper.firstChild).toMatchSnapshot();
      });
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 2 other locations - About 1 hr to fix
    components/progress/__tests__/index.test.tsx on lines 125..128
    components/progress/__tests__/index.test.tsx on lines 130..133

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

    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

      it('render dashboard zero gapDegree', () => {
        const { container: wrapper } = render(<Progress type="dashboard" gapDegree={0} />);
        expect(wrapper.firstChild).toMatchSnapshot();
      });
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 2 other locations - About 1 hr to fix
    components/progress/__tests__/index.test.tsx on lines 130..133
    components/progress/__tests__/index.test.tsx on lines 135..138

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

    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

      it('steps should have default percent 0', () => {
        const { container } = render(<ProgressSteps steps={0} />);
        expect(container.firstChild).toMatchSnapshot();
      });
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 2 other locations - About 1 hr to fix
    components/progress/__tests__/index.test.tsx on lines 29..32
    components/progress/__tests__/index.test.tsx on lines 180..183

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

    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

      it('should support steps', () => {
        const { container: wrapper } = render(<Progress steps={3} />);
        expect(wrapper.firstChild).toMatchSnapshot();
      });
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 2 other locations - About 1 hr to fix
    components/progress/__tests__/index.test.tsx on lines 29..32
    components/progress/__tests__/index.test.tsx on lines 224..227

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

    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

      it('render out-of-range progress', () => {
        const { container: wrapper } = render(<Progress percent={120} />);
        expect(wrapper.firstChild).toMatchSnapshot();
      });
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 2 other locations - About 1 hr to fix
    components/progress/__tests__/index.test.tsx on lines 180..183
    components/progress/__tests__/index.test.tsx on lines 224..227

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

    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('render normal progress', () => {
        const { container: wrapper } = render(<Progress status="normal" />);
        expect(wrapper.firstChild).toMatchSnapshot();
      });
    Severity: Major
    Found in components/progress/__tests__/index.test.tsx and 1 other location - About 1 hr to fix
    components/date-picker/__tests__/RangePicker.test.tsx on lines 57..60

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

    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

    There are no issues that match your filters.

    Category
    Status