xylabs/sdk-react

View on GitHub

Showing 179 of 179 total issues

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

    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

      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 24..30
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 60..66
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 77..83
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 94..100
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 22..28
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 68..74

      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

      Long.args = {
        address: EthAddress.fromString('0x6792b02f88b32c4fe8e31cfa41ae5af44865f930'),
        addressLength: 'long',
        icon: true,
        title: 'Sample EthAccount',
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 60..66
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 77..83
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 94..100
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 22..28
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 68..74
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 85..91

      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

      AutoIcon.args = {
        address: EthAddress.fromString('0x6792b02f88b32c4fe8e31cfa41ae5af44865f930'),
        addressLength: 'auto',
        icon: true,
        title: 'Sample EthAccount',
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 24..30
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 60..66
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 77..83
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 22..28
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 68..74
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 85..91

      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 24..30
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 60..66
      packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 94..100
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 22..28
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 68..74
      packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 85..91

      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 <InfuraEthersLoader>{children}</InfuraEthersLoader>
      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

        Long.args = {
          address: EthAddress.fromString('0x6792b02f88b32c4fe8e31cfa41ae5af44865f930'),
          addressLength: 'long',
          icon: true,
          title: 'Sample EthAccount',
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 24..30
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 60..66
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 77..83
        packages/crypto/src/components/EthAccount/EthAccountBox.stories.tsx on lines 94..100
        packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 68..74
        packages/crypto/src/components/EthAccount/EthAccountButton.stories.tsx on lines 85..91

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

          Function BusyBox has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            (
              {
                background,
                children,
                busyVariant = 'circular',
          Severity: Minor
          Found in packages/flexbox/src/components/BusyBox/BusyBox.tsx - About 25 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 useMenuItemsShared has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export const useMenuItemsShared = () => {
            const {
              collapse, collapseEnd, setCollapse, setCollapseEnd,
            } = useCollapsible()
          
          
          Severity: Minor
          Found in packages/appbar/src/SiteMenu/hooks/useMenuItemsShared.tsx - About 25 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 CoverProgress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export const CoverProgress: React.FC<CoverProgressProps> = (props) => {
            const {
              paper = true, open, opacity = 0.25, errors, onRetry,
            } = props
            const theme = useTheme()
          Severity: Minor
          Found in packages/common/src/components/CoverProgress.tsx - About 25 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 AppBarExInner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          const AppBarExInner: React.FC<AppBarExProps> = ({
            children, menu, contextToolbar, systemToolbar, responsive, ...props
          }) => {
            const { breakpoints } = useTheme()
            const belowSm = useMediaQuery(breakpoints.down('sm'))
          Severity: Minor
          Found in packages/appbar/src/AppBarEx.tsx - About 25 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 InvertibleCssVarsProvider has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export const InvertibleCssVarsProvider: React.FC<InvertibleMuiThemeProviderProps> = ({
            children,
            defaultMode = 'system',
            noResponsiveFontSizes,
            theme,

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

          export const SimpleAccordion: React.FC<SimpleAccordionCardProps> = ({
            name, linkText, to, href, description, expanded, onChange, children,
          }) => {
            const theme = useTheme()
            const isMobile = useMediaQuery(theme.breakpoints.down('md'))
          Severity: Minor
          Found in packages/accordion/src/AccordionGroup.tsx - About 25 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 asButtonHrefOrToProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export const asButtonHrefOrToProps = (props: ButtonHrefAndToProps): ButtonHrefOrToOrNoProps => {
            if (props.href && (props.to || props.toOptions)) {
              throw new Error('ButtonExProps: cannot have both href and to')
            }
            return props.href ? { href: props.href } : props.to ? { to: props.to, toOptions: props.toOptions } : {}
          Severity: Minor
          Found in packages/button/src/components/ButtonExProps.tsx - About 25 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 asLinkHrefOrToProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export const asLinkHrefOrToProps = (props: LinkHrefAndToProps): LinkHrefOrToOrNoProps => {
            if (props.href && (props.to || props.toOptions)) {
              throw new Error('LinkExProps: cannot have both href and to')
            }
            return props.href ? { href: props.href } : props.to ? { to: props.to, toOptions: props.toOptions } : {}
          Severity: Minor
          Found in packages/link/src/LinkExProps.tsx - About 25 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

          Severity
          Category
          Status
          Source
          Language