synapsecns/sanguine

View on GitHub
packages/explorer-ui/components/tailwind/Grid.tsx

Summary

Maintainability
F
4 days
Test Coverage

Function Grid has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

export const Grid = ({
  children,
  cols,
  gap,
  gapX,
Severity: Minor
Found in packages/explorer-ui/components/tailwind/Grid.tsx - 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 Grid.tsx has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
@NOTE: super repetitive code here is actually necessary...
*/

const GRID_COLS_LOOKUP = {
Severity: Minor
Found in packages/explorer-ui/components/tailwind/Grid.tsx - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

      if (!((gap ?? false) || (gapX ?? false) || (gapY ?? false))) {
        novelClassName += GAP_LOOKUP[0]
      }
    Severity: Major
    Found in packages/explorer-ui/components/tailwind/Grid.tsx - About 40 mins to fix

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

      const SIZE_GAP_LOOKUP = {
        xs: {
          0: 'gap-0 ',
          1: 'gap-1 ',
          2: 'gap-2 ',
      Severity: Major
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 1 other location - About 1 day to fix
      packages/synapse-interface/components/ui/tailwind/Grid.tsx on lines 113..174

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

      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

      const LG_GRID_COLS_LOOKUP = {
        0: 'lg:grid-cols-0 ',
        1: 'lg:grid-cols-1 ',
        2: 'lg:grid-cols-2 ',
        3: 'lg:grid-cols-3 ',
      Severity: Major
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 3 other locations - About 2 hrs to fix
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 22..37
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 39..54
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 73..88

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

      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

      const XL_GRID_COLS_LOOKUP = {
        0: 'xl:grid-cols-0 ',
        1: 'xl:grid-cols-1 ',
        2: 'xl:grid-cols-2 ',
        3: 'xl:grid-cols-3 ',
      Severity: Major
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 3 other locations - About 2 hrs to fix
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 22..37
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 39..54
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 56..71

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

      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

      const MD_GRID_COLS_LOOKUP = {
        0: 'md:grid-cols-0 ',
        1: 'md:grid-cols-1 ',
        2: 'md:grid-cols-2 ',
        3: 'md:grid-cols-3 ',
      Severity: Major
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 3 other locations - About 2 hrs to fix
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 22..37
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 56..71
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 73..88

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

      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

      const SM_GRID_COLS_LOOKUP = {
        0: 'sm:grid-cols-0 ',
        1: 'sm:grid-cols-1 ',
        2: 'sm:grid-cols-2 ',
        3: 'sm:grid-cols-3 ',
      Severity: Major
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 3 other locations - About 2 hrs to fix
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 39..54
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 56..71
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 73..88

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

      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 GAP_Y_LOOKUP = {
        0: 'gap-y-0 ',
        1: 'gap-y-1 ',
        2: 'gap-y-2 ',
        3: 'gap-y-3 ',
      Severity: Major
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 2 other locations - About 1 hr to fix
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 90..104
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 169..183

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

      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 GAP_X_LOOKUP = {
        0: 'gap-x-0 ',
        1: 'gap-x-1 ',
        2: 'gap-x-2 ',
        3: 'gap-x-3 ',
      Severity: Major
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 2 other locations - About 1 hr to fix
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 90..104
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 185..199

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

      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 GAP_LOOKUP = {
        0: 'gap-0 ',
        1: 'gap-1 ',
        2: 'gap-2 ',
        3: 'gap-3 ',
      Severity: Major
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 2 other locations - About 1 hr to fix
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 169..183
      packages/explorer-ui/components/tailwind/Grid.tsx on lines 185..199

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

      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

      export const Grid = ({
        children,
        cols,
        gap,
        gapX,
      Severity: Minor
      Found in packages/explorer-ui/components/tailwind/Grid.tsx and 1 other location - About 35 mins to fix
      packages/explorer-ui/components/ContainerCard.tsx on lines 13..44

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

      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

      There are no issues that match your filters.

      Category
      Status