grommet/grommet

View on GitHub
src/js/components/Select/__tests__/Select-multiple-test.js

Summary

Maintainability
F
4 days
Test Coverage

File Select-multiple-test.js has 602 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import { act, render, fireEvent, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { axe } from 'jest-axe';
import 'jest-axe/extend-expect';
Severity: Major
Found in src/js/components/Select/__tests__/Select-multiple-test.js - About 1 day to fix

    Function Test has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const Test = () => {
          const [value, setValue] = React.useState();
          const [options, setOptions] = React.useState(defaultOptions);
    
          return (
    Severity: Minor
    Found in src/js/components/Select/__tests__/Select-multiple-test.js - About 1 hr to fix

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

          const Test = () => {
            const [value] = React.useState();
            return (
              <Select
                id="test-select"
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 3 hrs to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 222..245

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

      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 Test = () => {
            const [value] = React.useState();
            return (
              <Select
                id="test-select"
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 3 hrs to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 151..174

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

      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 (
              <Select
                id="test-select"
                placeholder="test select"
                labelKey="name"
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 2 hrs to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 414..434

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

      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 (
              <Select
                id="test-select"
                placeholder="test select"
                labelKey="name"
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 2 hrs to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 454..474

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

      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 { getByPlaceholderText, container } = render(
            <Select
              id="test-select"
              placeholder="test select"
              multiple
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 2 hrs to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 103..113

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

      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 { getByPlaceholderText, container } = render(
            <Select
              id="test-select"
              placeholder="test select"
              multiple
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 2 hrs to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 78..88

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

      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 optionsFromServer = [
            {
              id: 1,
              name: 'Value1',
            },
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 1 hr to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 511..532

      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 defaultOptions = [
            {
              id: 1,
              name: 'Value1',
            },
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 1 hr to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 609..630

      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

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

          expect(onChange).toBeCalledWith(
            expect.objectContaining({
              value: [
                {
                  id: 1,
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 2 other locations - About 55 mins to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 200..213
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 271..284

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

      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

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

          expect(onChange).toBeCalledWith(
            expect.objectContaining({
              value: [
                {
                  id: 1,
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 2 other locations - About 55 mins to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 271..284
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 341..354

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

      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

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

          expect(onChange).toBeCalledWith(
            expect.objectContaining({
              value: [
                {
                  id: 1,
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 2 other locations - About 55 mins to fix
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 200..213
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 341..354

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

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

          const { getByPlaceholderText, getByText, container, asFragment } = render(
            <Grommet>
              <Test />
            </Grommet>,
          );
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 4 other locations - About 50 mins to fix
      src/js/components/Form/__tests__/Form-test-uncontrolled.js on lines 1564..1569
      src/js/components/Select/__tests__/Select-test.js on lines 282..286
      src/js/components/Select/__tests__/Select-test.js on lines 375..379
      src/js/components/Select/__tests__/Select-test.js on lines 423..427

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

      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 nextOptions = defaultOptions.filter(
                    (option) =>
                      option.name.toLowerCase().indexOf(text.toLowerCase()) >= 0,
                  );
      Severity: Minor
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 1 other location - About 40 mins to fix
      src/js/components/Select/stories/CustomThemed/CustomSearch.js on lines 72..74

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

          const { getByPlaceholderText, getByText, asFragment } = render(
            <Grommet>
              <Test />
            </Grommet>,
          );
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 15 other locations - About 35 mins to fix
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 36..40
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 214..218
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 256..260
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 299..303
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 362..366
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 486..490
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 592..596
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 731..735
      src/js/components/Form/__tests__/Form-test-uncontrolled.js on lines 1404..1408
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 246..250
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 387..391
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 436..440
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 476..480
      src/js/components/Select/__tests__/Select-test.js on lines 329..333
      src/js/components/Select/__tests__/Select-test.js on lines 471..475

      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

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

          const { getByPlaceholderText, getByText, container } = render(
            <Grommet>
              <Test />
            </Grommet>,
          );
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 15 other locations - About 35 mins to fix
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 36..40
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 214..218
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 256..260
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 299..303
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 362..366
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 486..490
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 592..596
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 731..735
      src/js/components/Form/__tests__/Form-test-uncontrolled.js on lines 1404..1408
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 246..250
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 316..320
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 436..440
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 476..480
      src/js/components/Select/__tests__/Select-test.js on lines 329..333
      src/js/components/Select/__tests__/Select-test.js on lines 471..475

      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

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

          const { getByPlaceholderText, getByText, container } = render(
            <Grommet>
              <Test />
            </Grommet>,
          );
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 15 other locations - About 35 mins to fix
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 36..40
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 214..218
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 256..260
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 299..303
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 362..366
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 486..490
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 592..596
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 731..735
      src/js/components/Form/__tests__/Form-test-uncontrolled.js on lines 1404..1408
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 246..250
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 316..320
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 387..391
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 436..440
      src/js/components/Select/__tests__/Select-test.js on lines 329..333
      src/js/components/Select/__tests__/Select-test.js on lines 471..475

      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

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

          const { getByPlaceholderText, getByText, asFragment } = render(
            <Grommet>
              <Test />
            </Grommet>,
          );
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 15 other locations - About 35 mins to fix
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 36..40
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 214..218
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 256..260
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 299..303
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 362..366
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 486..490
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 592..596
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 731..735
      src/js/components/Form/__tests__/Form-test-uncontrolled.js on lines 1404..1408
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 316..320
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 387..391
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 436..440
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 476..480
      src/js/components/Select/__tests__/Select-test.js on lines 329..333
      src/js/components/Select/__tests__/Select-test.js on lines 471..475

      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

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

          const { getByPlaceholderText, getByText, container } = render(
            <Grommet>
              <Test />
            </Grommet>,
          );
      Severity: Major
      Found in src/js/components/Select/__tests__/Select-multiple-test.js and 15 other locations - About 35 mins to fix
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 36..40
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 214..218
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 256..260
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 299..303
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 362..366
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 486..490
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 592..596
      src/js/components/Form/__tests__/Form-test-controlled.js on lines 731..735
      src/js/components/Form/__tests__/Form-test-uncontrolled.js on lines 1404..1408
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 246..250
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 316..320
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 387..391
      src/js/components/Select/__tests__/Select-multiple-test.js on lines 476..480
      src/js/components/Select/__tests__/Select-test.js on lines 329..333
      src/js/components/Select/__tests__/Select-test.js on lines 471..475

      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