grommet/grommet

View on GitHub

Showing 2,098 of 2,098 total issues

File Video.js has 562 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, {
  forwardRef,
  useCallback,
  useContext,
  useEffect,
Severity: Major
Found in src/js/components/Video/Video.js - About 1 day to fix

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

    const DATA = [
      {
        name: 'Alan Josiah Werner Shirleen Foy',
        location: 'Winston Salem',
        date: '2018-01-09',
    Severity: Major
    Found in src/js/components/DataTable/stories/ColumnSize.js and 2 other locations - About 1 day to fix
    src/js/components/DataTable/stories/AllowSelectAll.js on lines 6..63
    src/js/components/DataTable/stories/data.js on lines 75..132

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

    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

    export const DATA = [
      {
        name: 'Alan',
        location: '',
        date: '',
    Severity: Major
    Found in src/js/components/DataTable/stories/data.js and 2 other locations - About 1 day to fix
    src/js/components/DataTable/stories/AllowSelectAll.js on lines 6..63
    src/js/components/DataTable/stories/ColumnSize.js on lines 5..62

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

    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

    const DATA = [
      {
        name: 'Alan Josiah Werner Shirleen Foy',
        location: 'Winston Salem',
        date: '2018-01-09',
    Severity: Major
    Found in src/js/components/DataTable/stories/AllowSelectAll.js and 2 other locations - About 1 day to fix
    src/js/components/DataTable/stories/ColumnSize.js on lines 5..62
    src/js/components/DataTable/stories/data.js on lines 75..132

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

    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 DateInput has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

      (
        {
          buttonProps, // when no format and not inline
          calendarProps,
          defaultValue,
    Severity: Minor
    Found in src/js/components/DateInput/DateInput.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

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

    const OnMoreInfiniteScroll: React.FC<IProps> = ({ props }) => {
      const [items, setItems] = useState(allItems.slice(0, 50));
    
      const onMore = () => {
        setTimeout(() => {
    src/js/components/InfiniteScroll/stories/typescript/OnMore.tsx on lines 18..46

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

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

    const OnMoreInfiniteScroll: React.FC<IProps> = ({ props }) => {
      const [items, setItems] = useState(allItems.slice(0, 50));
    
      const onMore = () => {
        setTimeout(() => {
    src/js/components/InfiniteScroll/stories/typescript/OnMoreStep.tsx on lines 18..46

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

    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

      'top-right': {
        vertical: (bounds) => css`
          top: ${bounds.top}px;
          bottom: ${bounds.bottom}px;
          right: ${bounds.right}px;
    Severity: Major
    Found in src/js/components/Layer/StyledLayer.js and 1 other location - About 1 day to fix
    src/js/components/Layer/StyledLayer.js on lines 527..556

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

    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

      'top-left': {
        vertical: (bounds) => css`
          top: ${bounds.top}px;
          bottom: ${bounds.bottom}px;
          left: ${bounds.left}px;
    Severity: Major
    Found in src/js/components/Layer/StyledLayer.js and 1 other location - About 1 day to fix
    src/js/components/Layer/StyledLayer.js on lines 496..525

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

    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

                      <Keyboard
                        onSpace={(event) => {
                          event.preventDefault();
                          if (controlRef.current === event.target)
                            inputRef.current.click();
    Severity: Major
    Found in src/js/components/FileInput/FileInput.js and 1 other location - About 1 day to fix
    src/js/components/FileInput/FileInput.js on lines 406..448

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

    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

                    <Keyboard
                      onSpace={(event) => {
                        if (controlRef.current === event.target)
                          inputRef.current.click();
                      }}
    Severity: Major
    Found in src/js/components/FileInput/FileInput.js and 1 other location - About 1 day to fix
    src/js/components/FileInput/FileInput.js on lines 332..375

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

    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

          <Carousel wrap height="medium" width="medium">
            <Box fill align="center" justify="center" background="light-1">
              <Attraction size="xlarge" />
            </Box>
            <Box fill align="center" justify="center" background="black">
    Severity: Major
    Found in src/js/components/Carousel/stories/ControlVariations.js and 2 other locations - About 1 day to fix
    src/js/components/Carousel/stories/ControlVariations.js on lines 40..61
    src/js/components/Carousel/stories/ControlVariations.js on lines 65..86

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

    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

          <Carousel
            height="medium"
            width="medium"
            initialChild={2}
            controls="selectors"
    Severity: Major
    Found in src/js/components/Carousel/stories/ControlVariations.js and 2 other locations - About 1 day to fix
    src/js/components/Carousel/stories/ControlVariations.js on lines 20..36
    src/js/components/Carousel/stories/ControlVariations.js on lines 65..86

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

    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

          <Carousel
            height="medium"
            width="medium"
            controls="arrows"
            initialChild={3}
    Severity: Major
    Found in src/js/components/Carousel/stories/ControlVariations.js and 2 other locations - About 1 day to fix
    src/js/components/Carousel/stories/ControlVariations.js on lines 20..36
    src/js/components/Carousel/stories/ControlVariations.js on lines 40..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 217.

    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 TextInput has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

      (
        {
          a11yTitle,
          defaultSuggestion,
          defaultValue,
    Severity: Minor
    Found in src/js/components/TextInput/TextInput.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

    Function Components has 226 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Components = () => {
      const [checkBox, setCheckBox] = useState(true);
      const [textInput, setTextInput] = useState('');
      const [maskedInput, setMaskedInput] = useState('');
      const [radioButton, setRadioButton] = useState('RadioButton 1');
    Severity: Major
    Found in src/js/all/stories/AllComponents.js - About 1 day to fix

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

      import React from 'react';
      import { fireEvent, render, screen } from '@testing-library/react';
      import { getByText as getByTextDOM } from '@testing-library/dom';
      import { axe } from 'jest-axe';
      
      
      Severity: Major
      Found in src/js/components/Menu/__tests__/Menu-test.js - About 1 day to fix

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

          left: {
            vertical: (bounds) => css`
              top: ${bounds.top}px;
              bottom: ${bounds.bottom}px;
              left: ${bounds.left}px;
        Severity: Major
        Found in src/js/components/Layer/StyledLayer.js and 3 other locations - About 1 day to fix
        src/js/components/Layer/StyledLayer.js on lines 403..432
        src/js/components/Layer/StyledLayer.js on lines 434..463
        src/js/components/Layer/StyledLayer.js on lines 465..494

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

        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

          start: {
            vertical: (bounds) => css`
              top: ${bounds.top}px;
              bottom: ${bounds.bottom}px;
              inset-inline-start: ${bounds.start}px;
        Severity: Major
        Found in src/js/components/Layer/StyledLayer.js and 3 other locations - About 1 day to fix
        src/js/components/Layer/StyledLayer.js on lines 372..401
        src/js/components/Layer/StyledLayer.js on lines 403..432
        src/js/components/Layer/StyledLayer.js on lines 465..494

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

        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

          top: {
            vertical: (bounds) => css`
              top: ${bounds.top}px;
              bottom: ${bounds.bottom}px;
              left: 50%;
        Severity: Major
        Found in src/js/components/Layer/StyledLayer.js and 1 other location - About 1 day to fix
        src/js/components/Layer/StyledLayer.js on lines 341..370

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

        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