ant-design/ant-design

View on GitHub
components/upload/__tests__/upload.test.tsx

Summary

Maintainability
F
4 days
Test Coverage

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

import React, { useEffect, useRef } from 'react';
import { produce } from 'immer';
import cloneDeep from 'lodash/cloneDeep';
import type { UploadRequestOption } from 'rc-upload/lib/interface';

Severity: Major
Found in components/upload/__tests__/upload.test.tsx - About 2 days to fix

    Function Demo has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const Demo: React.FC = () => {
          const [fileList, setFileList] = React.useState<UploadFile[]>([]);
    
          const onChange: UploadProps['onChange'] = async (e) => {
            const newFileList = Array.isArray(e) ? e : e.fileList;
    Severity: Minor
    Found in components/upload/__tests__/upload.test.tsx - About 1 hr to fix

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

                defaultFileList={[
                  {
                    uid: 'bamboo',
                    name: 'bamboo.png',
                  },
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 2 other locations - About 1 hr to fix
      components/steps/demo/progress-dot-small.tsx on lines 31..52
      components/steps/demo/progress-dot.tsx on lines 29..50

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

      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 { container, rerender } = render(
            <Upload action="http://upload.com">
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 1 other location - About 1 hr to fix
      components/upload/__tests__/upload.test.tsx on lines 961..965

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

      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 { container, rerender } = render(
            <Upload listType="picture-card">
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 1 other location - About 1 hr to fix
      components/upload/__tests__/upload.test.tsx on lines 211..215

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

      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

            return (
              <Upload customRequest={customRequest} onChange={onChange} fileList={fileList}>
                <button type="button">Upload</button>
              </Upload>
            );
      Severity: Minor
      Found in components/upload/__tests__/upload.test.tsx and 1 other location - About 55 mins to fix
      components/upload/__tests__/upload.test.tsx on lines 1065..1069

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

      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

          render(
            <Upload fileList={fileList as UploadProps['fileList']}>
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Minor
      Found in components/upload/__tests__/upload.test.tsx and 1 other location - About 55 mins to fix
      components/upload/__tests__/uploadlist.test.tsx on lines 139..143

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

      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

            return (
              <Upload customRequest={customRequest} onChange={onChange} fileList={fileList}>
                <button type="button">Upload</button>
              </Upload>
            );
      Severity: Minor
      Found in components/upload/__tests__/upload.test.tsx and 1 other location - About 55 mins to fix
      components/upload/__tests__/upload.test.tsx on lines 674..678

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

      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

            fireEvent.change(wrapper.querySelector('input')!, {
              target: {
                files: [new File(['foo'], 'foo.png', { type: 'image/png' })],
              },
            });
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 2 other locations - About 45 mins to fix
      components/upload/__tests__/dragger.test.tsx on lines 48..52
      components/upload/__tests__/upload.test.tsx on lines 890..894

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

      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

          fireEvent.change(wrapper.querySelector('input')!, {
            target: {
              files: [new File(['foo'], 'foo.png', { type: 'image/png' })],
            },
          });
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 2 other locations - About 45 mins to fix
      components/upload/__tests__/dragger.test.tsx on lines 48..52
      components/upload/__tests__/upload.test.tsx on lines 715..719

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

      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 9 locations. Consider refactoring.
      Open

          const { container: wrapper } = render(
            <Upload {...props}>
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 8 other locations - About 40 mins to fix
      components/dropdown/__tests__/index.test.tsx on lines 109..113
      components/upload/__tests__/upload.test.tsx on lines 75..79
      components/upload/__tests__/upload.test.tsx on lines 99..103
      components/upload/__tests__/upload.test.tsx on lines 135..139
      components/upload/__tests__/upload.test.tsx on lines 173..177
      components/upload/__tests__/upload.test.tsx on lines 613..617
      components/upload/__tests__/upload.test.tsx on lines 709..713
      components/upload/__tests__/upload.test.tsx on lines 747..751

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

      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 9 locations. Consider refactoring.
      Open

          const { container: wrapper } = render(
            <Upload {...props}>
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 8 other locations - About 40 mins to fix
      components/dropdown/__tests__/index.test.tsx on lines 109..113
      components/upload/__tests__/upload.test.tsx on lines 99..103
      components/upload/__tests__/upload.test.tsx on lines 135..139
      components/upload/__tests__/upload.test.tsx on lines 173..177
      components/upload/__tests__/upload.test.tsx on lines 196..200
      components/upload/__tests__/upload.test.tsx on lines 613..617
      components/upload/__tests__/upload.test.tsx on lines 709..713
      components/upload/__tests__/upload.test.tsx on lines 747..751

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

      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 9 locations. Consider refactoring.
      Open

            const { container: wrapper } = render(
              <Upload {...props}>
                <button type="button">upload</button>
              </Upload>,
            );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 8 other locations - About 40 mins to fix
      components/dropdown/__tests__/index.test.tsx on lines 109..113
      components/upload/__tests__/upload.test.tsx on lines 75..79
      components/upload/__tests__/upload.test.tsx on lines 99..103
      components/upload/__tests__/upload.test.tsx on lines 135..139
      components/upload/__tests__/upload.test.tsx on lines 173..177
      components/upload/__tests__/upload.test.tsx on lines 196..200
      components/upload/__tests__/upload.test.tsx on lines 613..617
      components/upload/__tests__/upload.test.tsx on lines 747..751

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

      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 9 locations. Consider refactoring.
      Open

          const { container: wrapper } = render(
            <Upload {...props}>
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 8 other locations - About 40 mins to fix
      components/dropdown/__tests__/index.test.tsx on lines 109..113
      components/upload/__tests__/upload.test.tsx on lines 75..79
      components/upload/__tests__/upload.test.tsx on lines 135..139
      components/upload/__tests__/upload.test.tsx on lines 173..177
      components/upload/__tests__/upload.test.tsx on lines 196..200
      components/upload/__tests__/upload.test.tsx on lines 613..617
      components/upload/__tests__/upload.test.tsx on lines 709..713
      components/upload/__tests__/upload.test.tsx on lines 747..751

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

      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 9 locations. Consider refactoring.
      Open

          const { container: wrapper } = render(
            <Upload {...props}>
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 8 other locations - About 40 mins to fix
      components/dropdown/__tests__/index.test.tsx on lines 109..113
      components/upload/__tests__/upload.test.tsx on lines 75..79
      components/upload/__tests__/upload.test.tsx on lines 99..103
      components/upload/__tests__/upload.test.tsx on lines 173..177
      components/upload/__tests__/upload.test.tsx on lines 196..200
      components/upload/__tests__/upload.test.tsx on lines 613..617
      components/upload/__tests__/upload.test.tsx on lines 709..713
      components/upload/__tests__/upload.test.tsx on lines 747..751

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

      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 9 locations. Consider refactoring.
      Open

          const { container: wrapper } = render(
            <Upload {...props}>
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 8 other locations - About 40 mins to fix
      components/dropdown/__tests__/index.test.tsx on lines 109..113
      components/upload/__tests__/upload.test.tsx on lines 75..79
      components/upload/__tests__/upload.test.tsx on lines 99..103
      components/upload/__tests__/upload.test.tsx on lines 135..139
      components/upload/__tests__/upload.test.tsx on lines 196..200
      components/upload/__tests__/upload.test.tsx on lines 613..617
      components/upload/__tests__/upload.test.tsx on lines 709..713
      components/upload/__tests__/upload.test.tsx on lines 747..751

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

      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 9 locations. Consider refactoring.
      Open

          const { container: wrapper } = render(
            <Upload {...props}>
              <button type="button">upload</button>
            </Upload>,
          );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 8 other locations - About 40 mins to fix
      components/dropdown/__tests__/index.test.tsx on lines 109..113
      components/upload/__tests__/upload.test.tsx on lines 75..79
      components/upload/__tests__/upload.test.tsx on lines 99..103
      components/upload/__tests__/upload.test.tsx on lines 135..139
      components/upload/__tests__/upload.test.tsx on lines 173..177
      components/upload/__tests__/upload.test.tsx on lines 196..200
      components/upload/__tests__/upload.test.tsx on lines 709..713
      components/upload/__tests__/upload.test.tsx on lines 747..751

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

      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 9 locations. Consider refactoring.
      Open

            const { container: wrapper } = render(
              <Upload {...props}>
                <button type="button">upload</button>
              </Upload>,
            );
      Severity: Major
      Found in components/upload/__tests__/upload.test.tsx and 8 other locations - About 40 mins to fix
      components/dropdown/__tests__/index.test.tsx on lines 109..113
      components/upload/__tests__/upload.test.tsx on lines 75..79
      components/upload/__tests__/upload.test.tsx on lines 99..103
      components/upload/__tests__/upload.test.tsx on lines 135..139
      components/upload/__tests__/upload.test.tsx on lines 173..177
      components/upload/__tests__/upload.test.tsx on lines 196..200
      components/upload/__tests__/upload.test.tsx on lines 613..617
      components/upload/__tests__/upload.test.tsx on lines 709..713

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

      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 { container, rerender } = render(
            <Demo>
              <div>upload</div>
            </Demo>,
          );
      Severity: Minor
      Found in components/upload/__tests__/upload.test.tsx and 1 other location - About 35 mins to fix
      components/button/__tests__/index.test.tsx on lines 92..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 46.

      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