polkadot-js/api

View on GitHub

Showing 171 of 2,493 total issues

File substrate.ts has 527 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */

// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
Severity: Major
Found in packages/types-augment/src/registry/substrate.ts - About 1 day to fix

    File rpc.ts has 500 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright 2017-2024 @polkadot/types authors & contributors
    // SPDX-License-Identifier: Apache-2.0
    
    // As per frontier
    
    
    Severity: Minor
    Found in packages/types/src/interfaces/eth/rpc.ts - About 1 day to fix

      File events.ts has 487 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
      /* eslint-disable */
      
      // import type lookup before we augment - in some environments
      // this is required to allow for ambient/previous definitions
      Severity: Minor
      Found in packages/api-augment/src/kusama/events.ts - About 7 hrs to fix

        File index.spec.ts has 477 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // Copyright 2017-2024 @polkadot/rpc-provider authors & contributors
        // SPDX-License-Identifier: Apache-2.0
        
        /// <reference types="@polkadot/dev-test/globals.d.ts" />
        
        
        Severity: Minor
        Found in packages/rpc-provider/src/substrate-connect/index.spec.ts - About 7 hrs to fix

          File types.ts has 471 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Auto-generated via `yarn polkadot-types-from-defs`, do not edit
          /* eslint-disable */
          
          import type { PortableRegistry } from '@polkadot/types';
          import type { BTreeMap, Bytes, Enum, Option, Struct, Text, Type, Vec, WrapperOpaque, bool, u8 } from '@polkadot/types-codec';
          Severity: Minor
          Found in packages/types/src/interfaces/metadata/types.ts - About 7 hrs to fix

            File query.ts has 465 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
            /* eslint-disable */
            
            // import type lookup before we augment - in some environments
            // this is required to allow for ambient/previous definitions
            Severity: Minor
            Found in packages/api-augment/src/polkadot/query.ts - About 7 hrs to fix

              File tx.ts has 463 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
              /* eslint-disable */
              
              // import type lookup before we augment - in some environments
              // this is required to allow for ambient/previous definitions
              Severity: Minor
              Found in packages/api-augment/src/polkadot/tx.ts - About 7 hrs to fix

                File types.ts has 436 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // Auto-generated via `yarn polkadot-types-from-defs`, do not edit
                /* eslint-disable */
                
                import type { Bytes, Compact, Enum, Null, Option, Raw, Result, Set, Struct, Text, U8aFixed, bool, u32, u64, u8 } from '@polkadot/types-codec';
                import type { AccountId, Balance, BlockNumber, Hash, Weight, WeightV2 } from '@polkadot/types/interfaces/runtime';
                Severity: Minor
                Found in packages/types/src/interfaces/contracts/types.ts - About 6 hrs to fix

                  File metadataMd.ts has 435 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // Copyright 2017-2024 @polkadot/typegen authors & contributors
                  // SPDX-License-Identifier: Apache-2.0
                  
                  import type { MetadataLatest, SiLookupTypeId } from '@polkadot/types/interfaces';
                  import type { PortableRegistry } from '@polkadot/types/metadata';
                  Severity: Minor
                  Found in packages/typegen/src/metadataMd.ts - About 6 hrs to fix

                    Function getSimilarTypes has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function getSimilarTypes (registry: Registry, definitions: Record<string, ModuleTypes>, _type: string, imports: TypeImports): string[] {
                      const typeParts = _type.split('::');
                      const type = typeParts[typeParts.length - 1];
                      const possibleTypes = [formatType(registry, definitions, type, imports)];
                    
                    
                    Severity: Minor
                    Found in packages/typegen/src/util/derived.ts - About 6 hrs 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

                    File consts.ts has 434 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
                    /* eslint-disable */
                    
                    // import type lookup before we augment - in some environments
                    // this is required to allow for ambient/previous definitions
                    Severity: Minor
                    Found in packages/api-augment/src/substrate/consts.ts - About 6 hrs to fix

                      File definitions.ts has 424 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      // Copyright 2017-2024 @polkadot/types authors & contributors
                      // SPDX-License-Identifier: Apache-2.0
                      
                      // order important in structs... :)
                      /* eslint-disable sort-keys */
                      Severity: Minor
                      Found in packages/types/src/interfaces/contracts/definitions.ts - About 6 hrs to fix

                        File rpc.ts has 408 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        // Copyright 2017-2024 @polkadot/types authors & contributors
                        // SPDX-License-Identifier: Apache-2.0
                        
                        import type { DefinitionsRpc } from '../../types/index.js';
                        
                        
                        Severity: Minor
                        Found in packages/types/src/interfaces/state/rpc.ts - About 5 hrs to fix

                          File Enum.spec.ts has 393 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          // Copyright 2017-2024 @polkadot/types-codec authors & contributors
                          // SPDX-License-Identifier: Apache-2.0
                          
                          /// <reference types="@polkadot/dev-test/globals.d.ts" />
                          
                          
                          Severity: Minor
                          Found in packages/types-codec/src/base/Enum.spec.ts - About 5 hrs to fix

                            Function getDefs has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getDefs (apis: Apis | null, defs: Record<string, Definitions>): Record<string, Record<string, DefinitionCallNamed>> {
                              const named: Record<string, Record<string, DefinitionCallNamed>> = {};
                              const all = Object.values(defs);
                            
                              for (let j = 0, jcount = all.length; j < jcount; j++) {
                            Severity: Minor
                            Found in packages/typegen/src/generate/runtime.ts - About 5 hrs 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

                            File runtime.ts has 388 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // Copyright 2017-2024 @polkadot/types authors & contributors
                            // SPDX-License-Identifier: Apache-2.0
                            
                            import type { DefinitionsCall, DefinitionsCallEntry } from '../../types/index.js';
                            
                            
                            Severity: Minor
                            Found in packages/types/src/interfaces/parachains/runtime.ts - About 5 hrs to fix

                              File kusama.ts has 388 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              // Auto-generated via `yarn polkadot-types-from-defs`, do not edit
                              /* eslint-disable */
                              
                              /* eslint-disable sort-keys */
                              
                              
                              Severity: Minor
                              Found in packages/types-augment/src/lookup/kusama.ts - About 5 hrs to fix

                                File events.ts has 379 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
                                /* eslint-disable */
                                
                                // import type lookup before we augment - in some environments
                                // this is required to allow for ambient/previous definitions
                                Severity: Minor
                                Found in packages/api-augment/src/polkadot/events.ts - About 5 hrs to fix

                                  File Struct.spec.ts has 353 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  // Copyright 2017-2024 @polkadot/types-codec authors & contributors
                                  // SPDX-License-Identifier: Apache-2.0
                                  
                                  /// <reference types="@polkadot/dev-test/globals.d.ts" />
                                  
                                  
                                  Severity: Minor
                                  Found in packages/types-codec/src/native/Struct.spec.ts - About 4 hrs to fix

                                    File definitions.ts has 352 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    // Copyright 2017-2024 @polkadot/types authors & contributors
                                    // SPDX-License-Identifier: Apache-2.0
                                    
                                    // order important in structs... :)
                                    /* eslint-disable sort-keys */
                                    Severity: Minor
                                    Found in packages/types/src/interfaces/eth/definitions.ts - About 4 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language