grommet/grommet

View on GitHub

Showing 2,061 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

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

    const DATA = [
      {
        key: 1,
        name: 'Ilana',
        location: 'Bay Area',
    Severity: Major
    Found in src/js/components/DataTable/stories/InfiniteScrollDataTable.js and 1 other location - About 5 days to fix
    src/js/components/DataTable/stories/Show.js on lines 59..300

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

    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 DATA = [
      {
        key: 1,
        name: 'Ilana',
        location: 'Bay Area',
    Severity: Major
    Found in src/js/components/DataTable/stories/Show.js and 1 other location - About 5 days to fix
    src/js/components/DataTable/stories/InfiniteScrollDataTable.js on lines 59..300

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

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

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

      return (
        // Uncomment <Grommet> lines when using outside of storybook
        // <Grommet theme={...}>
        <Box align="center" justify="center" pad="large">
          <Box width="medium">
    Severity: Major
    Found in src/js/components/Form/stories/ControlledInputLazy.js and 1 other location - About 5 days to fix
    src/js/components/Form/stories/ControlledInput.js on lines 25..121

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

    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

      return (
        // Uncomment <Grommet> lines when using outside of storybook
        // <Grommet theme={...}>
        <Box align="center" justify="center" pad="large">
          <Box width="medium">
    Severity: Major
    Found in src/js/components/Form/stories/ControlledInput.js and 1 other location - About 5 days to fix
    src/js/components/Form/stories/ControlledInputLazy.js on lines 36..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 870.

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

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

                  <Box align="center" pad="large">
                    <Table caption="Default Table">
                      <TableHeader>
                        <TableRow>
                          {columns.map((c) => (
                Severity: Major
                Found in src/js/components/Table/stories/Default.js and 1 other location - About 2 days to fix
                src/js/components/Table/stories/CustomThemed/Custom.js on lines 51..83

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

                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 align="center" pad="large">
                      <Table caption="Custom Theme Table">
                        <TableHeader>
                          <TableRow>
                            {columns.map((c) => (
                Severity: Major
                Found in src/js/components/Table/stories/CustomThemed/Custom.js and 1 other location - About 2 days to fix
                src/js/components/Table/stories/Default.js on lines 18..50

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

                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 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
                    Severity
                    Category
                    Status
                    Source
                    Language