grommet/grommet

View on GitHub

Showing 545 of 2,098 total issues

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

      File DataTable.js has 536 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        Function edgeStyle has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
        Open

        export const edgeStyle = (
          kind,
          data,
          responsive,
          responsiveBreakpoint,
        Severity: Minor
        Found in src/js/utils/styles.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

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

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

          File FileInput.js has 523 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { forwardRef, useContext, useRef, useState } from 'react';
          import styled, { ThemeContext } from 'styled-components';
          import { CircleAlert } from 'grommet-icons/icons/CircleAlert';
          import { MessageContext } from '../../contexts/MessageContext';
          
          
          Severity: Major
          Found in src/js/components/FileInput/FileInput.js - About 1 day to fix

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

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

              File SelectMultiple.js has 520 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                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

                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

                    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

                      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

                          Function SelectionSummary has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const SelectionSummary = ({
                            allOptions,
                            clearRef,
                            disabled,
                            disabledKey,
                          Severity: Minor
                          Found in src/js/components/SelectMultiple/SelectionSummary.js - About 7 hrs 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

                          File SelectContainer.js has 470 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

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

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

                            import React, { useState } from 'react';
                            import 'jest-styled-components';
                            import 'jest-axe/extend-expect';
                            import 'regenerator-runtime/runtime';
                            import 'jest-styled-components';
                            Severity: Minor
                            Found in src/js/components/Pagination/__tests__/Pagination-test.tsx - About 7 hrs to fix

                              Function gapGapStyle has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const gapGapStyle = (directionProp, gap, responsive, border, theme) => {
                                const metric = theme.global.edgeSize[gap] || gap;
                                const breakpoint = getBreakpointStyle(theme, theme.box.responsiveBreakpoint);
                                const responsiveMetric = responsive && breakpoint && breakpoint.edgeSize[gap];
                              
                              
                              Severity: Minor
                              Found in src/js/components/Box/StyledBox.js - About 7 hrs 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

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

                              import React from 'react';
                              import 'jest-styled-components';
                              import { render, fireEvent } from '@testing-library/react';
                              import { getByTestId, queryByTestId } from '@testing-library/dom';
                              import 'regenerator-runtime/runtime';
                              Severity: Minor
                              Found in src/js/components/Layer/__tests__/Layer-test.js - About 7 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language