XYOracleNetwork/sdk-xyo-react-js

View on GitHub

Showing 476 of 476 total issues

Function useWeakModuleFromNode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const useWeakModuleFromNode = <T extends ModuleInstance | void = void>(
  nameOrAddressOrInstance: string | (T extends ModuleInstance ? T : ModuleInstance) | undefined = undefined,
  config?: WeakModuleFromNodeConfig,
): [WeakRef<T extends ModuleInstance ? T : ModuleInstance> | undefined, Error | undefined] => {
  const [node, nodeError] = useWeakNode(config)
Severity: Minor
Found in packages/modules/packages/node/src/hooks/useWeakModuleFromNode.ts - About 1 hr to fix

    Function CreditCardFormFlexbox has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    export const CreditCardFormFlexbox: React.FC<CreditCardFormProps> = ({
      ConfirmationButton,
      displayErrors,
      onErrorDuringSubmit,
      onInvalidSubmit,

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

    const NetworkRouteProviderInner: React.FC<PropsWithChildren> = ({ children }) => {
      const { network, setNetwork } = useNetwork()
    
      const [params, setParams] = useSearchParams()
    
    
    Severity: Minor
    Found in packages/sdk/packages/network/src/contexts/Provider/Route.tsx - About 1 hr 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 AccessCodeGateFlexbox has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    export const AccessCodeGateFlexbox: React.FC<AccessCodeGateFlexbox> = ({
      children,
      onCodeInputChange,
      onAccessCodeSuccess,
      successRedirectDelay = 1500,

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

          <Tab component={Paper} elevation={value === 0 ? 3 : 0} {...tabProps} label={`Payloads - ${payloadCount}`} icon={<VscSymbolNamespace />} />
    packages/plugins/packages/boundwitness/src/components/Details/Card/Navigation/NavigationTabs.tsx on lines 44..50
    packages/plugins/packages/boundwitness/src/components/Details/Card/Navigation/NavigationTabs.tsx on lines 51..51

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

    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 useModuleFromNode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useModuleFromNode = <T extends ModuleInstance | void = void>(
      nameOrAddressOrInstance: string | (T extends ModuleInstance ? T : ModuleInstance) | undefined = undefined,
      config?: T extends ModuleInstance ? ModuleFromNodeConfig<T> : ModuleFromNodeConfig | undefined,
    ): [(T extends ModuleInstance ? T : ModuleInstance) | undefined, Error | undefined] => {
      const [node, nodeError] = useNode(config)
    Severity: Minor
    Found in packages/modules/packages/node/src/hooks/useModuleFromNode.ts - About 1 hr to fix

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

            <Tab
              component={Paper}
              elevation={value === 1 ? 3 : 0}
              {...tabProps}
              label={`Bound Witnesses - ${boundWitnessCount}`}
      packages/plugins/packages/boundwitness/src/components/Details/Card/Navigation/NavigationTabs.tsx on lines 43..43
      packages/plugins/packages/boundwitness/src/components/Details/Card/Navigation/NavigationTabs.tsx on lines 51..51

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

      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

            <Tab component={Paper} elevation={value === 2 ? 3 : 0} {...tabProps} label={`Signatures - ${signers}`} icon={<FaSignature />} />
      packages/plugins/packages/boundwitness/src/components/Details/Card/Navigation/NavigationTabs.tsx on lines 43..43
      packages/plugins/packages/boundwitness/src/components/Details/Card/Navigation/NavigationTabs.tsx on lines 44..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 63.

      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 SeedPhraseIconButton has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const SeedPhraseIconButton: React.FC<IconButtonProps> = (props) => {
        const [open, setOpen] = useState(false)
        const onClose = () => setOpen(false)
        return (
          <>

        Function getEtherscanTransformer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const getEtherscanTransformer = (payload?: EthereumGasEtherscanPayload): GasPriceWitnessUIBasePayload | undefined => {
          if (payload) {
            return {
              baseFee: {
                label: 'suggestBaseFee',

          Function useTryDiviners has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const useTryDiviners = <T extends Payload = Payload>(config?: IndexedResultsConfig): (() => Promise<Payload[] | undefined | null>) => {
            const [node] = useProvidedNode()
            const { indexedQueries, processIndexedResults } = config ?? {}
            const parseIndexedResults = processIndexedResults?.parseIndexedResults
          
          

            Function parsePadding has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const parsePadding = (padding: string) => {
              const parts = padding.split(' ')
              switch (parts.length) {
                case 4: {
                  return {
            Severity: Minor
            Found in packages/sdk/packages/shared/src/lib/getActualPaddingX.ts - About 1 hr to fix

              Function useCustomEvent has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const useCustomEvent = <TElement extends HTMLElement, TDetail = unknown>(
                type: string,
                listener?: CustomEventDispatch<TDetail>,
                customRef?: RefObject<TElement>,
              ): [RefObject<TElement>, CustomEventDispatch<TDetail>] => {
              Severity: Minor
              Found in packages/sdk/packages/event/src/hooks/useCustomEvent.ts - About 1 hr to fix

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

                      <Button
                        title="Save Favorite"
                        variant="contained"
                        onClick={(e) => {
                          e.stopPropagation()
                packages/sdk/packages/address/packages/render/src/components/favorite/PopperButtonGroup.tsx on lines 29..38

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

                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

                        setPayloads([...payloads.values()].map(value => (value.status === 'rejected' ? null : value.value)) as (T | null)[])
                packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts on lines 86..86

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

                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

                  const handleBackButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
                    paginationDispatch('previousPage', 'click', (page - 1)?.toString())
                    onPageChange(event, page - 1)
                  }
                packages/sdk/packages/payload/packages/table/src/components/Table/TablePagination.tsx on lines 37..40

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

                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 Pipe: React.FC<TypographyProps> = (props) => {
                  return (
                    <Typography marginX={1} component="span" {...props}>
                      |
                    </Typography>
                Severity: Major
                Found in packages/sdk/packages/shared/src/components/Pipe.tsx and 1 other location - About 1 hr to fix
                packages/sdk/packages/shared/src/components/Ampersand.tsx on lines 5..11

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

                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 ElevationQuadkeyMapRenderer: React.FC<ElevationQuadkeyMapInnerProps> = ({ ...props }) => {
                  return (
                    <WithProviders>
                      <ElevationQuadkeyMapInner {...props} />
                    </WithProviders>
                packages/plugins/packages/location-heatmap-quadkey/src/components/QuadkeyHeatMapRenderer.tsx on lines 80..86

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

                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

                          setPayloads([...payloads.values()].map(value => (value.status === 'rejected' ? null : value.value)) as (T | null)[])
                packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts on lines 79..79

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

                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 Ampersand: React.FC<TypographyProps> = (props) => {
                  return (
                    <Typography marginX={1} component="span" {...props}>
                      &amp;
                    </Typography>
                Severity: Major
                Found in packages/sdk/packages/shared/src/components/Ampersand.tsx and 1 other location - About 1 hr to fix
                packages/sdk/packages/shared/src/components/Pipe.tsx on lines 5..11

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

                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