grommet/grommet

View on GitHub

Showing 540 of 2,061 total issues

Function generate has 1391 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const generate = (baseSpacing = 24, scale = 6) => {
  // 24
  const baseFontSize = baseSpacing * 0.75; // 18
  const fontScale = baseSpacing / scale; // 4

Severity: Major
Found in src/js/themes/base.js - About 6 days to fix

    Function DataChart has a Cognitive Complexity of 265 (exceeds 5 allowed). Consider refactoring.
    Open

      (
        {
          a11yTitle,
          axis: axisProp = true,
          bounds: boundsProp = 'align',
    Severity: Minor
    Found in src/js/components/DataChart/DataChart.js - About 5 days 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 DataTable-test.tsx has 1652 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import 'jest-styled-components';
    import { render, fireEvent, screen } from '@testing-library/react';
    
    import { Grommet } from '../../Grommet';
    Severity: Major
    Found in src/js/components/DataTable/__tests__/DataTable-test.tsx - About 4 days to fix

      File base.js has 1516 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Actions } from 'grommet-icons/icons/Actions';
      import { AssistListening } from 'grommet-icons/icons/AssistListening';
      import { CircleInformation } from 'grommet-icons/icons/CircleInformation';
      import { ClosedCaption } from 'grommet-icons/icons/ClosedCaption';
      import { Expand } from 'grommet-icons/icons/Expand';
      Severity: Major
      Found in src/js/themes/base.js - About 4 days to fix

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

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

          File Form-test-uncontrolled.js has 1421 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          
          import 'jest-styled-components';
          import 'jest-axe/extend-expect';
          import 'regenerator-runtime/runtime';
          Severity: Major
          Found in src/js/components/Form/__tests__/Form-test-uncontrolled.js - About 3 days to fix

            File Form-test-controlled.js has 1212 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { useState } from 'react';
            import userEvent from '@testing-library/user-event';
            
            import 'jest-styled-components';
            
            
            Severity: Major
            Found in src/js/components/Form/__tests__/Form-test-controlled.js - About 3 days to fix

              Function Button has a Cognitive Complexity of 143 (exceeds 5 allowed). Consider refactoring.
              Open

                (
                  {
                    active,
                    align = 'center',
                    'aria-label': ariaLabel,
              Severity: Minor
              Found in src/js/components/Button/Button.js - About 2 days 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 DateInput-test.tsx has 1070 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                Function Chart has a Cognitive Complexity of 123 (exceeds 5 allowed). Consider refactoring.
                Open

                  (
                    {
                      a11yTitle,
                      bounds: boundsProp,
                      color,
                Severity: Minor
                Found in src/js/components/Chart/Chart.js - About 2 days 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 DataTable has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
                Open

                const DataTable = ({
                  allowSelectAll = true,
                  background,
                  border,
                  columns: columnsProp,
                Severity: Minor
                Found in src/js/components/DataTable/DataTable.js - About 2 days 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 FormField has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
                Open

                  (
                    {
                      children,
                      className,
                      component,
                Severity: Minor
                Found in src/js/components/FormField/FormField.js - About 2 days 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 Calendar.js has 830 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  File List-test.js has 828 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 '@testing-library/jest-dom';
                  Severity: Major
                  Found in src/js/components/List/__tests__/List-test.js - About 1 day to fix

                    File styles.js has 800 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { css } from 'styled-components';
                    import { backgroundStyle } from './background';
                    import { normalizeColor } from './colors';
                    import { getBreakpointStyle } from './responsive';
                    import { breakpointStyle, parseMetricToNum } from './mixins';
                    Severity: Major
                    Found in src/js/utils/styles.js - About 1 day to fix

                      Function SelectContainer has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
                      Open

                        (
                          {
                            clear,
                            children = null,
                            disabled,
                      Severity: Minor
                      Found in src/js/components/Select/SelectContainer.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-kind-test.js has 781 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React from 'react';
                      
                      import 'jest-styled-components';
                      import 'jest-axe/extend-expect';
                      import 'regenerator-runtime/runtime';
                      Severity: Major
                      Found in src/js/components/Button/__tests__/Button-kind-test.js - About 1 day to fix

                        Function Calendar has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
                        Open

                          (
                            {
                              activeDate: activeDateProp,
                              animate = true,
                              bounds: boundsProp,
                        Severity: Minor
                        Found in src/js/components/Calendar/Calendar.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 StyledLayer.js has 754 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import styled, { css, keyframes } from 'styled-components';
                        
                        import {
                          baseStyle,
                          backgroundStyle,
                        Severity: Major
                        Found in src/js/components/Layer/StyledLayer.js - About 1 day to fix

                          Function Menu has 345 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const Menu = forwardRef((props, ref) => {
                            const {
                              a11yTitle,
                              'aria-label': ariaLabel,
                              children,
                          Severity: Major
                          Found in src/js/components/Menu/Menu.js - About 1 day to fix
                            Severity
                            Category
                            Status
                            Source
                            Language