polkadot-js/apps

View on GitHub

Showing 600 of 2,050 total issues

Function extractSingle has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

function extractSingle (api: ApiPromise, allAccounts: string[], derive: DeriveStakingElected | DeriveStakingWaiting, favorites: string[], { activeEra, eraLength, lastEra, sessionLength }: LastEra, historyDepth?: BN, withReturns?: boolean): [ValidatorInfo[], Record<string, BN>] {
Severity: Major
Found in packages/page-staking/src/useSortedTargets.ts - About 50 mins to fix

    Function signAndSend has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    async function signAndSend (queueSetTxStatus: QueueTxMessageSetStatus, currentItem: QueueTx, tx: SubmittableExtrinsic<'promise'>, pairOrAddress: KeyringPair | string, options: Partial<SignerOptions>, api: ApiPromise, isMockSign: boolean): Promise<void> {
    Severity: Major
    Found in packages/react-signer/src/TxSigned.tsx - About 50 mins to fix

      Function subscribe has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function subscribe <T> (api: ApiPromise, mountedRef: MountedRef, tracker: TrackerRef, fn: TrackFn | undefined, params: CallParams, setValue: (value: any) => void, { transform = transformIdentity, withParams, withParamsTransform }: CallOptions<T> = {}): void {
      Severity: Major
      Found in packages/react-hooks/src/useCall.ts - About 50 mins to fix

        Function signAsync has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        async function signAsync (queueSetTxStatus: QueueTxMessageSetStatus, { id, txFailedCb = NOOP, txStartCb = NOOP }: QueueTx, tx: SubmittableExtrinsic<'promise'>, pairOrAddress: KeyringPair | string, options: Partial<SignerOptions>, api: ApiPromise, isMockSign: boolean): Promise<string | null> {
        Severity: Major
        Found in packages/react-signer/src/TxSigned.tsx - About 50 mins to fix

          Function loadOnReady has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          async function loadOnReady (api: ApiPromise, endpoint: LinkOption | null, fork: Blockchain | null, injectedPromise: Promise<InjectedExtension[]>, store: KeyringStore | undefined, types: Record<string, Record<string, string>>, urlIsEthereum = false): Promise<ApiState> {
          Severity: Major
          Found in packages/react-api/src/Api.tsx - About 50 mins to fix

            Function Pools has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function Pools ({ className, ids, ownPools, params }: Props): React.ReactElement<Props> {
              const { t } = useTranslation();
              const membersMap = useMembers();
              const [typeIndex, setTypeIndex] = useState(() => ownPools?.length ? 0 : 1);
            
            
            Severity: Minor
            Found in packages/page-staking2/src/Pools/Pools.tsx - About 45 mins 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 deriveValidate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function deriveValidate (seed: string, seedType: SeedType, derivePath: string, pairType: PairType): DeriveValidationOutput {
              try {
                const { password, path } = keyExtractSuri(pairType === 'ethereum' ? `${seed}/${derivePath}` : `${seed}${derivePath}`);
                let result: DeriveValidationOutput = {};
            
            
            Severity: Minor
            Found in packages/page-accounts/src/modals/Create.tsx - About 45 mins 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 Create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function Create ({ className, isDisabled, ownAccounts, params: { minCreateBond, minNominatorBond, nextPoolId } }: Props): React.ReactElement<Props> {
              const { t } = useTranslation();
              const { api } = useApi();
              const [isOpen, toggleOpen] = useToggle();
              const [accountId, setAccount] = useState<string | null>(null);
            Severity: Minor
            Found in packages/page-staking2/src/Pools/Create.tsx - About 45 mins 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 applyFormat has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function applyFormat (value: Compact<any> | BN | string | number, [decimals, token]: [number, string], withCurrency = true, withSi?: boolean, _isShort?: boolean, labelPost?: LabelPost): React.ReactNode {
            Severity: Minor
            Found in packages/react-query/src/FormatBalance.tsx - About 45 mins to fix

              Function Overview has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function Overview ({ className = '', favorites, hasAccounts, hasQueries, minCommission, nominatedBy, ownStashes, paraValidators, stakingOverview, targets, toggleFavorite, toggleLedger, toggleNominatedBy }: Props): React.ReactElement<Props> {
                const { t } = useTranslation();
                const { api } = useApi();
                const { byAuthor, eraPoints } = useBlockAuthors();
                const [intentIndex, _setIntentIndex] = useState(0);
              Severity: Minor
              Found in packages/page-staking-legacy/src/Validators/index.tsx - About 45 mins 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 createAccount has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function createAccount (source: KeyringPair, suri: string, name: string, password: string, success: string, genesisHash?: HexString): ActionStatus {
              Severity: Minor
              Found in packages/page-accounts/src/modals/Derive.tsx - About 45 mins to fix

                Function filterAccounts has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function filterAccounts (isOwn: boolean, accounts: string[] = [], ownStashIds: string[] = [], elected: string[], favorites: string[], without: string[]): AccountExtend[] {
                Severity: Minor
                Found in packages/page-staking-legacy/src/Validators/CurrentList.tsx - About 45 mins to fix

                  Function useValidatorsActiveImpl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function useValidatorsActiveImpl (favorites: string[], sessionInfo: SessionInfo): Validator[] | undefined {
                    const { api } = useApi();
                    const sessionValidators = useCall(api.query.session.validators, undefined, OPT_VALIDATORS);
                    const activeIndices = useCall((api.query.parasShared || api.query.shared)?.activeValidatorIndices, undefined, OPT_INDICES);
                  
                  
                  Severity: Minor
                  Found in packages/page-staking2/src/useValidatorsActive.ts - About 45 mins 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 getDisplayValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getDisplayValue (now = 0, value: BN | Date | number = 0): React.ReactNode {
                    const tsValue = (
                      value && (value as Date).getTime
                        ? (value as Date).getTime()
                        : bnToBn(value as number).toNumber()
                  Severity: Minor
                  Found in packages/react-query/src/Elapsed.tsx - About 45 mins 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

                  Avoid deeply nested control flow statements.
                  Open

                              if (overlapsDisplay(displays, sanitized)) {
                                return false;
                              }
                  Severity: Major
                  Found in packages/page-staking-legacy/src/Targets/index.tsx - About 45 mins to fix

                    Function Messages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function Messages ({ className = '', contract, contractAbi: { constructors, info: { source }, messages }, isLabelled, isWatching, onSelect, onSelectConstructor, trigger, withConstructors, withMessages, withWasm }: Props): React.ReactElement<Props> {
                      const { t } = useTranslation();
                      const { api } = useApi();
                      const optInfo = useCall<Option<ContractInfo>>(contract && api.query.contracts.contractInfoOf, [contract?.address]);
                      const [isUpdating, setIsUpdating] = useState(false);
                    Severity: Minor
                    Found in packages/page-contracts/src/shared/Messages.tsx - About 45 mins 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 createAccount has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function createAccount (seed: string, derivePath: string, pairType: PairType, { genesisHash, name, tags = [] }: CreateOptions, password: string, success: string): ActionStatus {
                    Severity: Minor
                    Found in packages/page-accounts/src/modals/Create.tsx - About 45 mins to fix

                      Function Overview has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function Overview ({ className = '', favorites, hasAccounts, hasQueries, minCommission, nominatedBy, ownStashes, paraValidators, stakingOverview, targets, toggleFavorite, toggleLedger, toggleNominatedBy }: Props): React.ReactElement<Props> {
                        const { t } = useTranslation();
                        const { api } = useApi();
                        const { byAuthor, eraPoints } = useBlockAuthors();
                        const [intentIndex, _setIntentIndex] = useState(0);
                      Severity: Minor
                      Found in packages/page-staking/src/Validators/index.tsx - About 45 mins 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 filterAccounts has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function filterAccounts (isOwn: boolean, accounts: string[] = [], ownStashIds: string[] = [], elected: string[], favorites: string[], without: string[]): AccountExtend[] {
                      Severity: Minor
                      Found in packages/page-staking/src/Validators/CurrentList.tsx - About 45 mins to fix

                        Function StaticParam has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function StaticParam ({ asHex, children, childrenPre, className = '', defaultValue, isOptional, label }: Props): React.ReactElement<Props> {
                          const { t } = useTranslation();
                        
                          const value = useMemo(
                            () => !!defaultValue?.value && (
                        Severity: Minor
                        Found in packages/react-params/src/Param/Static.tsx - About 45 mins 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