polkadot-js/api

View on GitHub

Showing 179 of 2,612 total issues

Avoid deeply nested control flow statements.
Open

    if (Array.isArray(subDef)) {
      const subs = subDef.map(({ type }) => getSimilarTypes(registry, definitions, type, imports).join(' | '));

      possibleTypes.push(`[${subs.join(', ')}]`);
    }
Severity: Major
Found in packages/typegen/src/util/derived.ts - About 45 mins to fix

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

    function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
    Severity: Minor
    Found in packages/typegen/src/generate/tx.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                        if (params.length) {
                          describe('params', (): void => {
                            for (const { name, type } of params) {
                              if (skipInspectTypes.includes(type)) {
                                continue;
      Severity: Major
      Found in packages/types/src/interfaces/definitions.spec.ts - About 45 mins to fix

        Function generateDefaultConsts has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        export function generateDefaultConsts (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
        Severity: Minor
        Found in packages/typegen/src/generate/consts.ts - About 35 mins to fix

          Function generateForMeta has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
          Severity: Minor
          Found in packages/typegen/src/generate/consts.ts - About 35 mins to fix

            Function generateForMeta has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
            Severity: Minor
            Found in packages/typegen/src/generate/events.ts - About 35 mins to fix

              Function tsInt has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function tsInt (_: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports, type: 'Int' | 'UInt' = 'Int'): string {
              Severity: Minor
              Found in packages/typegen/src/generate/tsDef.ts - About 35 mins to fix

                Function decodeU8aVec has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                export function decodeU8aVec <T extends Codec = Codec> (registry: Registry, result: unknown[], u8a: Uint8Array, startAt: number, Type: CodecClass<T>): [number, number] {
                Severity: Minor
                Found in packages/types-codec/src/utils/decodeU8a.ts - About 35 mins to fix

                  Function tsEnum has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, { lookupIndex, name: enumName, sub }: TypeDef, imports: TypeImports, withShortcut = false): string {
                  Severity: Minor
                  Found in packages/typegen/src/generate/tsDef.ts - About 35 mins to fix

                    Function generateTsDefFor has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    export function generateTsDefFor (registry: Registry, importDefinitions: Record<string, Record<string, ModuleTypes>>, defName: string, { types }: { types: Record<string, any> }, outputDir: string): void {
                    Severity: Minor
                    Found in packages/typegen/src/generate/tsDef.ts - About 35 mins to fix

                      Function getStashInfo has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function getStashInfo (api: DeriveApi, stashIds: AccountId[], activeEra: EraIndex, { withClaimedRewardsEras, withController, withDestination, withExposure, withExposureErasStakersLegacy, withExposureMeta, withLedger, withNominations, withPrefs }: StakingQueryFlags, page: u32 | AnyNumber): Observable<[(Option<AccountId> | null)[], Option<PalletStakingNominations>[], Option<PalletStakingRewardDestination>[], PalletStakingValidatorPrefs[], Option<SpStakingExposurePage>[], Option<SpStakingPagedExposureMetadata>[], number[][], SpStakingExposure[]]> {
                      Severity: Minor
                      Found in packages/api-derive/src/staking/query.ts - About 35 mins to fix

                        Function createSubmittable has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        export function createSubmittable<ApiType extends ApiTypes> (apiType: ApiTypes, api: ApiInterfaceRx, decorateMethod: ApiBase<ApiType>['_decorateMethod'], registry?: Registry, blockHash?: Uint8Array): Creator<ApiType> {
                        Severity: Minor
                        Found in packages/api/src/submittable/createSubmittable.ts - About 35 mins to fix

                          Function getBatch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function getBatch (api: DeriveApi, activeEra: EraIndex, stashIds: AccountId[], flags: StakingQueryFlags, page: u32 | AnyNumber): Observable<DeriveStakingQuery[]> {
                          Severity: Minor
                          Found in packages/api-derive/src/staking/query.ts - About 35 mins to fix

                            Function exportInterface has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            export function exportInterface (lookupIndex = -1, name = '', base: string, body = '', withShortcut = false): string {
                            Severity: Minor
                            Found in packages/typegen/src/util/formatting.ts - About 35 mins to fix

                              Function formatType has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              export function formatType (registry: Registry, definitions: Record<string, ModuleTypes>, type: AnyString | TypeDef, imports: TypeImports, withShortcut = false): string {
                              Severity: Minor
                              Found in packages/typegen/src/util/formatting.ts - About 35 mins to fix

                                Function generateDefaultEvents has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                export function generateDefaultEvents (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
                                Severity: Minor
                                Found in packages/typegen/src/generate/events.ts - About 35 mins to fix

                                  Function generateDefaultRuntime has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  export function generateDefaultRuntime (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
                                  Severity: Minor
                                  Found in packages/typegen/src/generate/runtime.ts - About 35 mins to fix

                                    Function generateDefaultQuery has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    export function generateDefaultQuery (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
                                    Severity: Minor
                                    Found in packages/typegen/src/generate/query.ts - About 35 mins to fix

                                      Function generateDefaultTx has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      export function generateDefaultTx (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
                                      Severity: Minor
                                      Found in packages/typegen/src/generate/tx.ts - About 35 mins to fix

                                        Function convertErrors has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        function convertErrors (specs: TypeSpec[], registry: Registry, modName: Text, errors: ErrorMetadataV13[], _sectionTypes: OverrideModuleType): PalletErrorMetadataV14 {
                                        Severity: Minor
                                        Found in packages/types/src/metadata/v13/toV14.ts - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language