polkadot-js/apps

View on GitHub

Showing 600 of 2,050 total issues

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

function extractOther (url: string): State {
  const isIpfs = SECTIONS.some((part) => url.includes(part));
  const isIpns = url.includes(SECTIONS[1]);

  // individual sections, with the index of the ipfs portion
Severity: Minor
Found in packages/react-hooks/src/useIpfs.ts - About 1 hr to fix

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

        (header: Header): void => {
          // formatted block info
          const bn = formatNumber(header.number);
          const hash = header.hash.toHex();
          const parent = header.parentHash.toHex();
    Severity: Minor
    Found in packages/page-explorer/src/Forks.tsx - About 1 hr to fix

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

      function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] {
        const existing: string[] = [];
      
        return list
          .filter(({ accountId }): boolean => {
      Severity: Minor
      Found in packages/page-staking-legacy/src/useSortedTargets.ts - About 1 hr to fix

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

        function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] {
          const existing: string[] = [];
        
          return list
            .filter(({ accountId }): boolean => {
        Severity: Minor
        Found in packages/page-staking/src/useSortedTargets.ts - About 1 hr to fix

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

          function NodeInfo (): React.ReactElement {
            const { t } = useTranslation();
            const { api } = useApi();
            const [info, setInfo] = useState<Partial<Info>>({});
            const [nextRefresh, setNextRefresh] = useState(() => Date.now());
          Severity: Minor
          Found in packages/page-explorer/src/NodeInfo/index.tsx - About 1 hr to fix

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

            export default function createOptions (api: ApiPromise, sectionName: string): DropdownOptions {
              const section = api.consts[sectionName];
            
              if (!section || Object.keys(section).length === 0) {
                return [];
            Severity: Minor
            Found in packages/react-components/src/InputConsts/options/key.tsx - About 1 hr to fix

              Function extractInfo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function extractInfo (info: PalletReferendaReferendumInfoConvictionVotingTally | PalletReferendaReferendumInfoRankedCollectiveTally, track?: PalletReferendaTrackInfo): { confirmEnd: BN | null, enactAt: { at: boolean, blocks: BN, end: BN | null } | null, nextAlarm: null | BN, submittedIn: null | BN } {
                let confirmEnd: BN | null = null;
                let enactAt: { at: boolean, blocks: BN, end: BN | null } | null = null;
                let nextAlarm: BN | null = null;
                let submittedIn: BN | null = null;
              Severity: Minor
              Found in packages/page-referenda/src/Referenda/Referendum.tsx - About 1 hr to fix

                Function usePreimageImpl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function usePreimageImpl (hashOrBounded?: Hash | HexString | FrameSupportPreimagesBounded | null): Preimage | undefined {
                  const { api } = useApi();
                
                  // retrieve the status using only the hash of the image
                  const { inlineData, paramsStatus, resultPreimageHash } = useMemo(
                Severity: Minor
                Found in packages/react-hooks/src/usePreimage.ts - About 1 hr to fix

                  Function useTxBatchImpl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function useTxBatchImpl (txs?: SubmittableExtrinsic<'promise'>[] | null | false, options?: BatchOptions): SubmittableExtrinsic<'promise'>[] | null {
                    const { api } = useApi();
                    const { allAccounts } = useAccounts();
                    const [batchSize, setBatchSize] = useState(() => Math.floor(options?.max || 4));
                  
                  
                  Severity: Minor
                  Found in packages/react-hooks/src/useTxBatch.ts - About 1 hr to fix

                    Function sortAccounts has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function sortAccounts (addresses: string[], favorites: string[]): SortedAccount[] {
                      const mapped = addresses
                        .map((address) => keyring.getAccount(address))
                        .filter((account): account is KeyringAddress => !!account)
                        .map((account): SortedAccount => ({
                    Severity: Minor
                    Found in packages/page-addresses/src/util.tsx - About 1 hr to fix

                      Function transform has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        transform: (entries: [{ args: [BlockNumber] }, Option<Scheduled | PalletSchedulerScheduled | PalletSchedulerScheduledV3>[]][], api: ApiPromise): ScheduledExt[] => {
                          return entries
                            .filter(([, all]) => all.some((o) => o.isSome))
                            .reduce((items: ScheduledExt[], [key, all]): ScheduledExt[] => {
                              const blockNumber = key.args[0];
                      Severity: Minor
                      Found in packages/page-scheduler/src/Scheduler.tsx - About 1 hr to fix

                        Function useApiUrlImpl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function useApiUrlImpl (url?: null | string | string[]): ApiPromise | null {
                          const providerRef = useRef<ProviderInterface | null>(null);
                          const mountedRef = useIsMountedRef();
                          const [state, setState] = useState<ApiPromise | null>(null);
                          const urls = useMemo(
                        Severity: Minor
                        Found in packages/react-hooks/src/useApiUrl.ts - About 1 hr to fix

                          Function renderRows has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function renderRows (rows: Row[]): React.ReactNode[] {
                            const lastIndex = rows.length - 1;
                            let isPrevShort = false;
                          
                            return rows.map(({ bn, cols }, index): React.ReactNode => {
                          Severity: Minor
                          Found in packages/page-explorer/src/Forks.tsx - About 1 hr to fix

                            Function useItemsInfosImpl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function useItemsInfosImpl (accountItems: AccountItem[]): ItemInfo[] | undefined {
                              const { api } = useApi();
                              const [state, setState] = useState<ItemInfo[] | undefined>();
                            
                              const ids = useMemo(
                            Severity: Minor
                            Found in packages/page-nfts/src/AccountItems/useItemsInfos.ts - About 1 hr to fix

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

                              function useMultisigApprovalsImpl (address: string): [H256, Multisig][] | undefined {
                                const { events } = useBlockEvents();
                                const { api } = useApi();
                                const [multiInfos, setMultiInfos] = useState<[H256, Multisig][] | undefined>();
                                const [trigger, incTrigger] = useIncrement(1);
                              Severity: Minor
                              Found in packages/page-accounts/src/Accounts/useMultisigApprovals.ts - About 1 hr to fix

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

                                function useBagEntriesImpl (headId: AccountId32 | null, trigger: number): [boolean, AccountId32[]] {
                                  const mod = useQueryModule();
                                  const [[currId, { isCompleted, list }], setCurrent] = useState<[AccountId32 | null, Result]>(EMPTY);
                                  const node = useCall<Option<PalletBagsListListNode>>(!!currId && mod.listNodes, [currId]);
                                
                                
                                Severity: Minor
                                Found in packages/page-staking-legacy/src/Bags/useBagEntries.tsx - About 1 hr to fix

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

                                      async function dryRun () {
                                        if (accountId && value && message.isMutating) {
                                          const dryRunParams: Parameters<typeof api.call.contractsApi.call> =
                                            [
                                              accountId,
                                  Severity: Minor
                                  Found in packages/page-contracts/src/Contracts/Call.tsx - About 1 hr to fix

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

                                    function extractStake (labels: string[], exposures: DeriveOwnExposure[], divisor: BN): LineData {
                                      const expPagedSet = new Array<number>(labels.length);
                                      const expMetaSet = new Array<number>(labels.length);
                                      const avgSet = new Array<number>(labels.length);
                                      const [total, avgCount] = exposures.reduce(([total, avgCount], { exposureMeta }) => {
                                    Severity: Minor
                                    Found in packages/page-staking/src/Query/ChartStake.tsx - About 1 hr to fix

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

                                      function useBagEntriesImpl (headId: AccountId32 | null, trigger: number): [boolean, AccountId32[]] {
                                        const mod = useQueryModule();
                                        const [[currId, { isCompleted, list }], setCurrent] = useState<[AccountId32 | null, Result]>(EMPTY);
                                        const node = useCall<Option<PalletBagsListListNode>>(!!currId && mod.listNodes, [currId]);
                                      
                                      
                                      Severity: Minor
                                      Found in packages/page-staking/src/Bags/useBagEntries.tsx - About 1 hr to fix

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

                                        function usePolkadotPreclaimsImpl (): string[] {
                                          const { allAccounts } = useAccounts();
                                          const { api } = useApi();
                                          const mountedRef = useIsMountedRef();
                                          const [needsAttest, setNeedsAttest] = useState<string[]>([]);
                                        Severity: Minor
                                        Found in packages/page-claims/src/usePolkadotPreclaims.ts - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language