XYOracleNetwork/sdk-xyo-react-js

View on GitHub

Showing 124 of 486 total issues

Function StatsModal has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const StatsModal: React.FC = () => {
  const [open, setOpen] = React.useState(false)
  const handleOpen = () => setOpen(true)
  const handleClose = () => setOpen(false)

Severity: Minor
Found in packages/sdk/packages/os/src/components/Profile/StatsModal.tsx - About 1 hr to fix

    Function SocialLinks has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const SocialLinks: React.FC<FlexBoxProps> = (props) => {
      return (
        <FooterLinks title="XYO Socials" {...props}>
          <FlexRow flexWrap="wrap" justifyContent="flex-start">
            <FooterLink href="https://business.facebook.com/OfficialXYO/">
    Severity: Minor
    Found in packages/sdk/packages/footer/src/Xyo/SocialLinks.tsx - About 1 hr to fix

      Function testReport has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          async (address: string, tokenInterface?: string) => {
            if (node) {
              try {
                // test indexed call
                const diviner = asDivinerInstance(await node.resolve(IndexedDivinerName))

        Function useCytoscapeElements has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const useCytoscapeElements = (mod?: WeakRef<ModuleInstance> | null) => {
          const [elements, setElements] = useState<ElementDefinition[]>([])
        
          useAsyncEffect(
        
        

          Function SeedPhraseDialogInner has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const SeedPhraseDialogInner: React.FC<SeedPhraseDialogProps> = (props) => {
            const {
              overwriteWarning, seedPhrase, validPhrase,
            } = useSeedPhrase()
          
          

            Function useWeakModulesFromNode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const useWeakModulesFromNode = (
              filter?: ModuleFilter,
              config?: ModuleFromNodeConfig,
            ): [WeakRef<ModuleInstance>[] | undefined, Error | undefined] => {
              const [node, nodeError] = useNode(config)
            Severity: Minor
            Found in packages/modules/packages/node/src/hooks/useWeakModulesFromNode.ts - About 1 hr to fix

              Function EmbedPluginCard has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function usePromise has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                export const usePromise = <TResult>(
                  promise: () => Promise<TResult | undefined>,
                  dependencies: DependencyList,
                  debug: string | undefined = undefined,
                ): [TResult | undefined, Error | undefined, State | undefined] => {
                Severity: Minor
                Found in packages/sdk/packages/wallet/src/contexts/Wallet/usePromise.ts - 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 EllipsisTableCellWithRef has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  ({
                    children, href, link = false, to, value, ...props
                  }, ref) => {
                    const data = useMemo(() => {
                      if (children) {

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

                export const useAccessCodes = (localStorageKey: string, validCodeLength = 6) => {
                  const [validated, setValidated] = useState(false)
                  const [codeInput, setCodeInput] = useState('')
                
                  const onAccessCodeSuccess = () => {
                Severity: Minor
                Found in packages/sdk/packages/access-gate/src/hooks/useAccessCodes.ts - 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 parseMeausureString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                export const parseMeausureString = (measure?: string, absolute?: number) => {
                  if (measure !== undefined && measure !== null && measure.length > 0) {
                    if (measure.endsWith('px')) {
                      return Number.parseFloat(measure.slice(0, Math.max(0, measure.length - 2)))
                    } else if (measure.endsWith('%')) {
                Severity: Minor
                Found in packages/sdk/packages/shared/src/lib/getActualPaddingX.ts - 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 NavigationCol has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const NavigationCol: React.FC<FlexBoxProps> = (props) => {
                    return (
                      <FlexCol {...props}>
                        <TextField
                          fullWidth
                Severity: Minor
                Found in packages/sdk/packages/typedoc/src/TwoPanelReflectionViewer.tsx - About 1 hr to fix

                  Function useDivinePayload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const useDivinePayload = <T extends Payload = Payload>(
                    huri?: string,
                  ): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {
                    const { diviner } = usePayloadDiviner()
                    const [payload, setPayload] = useState<T | null>()

                    Function getBlocknativeTransformer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const getBlocknativeTransformer = (payload?: EthereumGasBlocknativePayload): GasPriceWitnessUIBasePayload | undefined => {
                      const blockPrices = payload?.blockPrices?.[0]
                      if (blockPrices && blockPrices.estimatedPrices?.length) {
                        const estimatedPrices = blockPrices?.estimatedPrices
                        const gasPrice = estimatedPrices.map(price => ({

                      Function pollDivinersWithDelay has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const pollDivinersWithDelay = async (newDelay: number, pollingFunction?: PollingFunction) => {
                          if (activePolling && maxRetries !== null && pollingFunction) {
                            let retries = 0
                            let result: Payload[] | undefined | null
                      
                      

                        Function pollDivinersWithDelay has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            async (newDelay: number, functionToPoll?: FunctionToPoll) => {
                              if (activePollingRef.current && maxRetries !== null && functionToPoll) {
                                let retries = 0
                                let result: Payload[] | undefined | null
                        
                        

                          Function boundwitnessClick has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              (noun: EventNoun, data?: Hash, clickType?: BoundwitnessClickType) => {
                                // eslint-disable-next-line complexity
                                void (async () => {
                                  if (noun === 'boundwitness' && data) {
                                    if (clickType === 'activeBoundWitness' && !hashSelectionHistory?.includes(data)) {

                            Function useAccessCodes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const useAccessCodes = (localStorageKey: string, validCodeLength = 6) => {
                              const [validated, setValidated] = useState(false)
                              const [codeInput, setCodeInput] = useState('')
                            
                              const onAccessCodeSuccess = () => {
                            Severity: Minor
                            Found in packages/sdk/packages/access-gate/src/hooks/useAccessCodes.ts - About 1 hr to fix

                              Function getEtherchainV2Transformer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

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

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

                              export const BWActions: React.FC<BWActionsProps> = ({
                                additionalActions,
                                boundwitness,
                                hideJSONButton,
                                hideValidation,

                              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