grommet/grommet

View on GitHub

Showing 2,098 of 2,098 total issues

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

  test('type format inline short without timezone', () => {
    const onChange = jest.fn((event) => event.value);
    const { asFragment, getByPlaceholderText } = render(
      <Grommet>
        <DateInput
Severity: Major
Found in src/js/components/DateInput/__tests__/DateInput-test.tsx and 1 other location - About 1 day to fix
src/js/components/DateInput/__tests__/DateInput-test.tsx on lines 607..629

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

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('drop', () => {
    jest.useFakeTimers();

    const { container, getByRole } = render(
      <Grommet>
Severity: Major
Found in src/js/components/DataSearch/__tests__/DataSearch-test.tsx and 1 other location - About 1 day to fix
src/js/components/DataSort/__tests__/DataSort-test.tsx on lines 37..57

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

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('drop', () => {
    jest.useFakeTimers();

    const { container, getByRole } = render(
      <Grommet>
Severity: Major
Found in src/js/components/DataSort/__tests__/DataSort-test.tsx and 1 other location - About 1 day to fix
src/js/components/DataSearch/__tests__/DataSearch-test.tsx on lines 41..61

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

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

Function Tab has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

  (
    {
      active: activeProp, // don't pass with rest
      disabled,
      children,
Severity: Minor
Found in src/js/components/Tab/Tab.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  {
    property: 'success',
    header: 'Success',
    size: 'xsmall',
    render: (datum) => {
Severity: Major
Found in src/js/components/DataTable/stories/SpaceX.js and 1 other location - About 1 day to fix
src/js/components/DataTable/stories/SpaceXUngrouped.js on lines 18..49

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

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

  {
    property: 'success',
    header: 'Success',
    size: 'xsmall',
    render: (datum) => {
Severity: Major
Found in src/js/components/DataTable/stories/SpaceXUngrouped.js and 1 other location - About 1 day to fix
src/js/components/DataTable/stories/SpaceX.js on lines 17..48

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

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

File FormField.js has 501 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, {
  Children,
  cloneElement,
  forwardRef,
  useContext,
Severity: Major
Found in src/js/components/FormField/FormField.js - About 1 day to fix

    File Button.js has 492 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, {
      cloneElement,
      Children,
      forwardRef,
      useContext,
    Severity: Minor
    Found in src/js/components/Button/Button.js - About 7 hrs to fix

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

        test('close on tab', () => {
          const { getByLabelText, container } = render(
            <Grommet>
              <Menu
                id="test-menu"
      Severity: Major
      Found in src/js/components/Menu/__tests__/Menu-test.js and 1 other location - About 7 hrs to fix
      src/js/components/Menu/__tests__/Menu-test.js on lines 365..389

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

      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('checks that the "X characters over limit" message appears.', async () => {
          render(
            <Grommet>
              <Form validate="change">
                <FormField
      Severity: Major
      Found in src/js/components/FormField/__tests__/FormField-test.js and 1 other location - About 7 hrs to fix
      src/js/components/FormField/__tests__/FormField-test.js on lines 504..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 190.

      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('checks that the "X characters left" message appears', async () => {
          render(
            <Grommet>
              <Form validate="change">
                <FormField
      Severity: Major
      Found in src/js/components/FormField/__tests__/FormField-test.js and 1 other location - About 7 hrs to fix
      src/js/components/FormField/__tests__/FormField-test.js on lines 535..563

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

      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('open on down close on esc', () => {
          const { getByLabelText, container } = render(
            <Grommet>
              <Menu
                id="test-menu"
      Severity: Major
      Found in src/js/components/Menu/__tests__/Menu-test.js and 1 other location - About 7 hrs to fix
      src/js/components/Menu/__tests__/Menu-test.js on lines 420..444

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

      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

      File TextInput.js has 488 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, {
        forwardRef,
        useCallback,
        useContext,
        useEffect,
      Severity: Minor
      Found in src/js/components/TextInput/TextInput.js - About 7 hrs to fix

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

        const buildQuery = (view) => {
          const query = {};
          const properties = view?.properties || [];
          Object.keys(properties).forEach((property) => {
            switch (property) {
        Severity: Major
        Found in src/js/components/Data/stories/SpaceX.js and 2 other locations - About 7 hrs to fix
        src/js/components/Data/stories/Infinite.js on lines 7..28
        src/js/components/Data/stories/OnSelect.js on lines 7..28

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

        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

        const buildQuery = (view) => {
          const query = {};
          const properties = view?.properties || [];
          Object.keys(properties).forEach((property) => {
            switch (property) {
        Severity: Major
        Found in src/js/components/Data/stories/Infinite.js and 2 other locations - About 7 hrs to fix
        src/js/components/Data/stories/OnSelect.js on lines 7..28
        src/js/components/Data/stories/SpaceX.js on lines 7..28

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

        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

        const buildQuery = (view) => {
          const query = {};
          const properties = view?.properties || [];
          Object.keys(properties).forEach((property) => {
            switch (property) {
        Severity: Major
        Found in src/js/components/Data/stories/OnSelect.js and 2 other locations - About 7 hrs to fix
        src/js/components/Data/stories/Infinite.js on lines 7..28
        src/js/components/Data/stories/SpaceX.js on lines 7..28

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

        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

        File MaskedInput-test.js has 483 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from 'react';
        import 'core-js/stable';
        import 'regenerator-runtime/runtime';
        import 'jest-styled-components';
        import { fireEvent, render, waitFor } from '@testing-library/react';
        Severity: Minor
        Found in src/js/components/MaskedInput/__tests__/MaskedInput-test.js - About 7 hrs to fix

          Function FormatInline has 188 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const FormatInline = () => {
            const [date, setDate] = useState();
            const [emptyDate, setEmptyDate] = useState();
            const [dateRange, setDateRange] = useState();
            const [dateNoTZ, setDateNoTZ] = useState();
          Severity: Major
          Found in src/js/components/DateInput/stories/FormatInline.js - About 7 hrs to fix

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

                      <Box fill justify="between">
                        <Box border="top" align="start">
                          <Box
                            pad="xsmall"
                            background={{ color: 'white', opacity: 'medium' }}
            Severity: Major
            Found in src/js/components/Chart/stories/Zoom.js and 1 other location - About 7 hrs to fix
            src/js/components/Chart/stories/Scan.js on lines 32..49

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

            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 flex justify="between">
                        <Box border="top" align="end">
                          <Box
                            pad="xsmall"
                            background={{ color: 'white', opacity: 'medium' }}
            Severity: Major
            Found in src/js/components/Chart/stories/Scan.js and 1 other location - About 7 hrs to fix
            src/js/components/Chart/stories/Zoom.js on lines 84..101

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

            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

            Severity
            Category
            Status
            Source
            Language