grommet/grommet

View on GitHub

Showing 545 of 2,098 total issues

Function CustomSearch has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const CustomSearch = () => {
  const [selectedContentPartners, setSelectedContentPartners] = useState([]);
  const [contentPartners, setContentPartners] = useState(allContentPartners);
  const [searching, setSearching] = useState(false);
  const [searchQuery, setSearchQuery] = useState('');
Severity: Major
Found in src/js/components/Select/stories/CustomThemed/CustomSearch.js - About 5 hrs to fix

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

    import React, {
      useRef,
      forwardRef,
      useCallback,
      useContext,
    Severity: Minor
    Found in src/js/components/Menu/Menu.js - About 5 hrs to fix

      Function visibleValue has 129 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          (i) => {
            const optionValue =
              valueKey && valueKey.reduce ? applyKey(i, valueKey) : i;
            const optionSelected = arrayIncludes(
              value,
      Severity: Major
      Found in src/js/components/SelectMultiple/SelectMultipleValue.js - About 5 hrs to fix

        Function Form has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

          (
            {
              children,
              errors: errorsProp = defaultValidationResults.errors,
              infos: infosProp = defaultValidationResults.infos,
        Severity: Minor
        Found in src/js/components/Form/Form.js - About 5 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

        Function Carousel has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

        const Carousel = ({
          activeChild,
          initialChild,
          onChild,
          play,
        Severity: Minor
        Found in src/js/components/Carousel/Carousel.js - About 5 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

        Function Sticky has 125 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Sticky = () => {
          const [open, setOpen] = useState(false);
          const onOpen = () => setOpen(true);
          const onClose = () => setOpen(undefined);
        
        
        Severity: Major
        Found in src/js/components/Header/stories/Sticky.js - About 5 hrs to fix

          Function roundStyle has 124 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const roundStyle = (data, responsive, theme) => {
            const breakpoint = getBreakpointStyle(theme, theme.box.responsiveBreakpoint);
            const styles = [];
            if (typeof data === 'object') {
              const size =
          Severity: Major
          Found in src/js/utils/styles.js - About 4 hrs to fix

            Function gapGapStyle has 120 lines of code (exceeds 25 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: Major
            Found in src/js/components/Box/StyledBox.js - About 4 hrs to fix

              File Box-layout-test.tsx has 366 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import { render } from '@testing-library/react';
              import 'jest-styled-components';
              
              import { Grommet } from '../../Grommet';
              Severity: Minor
              Found in src/js/components/Box/__tests__/Box-layout-test.tsx - About 4 hrs to fix

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

                import React from 'react';
                import { render, act } from '@testing-library/react';
                import 'jest-styled-components';
                
                import { Grommet, Image, Box, InfiniteScrollProps } from '../..';
                Severity: Minor
                Found in src/js/components/InfiniteScroll/__tests__/InfiniteScroll-test.tsx - About 4 hrs to fix

                  Function place has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        const place = (preserveHeight) => {
                          const windowWidth = window.innerWidth;
                          const windowHeight = window.innerHeight;
                          const container = dropRef.current;
                          if (container && target) {
                  Severity: Major
                  Found in src/js/components/Drop/DropContainer.js - About 4 hrs to fix

                    Function ArrayOfFormFields has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const ArrayOfFormFields = () => {
                      const [values, setValues] = useState({
                        name: '',
                        phones: [{ number: '', ext: '' }],
                      });
                    Severity: Major
                    Found in src/js/components/Form/stories/ArrayOfFormFields.js - About 4 hrs to fix

                      File RangeSelector.js has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        File Accordion-test.tsx has 358 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: Minor
                        Found in src/js/components/Accordion/__tests__/Accordion-test.tsx - About 4 hrs to fix

                          Function kindPartStyles has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const kindPartStyles = (obj, theme, colorValue) => {
                            const styles = [];
                            if (obj.padding || obj.pad) {
                              // button uses `padding` but other components use Grommet `pad`
                              const pad = obj.padding || obj.pad;
                          Severity: Minor
                          Found in src/js/utils/styles.js - About 4 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

                          Function gapStyle has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const gapStyle = (directionProp, gap, responsive, wrap, 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 4 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 Tabs.js has 354 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, {
                            forwardRef,
                            useCallback,
                            useContext,
                            useState,
                          Severity: Minor
                          Found in src/js/components/Tabs/Tabs.js - About 4 hrs to fix

                            Function SpaceX has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const SpaceX = () => {
                              const [groups, setGroups] = useState([]);
                              const [expanded, setExpanded] = useState([]);
                              const [sort, setSort] = useState({ property: 'name', direction: 'asc' });
                              const [data, setData] = useState([]);
                            Severity: Major
                            Found in src/js/components/DataTable/stories/SpaceX.js - About 4 hrs to fix

                              Function Header has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                              Open

                                (
                                  {
                                    allowSelectAll,
                                    cellProps,
                                    columns,
                              Severity: Minor
                              Found in src/js/components/DataTable/Header.js - About 4 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

                              Function Notification has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const Notification = ({
                                actions: actionsProp,
                                message: messageProp,
                                onClose,
                                id,
                              Severity: Minor
                              Found in src/js/components/Notification/Notification.js - About 4 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

                              Severity
                              Category
                              Status
                              Source
                              Language