grommet/grommet

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

Summary

Maintainability
F
6 days
Test Coverage

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

import React from 'react';
import { render } from '@testing-library/react';
import { axe } from 'jest-axe';
import 'jest-axe/extend-expect';
import 'regenerator-runtime/runtime';
Severity: Minor
Found in src/js/components/Chart/__tests__/Chart-test.tsx - About 3 hrs to fix

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

      test('point', () => {
        const { container } = render(
          <Grommet>
            <Chart type="point" point="circle" values={VALUES} />
            <Chart type="point" point="diamond" values={VALUES} />
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 1 other location - About 1 day to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 215..228

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

    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

      test('pattern', () => {
        const { container } = render(
          <Grommet>
            <Chart type="area" pattern="squares" values={VALUES} />
            <Chart type="area" pattern="circles" values={VALUES} />
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 1 other location - About 1 day to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 200..213

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

    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('type', () => {
        const { container } = render(
          <Grommet>
            <Chart type="bar" values={VALUES} />
            <Chart type="line" values={VALUES} />
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 2 other locations - About 5 hrs to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 281..292
    src/js/components/Meter/__tests__/Meter-test.tsx on lines 99..110

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

    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('undefined values', () => {
        const { container } = render(
          <Grommet>
            <Chart type="bar" values={UNDEFINED_VALUES} />
            <Chart type="line" values={UNDEFINED_VALUES} />
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 2 other locations - About 5 hrs to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 99..110
    src/js/components/Meter/__tests__/Meter-test.tsx on lines 99..110

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

    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 } = render(
          <Grommet>
            <Chart direction="horizontal" type="bar" values={VALUES} />
            <Chart direction="horizontal" type="line" values={VALUES} />
            <Chart direction="horizontal" type="area" values={VALUES} />
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 1 other location - About 4 hrs to fix
    src/js/components/Clock/__tests__/Clock-test.tsx on lines 56..63

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

    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

              values={[
                { value: [7, 100], label: 'one hundred', opacity: true },
                { value: [6, 70], label: 'seventy', opacity: 'medium' },
                { value: [5, 60], label: 'sixty', opacity: 'weak' },
                { value: [4, 80], label: 'eighty', opacity: 'strong' },
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 1 other location - About 4 hrs to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 72..79

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

    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

              values={[
                { value: [7, 100], label: 'one hundred', opacity: true },
                { value: [6, 70], label: 'seventy', opacity: 'medium' },
                { value: [5, 60], label: 'sixty', opacity: 'weak' },
                { value: [4, 80], label: 'eighty', opacity: 'strong' },
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 1 other location - About 4 hrs to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 84..91

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

    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

      test('dash', () => {
        const { container } = render(
          <Grommet>
            <Chart dash values={VALUES} />
          </Grommet>,
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 1 other location - About 2 hrs to fix
    src/js/components/Meter/__tests__/Meter-test.tsx on lines 216..224

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

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

      test('default', () => {
        const { container } = render(
          <Grommet>
            <Chart values={VALUES} />
          </Grommet>,
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 3 other locations - About 1 hr to fix
    src/js/components/Data/__tests__/Data-test.tsx on lines 43..51
    src/js/components/Image/__tests__/Image-test.tsx on lines 28..36
    src/js/components/Meter/__tests__/Meter-test.tsx on lines 31..39

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

    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

      test('calcs xsmall thickness', () => {
        const vals = Array(64).fill([1, 2, 3]);
        const result = calcs(vals);
        expect(result).toMatchSnapshot();
      });
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 4 other locations - About 1 hr to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 315..319
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 321..325
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 327..331
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 339..343

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

      test('calcs small thickness', () => {
        const vals = Array(24).fill([1, 2, 3]);
        const result = calcs(vals);
        expect(result).toMatchSnapshot();
      });
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 4 other locations - About 1 hr to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 315..319
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 321..325
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 333..337
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 339..343

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

      test('calcs medium thickness', () => {
        const vals = Array(14).fill([1, 2, 3]);
        const result = calcs(vals);
        expect(result).toMatchSnapshot();
      });
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 4 other locations - About 1 hr to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 315..319
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 327..331
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 333..337
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 339..343

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

      test('calcs hair thickness', () => {
        const vals = Array(124).fill([1, 2, 3]);
        const result = calcs(vals);
        expect(result).toMatchSnapshot();
      });
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 4 other locations - About 1 hr to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 315..319
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 321..325
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 327..331
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 333..337

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

      test('calcs large thickness', () => {
        const vals = Array(8).fill([1, 2, 3]);
        const result = calcs(vals);
        expect(result).toMatchSnapshot();
      });
    Severity: Major
    Found in src/js/components/Chart/__tests__/Chart-test.tsx and 4 other locations - About 1 hr to fix
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 321..325
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 327..331
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 333..337
    src/js/components/Chart/__tests__/Chart-test.tsx on lines 339..343

    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

    There are no issues that match your filters.

    Category
    Status