polkadot-js/apps

View on GitHub

Showing 600 of 2,050 total issues

Consider simplifying this complex logical expression.
Open

  if (value && currentPeriod) {
    active = value.filter(({ firstSlot, isCapped, isEnded, isWinner }) =>
      !(isCapped || isEnded || isWinner) &&
      currentPeriod.lte(firstSlot)
    );
Severity: Critical
Found in packages/page-parachains/src/Crowdloan/Funds.tsx - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

          } else if (isFunction(api.query.identity?.identityOf)) {
            isVisible = !!identity && (!!identity.display || !!identity.displayParent) && (
              hasAddressMatch ||
              (!!identity.display && identity.display.toLowerCase().includes(filterLower)) ||
              (!!identity.displayParent && identity.displayParent.toLowerCase().includes(filterLower))
    Severity: Critical
    Found in packages/react-components/src/util/checkVisibility.tsx - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

          if (balances && balances.accountId?.eq(fromId) && fromId && toId && api.call.transactionPaymentApi && api.tx.balances) {
            nextTick(async (): Promise<void> => {
              try {
                const extrinsic = (api.tx.balances.transferAllowDeath || api.tx.balances.transfer)(toId, balances.availableBalance);
                const { partialFee } = await extrinsic.paymentInfo(fromId);
      Severity: Critical
      Found in packages/react-components/src/modals/Transfer.tsx - About 1 hr to fix

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

        function createStakingInfo (bestNumber: BlockNumber, blockTime: BN, sessionInfo: DeriveSessionProgress, unapplied: SlashEntry[], slashDeferDuration?: BlockNumber): [EntryType, EntryInfo[]][] {
          const blocksEra = sessionInfo.eraLength.sub(sessionInfo.eraProgress);
          const blocksSes = sessionInfo.sessionLength.sub(sessionInfo.sessionProgress);
          const slashDuration = slashDeferDuration?.mul(sessionInfo.eraLength);
          const slashEras = slashDuration
        Severity: Minor
        Found in packages/page-calendar/src/useScheduled.ts - About 1 hr to fix

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

          export function extractExternal (accountId: string | null): AddressFlags {
            if (!accountId) {
              return NO_FLAGS;
            }
          
          
          Severity: Minor
          Found in packages/react-signer/src/util.ts - About 1 hr to fix

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

            function getStats (...apis: ApiPromise[]): { stats: ProviderStats, when: number } {
              const stats: ProviderStats = {
                active: {
                  requests: 0,
                  subscriptions: 0
            Severity: Minor
            Found in packages/react-hooks/src/ctx/ApiStats.tsx - About 1 hr to fix

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

              export function getPreimageHash (api: ApiPromise, hashOrBounded: Hash | HexString | FrameSupportPreimagesBounded): StatusParams {
                let proposalHash: HexString | undefined;
                let inlineData: Uint8Array | undefined;
              
                if (isString(hashOrBounded)) {
              Severity: Minor
              Found in packages/react-hooks/src/usePreimage.ts - About 1 hr to fix

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

                function createResult (interimResult: PreimageStatus, optBytes: Option<Bytes> | Uint8Array): Preimage {
                  const callData = isU8a(optBytes)
                    ? optBytes
                    : optBytes.unwrapOr(null);
                  let proposal: Call | null = null;
                Severity: Minor
                Found in packages/react-hooks/src/usePreimage.ts - About 1 hr to fix

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

                  function needsApiCheck (api: ApiPromise): boolean {
                    try {
                      // we need a known Exposure type
                      const { nominatorCount, own, pageCount, total } = api.registry.createType<SpStakingPagedExposureMetadata>(
                        unwrapStorageType(api.registry, api.query.staking.erasStakersOverview.creator.meta.type),
                  Severity: Minor
                  Found in packages/apps-routing/src/staking.ts - About 1 hr to fix

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

                    function useWeightImpl (call?: Call | null): Result {
                      const { api } = useApi();
                      const mountedRef = useIsMountedRef();
                      const [state, setState] = useState<Result>(() => objectSpread({
                        // eslint-disable-next-line @typescript-eslint/unbound-method
                    Severity: Minor
                    Found in packages/react-hooks/src/useWeight.ts - About 1 hr to fix

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

                      export default function createOptions (api: ApiPromise, rpcs: Record<string, Record<string, DefinitionRpcExt>>, sectionName: string): DropdownOptions {
                        const section = rpcs[sectionName];
                      
                        if (!section || Object.keys((api.rpc as unknown as Record<string, Record<string, unknown>>)[sectionName]).length === 0) {
                          return [];
                      Severity: Minor
                      Found in packages/react-components/src/InputRpc/options/method.tsx - About 1 hr to fix

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

                        function groupAccounts (accounts: SortedAccount[]): Record<GroupName, string[]> {
                          const ret: Record<GroupName, string[]> = {
                            accounts: [],
                            chopsticks: [],
                            hardware: [],
                        Severity: Minor
                        Found in packages/page-accounts/src/Accounts/index.tsx - About 1 hr to fix

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

                          function updateAddress (seed: string, derivePath: string, seedType: SeedType, pairType: PairType): AddressState {
                            let address: string | null = null;
                            let deriveValidation: DeriveValidationOutput = deriveValidate(seed, seedType, derivePath, pairType);
                            let isSeedValid = false;
                          
                          
                          Severity: Minor
                          Found in packages/page-accounts/src/modals/Create.tsx - About 1 hr to fix

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

                            export default function draw (ctx: CanvasRenderingContext2D, accountId: AccountId): void {
                              console.log(`Generating ink for ${accountId.toString()} as ${accountId.toHex()}`);
                            
                              const bits = addressToBits(accountId.toU8a());
                            
                            
                            Severity: Minor
                            Found in packages/page-society/src/draw/canary.ts - About 1 hr to fix

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

                              function TupleDisplay (props: Props): React.ReactElement<Props> {
                                const { className = '', defaultValue, isDisabled, label, onChange, overrides, registry, type, withLabel } = props;
                                const params = useParamDefs(registry, type);
                                const [values] = useState<RawParam[]>(() => getInitialValues(defaultValue));
                              
                              
                              Severity: Minor
                              Found in packages/react-params/src/Param/Tuple.tsx - About 1 hr to fix

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

                                function expandOngoing (api: ApiPromise, info: Referendum['info'], track?: PalletReferendaTrackInfo): Expanded {
                                  const ongoing = info.asOngoing;
                                  const proposalHash = getPreimageHash(api, ongoing.proposal || (ongoing as unknown as { proposalHash: Hash }).proposalHash).proposalHash;
                                  let prepareEnd: BN | null = null;
                                  let decideEnd: BN | null = null;
                                Severity: Minor
                                Found in packages/page-referenda/src/Referenda/RefOngoing.tsx - About 1 hr to fix

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

                                  function DispatchResultDisplay (props: Props): React.ReactElement<Props> {
                                    const { defaultValue, isDisabled, label } = props;
                                    const dispatchError = useMemo(
                                      () => defaultValue && isDispatchResultErr(defaultValue.value)
                                        ? { isValid: true, value: defaultValue.value.asErr }
                                  Severity: Minor
                                  Found in packages/react-params/src/Param/DispatchResult.tsx - About 1 hr to fix

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

                                    function Account (props: Props): React.ReactElement<Props> {
                                      const { className = '', defaultValue: { value }, isDisabled, isError, label, onChange, type, withLabel } = props;
                                      const [defaultValue] = useState(() => (value as string)?.toString());
                                    
                                      const _onChange = useCallback(
                                    Severity: Minor
                                    Found in packages/react-params/src/Param/Account.tsx - About 1 hr to fix

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

                                      export function calcBlockTime (blockTime: BN, blocks: BN, t: (key: string, options?: { replace: Record<string, unknown> }) => string): Result {
                                        // in the case of excessively large locks, limit to the max JS integer value
                                        const value = bnMin(BN_MAX_INTEGER, blockTime.mul(blocks)).toNumber();
                                      
                                        // time calculations are using the absolute value (< 0 detection only on strings)
                                      Severity: Minor
                                      Found in packages/react-hooks/src/useBlockTime.ts - About 1 hr to fix

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

                                        export const getBountyStatus = (status: BountyStatus): BountyStatusType => {
                                          const statusAsString = status.type as StatusName;
                                        
                                          let result: BountyStatusType = {
                                            beneficiary: undefined,
                                        Severity: Minor
                                        Found in packages/page-bounties/src/helpers/getBountyStatus.ts - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language