polkadot-js/api

View on GitHub

Showing 173 of 2,513 total issues

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 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 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 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 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 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 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 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 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 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 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 convertCalls has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function convertCalls (specs: TypeSpec[], registry: Registry, modName: Text, calls: FunctionMetadataV13[], sectionTypes: OverrideModuleType): PalletCallMetadataV14 {
                            Severity: Minor
                            Found in packages/types/src/metadata/v13/toV14.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

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

                                function convertEvents (specs: TypeSpec[], registry: Registry, modName: Text, events: EventMetadataV13[], sectionTypes: OverrideModuleType): PalletEventMetadataV14 {
                                Severity: Minor
                                Found in packages/types/src/metadata/v13/toV14.ts - About 35 mins to fix

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

                                  export function createCallFunction (registry: Registry, lookup: PortableRegistry, variant: SiVariant, sectionName: string, sectionIndex: number): CallFunction {
                                  Severity: Minor
                                  Found in packages/types/src/metadata/decorate/extrinsics/index.ts - About 35 mins to fix

                                    Function compareRationals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export function compareRationals (n1: BN, d1: BN, n2: BN, d2: BN): boolean {
                                      while (true) {
                                        const q1 = n1.div(d1);
                                        const q2 = n2.div(d2);
                                    
                                    
                                    Severity: Minor
                                    Found in packages/api-derive/src/democracy/util.ts - About 35 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 inspectType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function inspectType (type: string): void {
                                      try {
                                        // get the definition
                                        const { sub } = getTypeDef(registry.createType(type).toRawType());
                                    
                                    
                                    Severity: Minor
                                    Found in packages/types/src/interfaces/definitions.spec.ts - About 35 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 findClosing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export function findClosing (value: string, start: number): number {
                                      let depth = 0;
                                    
                                      for (let i = start, count = value.length; i < count; i++) {
                                        if (value[i] === '>') {
                                    Severity: Minor
                                    Found in packages/types-codec/src/utils/sanitize.ts - About 35 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