XYOracleNetwork/sdk-xyo-react-js

View on GitHub

Showing 124 of 486 total issues

Function useDivinePayloads has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const useDivinePayloads = <T extends Payload = Payload>(
  huriList: string[],
): [(T | null)[] | undefined, Dispatch<(T | null)[] | undefined>, Error[] | undefined] => {
  const { diviner } = usePayloadDiviner()
  const [payloads, setPayloads] = useState<(T | null)[]>()

    Function useBoundWitnessClickHandler has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useBoundWitnessClickHandler = () => {
      const mounted = useMounted()
      const {
        hashSelectionHistory, fetchFromHash, addSelection, clearHistory,
      } = usePayloadHashSelectionHistory(false)

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

      export const buildTypeString: TypeBuilder = (type: SomeType | Type, reflectionViewer: React.FC<ReflectionViewerProps>): ReactNode => {
        const someType = type as SomeType
        const parts: string[] = []
      
        switch (someType.type) {

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

          const NetworkRouteProviderInner: React.FC<WithChildren> = ({ 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 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 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

          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

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

                      Function getEtherchainV2Transformer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const getEtherchainV2Transformer = (payload?: EthereumGasEtherchainV2Payload): GasPriceWitnessUIBasePayload | undefined => {
                        if (payload) {
                          return {
                            gasPrice: [
                              {

                        Function NodeRelationalGraphFlexBox has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          ({
                            actions, children, node, layout, layoutOptions, showDetails, detail, options, onHover, ...props
                          }, ref) => {
                            const theme = useTheme()
                            const [cy, setCy] = useState<Core>()

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

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

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

                        export const EmbedPluginCard: React.FC<BusyCardProps> = ({ ...props }) => {
                          const { payload } = useResolvePayload()
                          const {
                            activePlugin: ActivePlugin, plugins, hideElementsConfig,
                          } = useEmbedPluginState()

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

                        export const useModuleDetails = (rootModule?: WeakRef<ModuleInstance> | null, onFoundModule?: () => void) => {
                          const { cy } = useCytoscapeInstance()
                          const [moduleAddress, setModuleAddress] = useState<string | null>()
                        
                          const [foundModule] = usePromise(async () => {

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

                        export const DrawerEx: React.FC<DrawerExProps> = ({
                          children,
                          heightVariant = 'full',
                          subTitle,
                          title,
                        Severity: Minor
                        Found in packages/sdk/packages/drawer/src/components/Drawer.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 ResolvedDivinerProvider has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const ResolvedDivinerProvider = <D,>({
                          diviner: divinerProp, required = false, children, context,
                        }: DivinerProviderProps<D>) => {
                          const [diviner, setDiviner] = useResetState<D | undefined>(divinerProp)
                        
                        
                        Severity: Minor
                        Found in packages/sdk/packages/shared/src/contexts/diviner/Provider.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

                        Severity
                        Category
                        Status
                        Source
                        Language