grommet/grommet

View on GitHub
src/js/components/Accordion/__tests__/Accordion-test.tsx

Summary

Maintainability
D
2 days
Test Coverage

File Accordion-test.tsx has 358 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import 'jest-styled-components';
import 'jest-axe/extend-expect';
import 'regenerator-runtime/runtime';

Severity: Minor
Found in src/js/components/Accordion/__tests__/Accordion-test.tsx - About 4 hrs to fix

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

          <Grommet theme={{ accordion: { hover: { color: 'red' } } }}>
            <Accordion>
              <AccordionPanel
                label="Panel 1"
                onMouseOver={() => {}}
    Severity: Major
    Found in src/js/components/Accordion/__tests__/Accordion-test.tsx and 2 other locations - About 2 hrs to fix
    src/js/components/Accordion/__tests__/Accordion-test.tsx on lines 249..267
    src/js/components/Accordion/__tests__/Accordion-test.tsx on lines 280..298

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

    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

          <Grommet
            theme={{
              accordion: {
                hover: { heading: { color: 'teal' } },
              },
    Severity: Major
    Found in src/js/components/Accordion/__tests__/Accordion-test.tsx and 2 other locations - About 2 hrs to fix
    src/js/components/Accordion/__tests__/Accordion-test.tsx on lines 224..236
    src/js/components/Accordion/__tests__/Accordion-test.tsx on lines 249..267

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

    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

          <Grommet
            theme={{
              accordion: {
                hover: { color: undefined },
              },
    Severity: Major
    Found in src/js/components/Accordion/__tests__/Accordion-test.tsx and 2 other locations - About 2 hrs to fix
    src/js/components/Accordion/__tests__/Accordion-test.tsx on lines 224..236
    src/js/components/Accordion/__tests__/Accordion-test.tsx on lines 280..298

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

    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

            <Box background="dark-1">
              <Accordion>
                <AccordionPanel label={<div>Panel 1 complex</div>}>
                  Panel body 1
                </AccordionPanel>
    Severity: Major
    Found in src/js/components/Accordion/__tests__/Accordion-test.tsx and 1 other location - About 2 hrs to fix
    src/js/components/Tabs/__tests__/Tabs-test.tsx on lines 65..71

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

    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 { asFragment } = render(
          <Grommet>
            <Accordion onActive={onActive}>
              <AccordionPanel label="Panel 1">Panel body 1</AccordionPanel>
              <AccordionPanel label="Panel 2">Panel body 2</AccordionPanel>
    Severity: Major
    Found in src/js/components/Accordion/__tests__/Accordion-test.tsx and 1 other location - About 1 hr to fix
    src/js/components/Tabs/__tests__/Tabs-test.tsx on lines 120..127

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

    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

      test('no AccordionPanel', () => {
        const { asFragment } = render(
          <Grommet>
            <Accordion />
          </Grommet>,
    Severity: Major
    Found in src/js/components/Accordion/__tests__/Accordion-test.tsx and 2 other locations - About 1 hr to fix
    src/js/components/Skeleton/__tests__/Skeleton-test.tsx on lines 14..22
    src/js/components/ToggleGroup/__tests__/ToggleGroup-test.tsx on lines 27..35

    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

    There are no issues that match your filters.

    Category
    Status