xylabs/sdk-react

View on GitHub

Showing 148 of 148 total issues

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

  const { experimentName, selectVariant } = useExperiments<ReactNode>('Storybook Test 3', [
    { name: 'a/legacy', weight: 33 },
    { name: 'b/testing', weight: 33 },
    { name: 'c/testing', weight: 33 },
  ])
Severity: Minor
Found in packages/experiments/src/hooks/useExperiments.stories.tsx and 1 other location - About 40 mins to fix
packages/experiments/src/hooks/useExperiments.stories.tsx on lines 8..12

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

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 { Auto, AutoEmpty, Long, LongEmpty, LongLarge, Medium, MediumEmpty, Short, ShortEmpty }
packages/number-status/src/NumberStatus.stories.tsx on lines 78..78

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

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 Template: StoryFn<typeof BreadcrumbsEx> = (args) => (
  <BrowserRouter>
    <BreadcrumbsEx {...args}></BreadcrumbsEx>
  </BrowserRouter>
)
packages/base-page/src/components/BasePage/BasePage.stories.tsx on lines 17..21
packages/quick-tip-button/src/QuickTipButton.stories.tsx on lines 19..23

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

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 Template: StoryFn<typeof QuickTipButton> = (args) => (
  <FlexRow>
    <QuickTipButton {...args}></QuickTipButton>
  </FlexRow>
)
Severity: Major
Found in packages/quick-tip-button/src/QuickTipButton.stories.tsx and 2 other locations - About 40 mins to fix
packages/base-page/src/components/BasePage/BasePage.stories.tsx on lines 17..21
packages/common/src/components/Breadcrumbs/BreadcrumbsEx.stories.tsx on lines 17..21

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

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

  useExperiments<ReactNode>('Storybook Test 2', [
    { name: 'a/legacy', weight: 33 },
    { name: 'b/testing', weight: 33 },
    { name: 'c/testing', weight: 33 },
  ])
Severity: Minor
Found in packages/experiments/src/hooks/useExperiments.stories.tsx and 1 other location - About 40 mins to fix
packages/experiments/src/hooks/useExperiments.stories.tsx on lines 13..17

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

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 { Default, Default6Digits, Default10Digits, Large, Large6Digits, Large10Digits, Small, Small6Digits, Small10Digits }
Severity: Minor
Found in packages/number-status/src/NumberStatus.stories.tsx and 1 other location - About 40 mins to fix
packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 104..104

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

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 Template: StoryFn<typeof BasePage> = (args) => (
  <BrowserRouter>
    <BasePage {...args}></BasePage>
  </BrowserRouter>
)
packages/common/src/components/Breadcrumbs/BreadcrumbsEx.stories.tsx on lines 17..21
packages/quick-tip-button/src/QuickTipButton.stories.tsx on lines 19..23

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

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

  static init(containerId: string) {
    if (!this.instance) {
      this.instance = new Gtm(containerId)
    }
    return this.instance
Severity: Minor
Found in packages/pixel/src/lib/Tracking/Google/Gtm.ts and 1 other location - About 40 mins to fix
packages/pixel/src/lib/Tracking/Facebook/Fbq.ts on lines 30..35

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

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

  static init(pixelId: string) {
    if (!this.instance) {
      this.instance = new Fbq(pixelId)
    }
    return this.instance
Severity: Minor
Found in packages/pixel/src/lib/Tracking/Facebook/Fbq.ts and 1 other location - About 40 mins to fix
packages/pixel/src/lib/Tracking/Google/Gtm.ts on lines 25..30

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

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 calcSpacing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const calcSpacing = (theme: Theme, values: BoxProps['margin'][]) => {
  for (const value of values) {
    if (value !== undefined) {
      if (typeof value === 'string') {
        return value
Severity: Minor
Found in packages/shared/src/calcSpacing.ts - About 35 mins 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 TokenAmount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const TokenAmount: React.FC<TokenAmountProps> = ({
  textFontFamily = '"Source Code Pro",monospace',
  textColor,
  statusColor,
  style,
Severity: Minor
Found in packages/crypto/src/components/TokenAmount/TokenAmount.tsx - About 35 mins 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 getSelectedVariant has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  getSelectedVariant: (name: string) => {
    const outcomes = ExperimentsHelper.loadOutcomes()
    const experiment = ExperimentsHelper.getExperiment(name)
    let total = 0
    if (experiment && outcomes) {
Severity: Minor
Found in packages/experiments/src/lib/ExperimentsHelper.ts - About 35 mins 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

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

      bgcolor={alpha(bgcolor ?? theme.palette.background.default, Number.parseFloat(`${opacity}`))}
Severity: Minor
Found in packages/shared/src/components/BusyLinearProgress.tsx and 1 other location - About 30 mins to fix
packages/shared/src/components/BusyCircularProgress.tsx on lines 16..16

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

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

Avoid too many return statements within this function.
Open

    return 'xl'
Severity: Major
Found in packages/shared/src/hooks/useBreakpoint.ts - About 30 mins to fix

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

    Short.args = {
      address: EthAddress.fromString('0x6792b02f88b32c4fe8e31cfa41ae5af44865f930'),
      addressLength: 'short',
      icon: true,
      title: 'Sample EthAccount',
    packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 25..31
    packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 61..67
    packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 78..84
    packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 95..101
    packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 25..31
    packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 88..94

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

    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

          bgcolor={alpha(bgcolor ?? theme.palette.background.default, Number.parseFloat(`${opacity}`))}
    Severity: Minor
    Found in packages/shared/src/components/BusyCircularProgress.tsx and 1 other location - About 30 mins to fix
    packages/shared/src/components/BusyLinearProgress.tsx on lines 16..16

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

    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

    Avoid too many return statements within this function.
    Open

          return defaultValue
    Severity: Major
    Found in packages/shared/src/hooks/useLocalStorage.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return <OperaEthersLoader>{children}</OperaEthersLoader>
      Severity: Major
      Found in packages/crypto/src/contexts/Ethers/Loader.tsx - About 30 mins to fix

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

        Auto.args = {
          address: EthAddress.fromString('0x6792b02f88b32c4fe8e31cfa41ae5af44865f930'),
          addressLength: 'auto',
          icon: true,
          title: 'Sample EthAccount',
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 25..31
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 61..67
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 78..84
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 95..101
        packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 25..31
        packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 71..77

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

        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 7 locations. Consider refactoring.
        Open

        Auto.args = {
          address: EthAddress.fromString('0x6792b02f88b32c4fe8e31cfa41ae5af44865f930'),
          addressLength: 'auto',
          icon: false,
          title: 'Sample EthAccount',
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 25..31
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 61..67
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 95..101
        packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 25..31
        packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 71..77
        packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 88..94

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

        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

        Severity
        Category
        Status
        Source
        Language