Showing 173 of 2,509 total issues
Function _decodeFixedVec
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function _decodeFixedVec (value: TypeDef, type: string, _: string, count: number): TypeDef {
const max = type.length - 1;
let index = -1;
let inner = 0;
- Read upRead up
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 typeSplit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function typeSplit (type: string): string[] {
const result: string[] = [];
// these are the depths of the various tokens: <, [, {, (
let c = 0;
- Read upRead up
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 getModules
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getModules (api: DeriveApi): [string, string | null] {
const [council] = api.registry.getModuleInstances(api.runtimeVersion.specName, 'council') || ['council'];
const elections = api.query['phragmenElection']
? 'phragmenElection'
: api.query['electionsPhragmen']
- Read upRead up
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 entrySignature
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function entrySignature (lookup: PortableRegistry, allDefs: Record<string, ModuleTypes>, registry: Registry, section: string, storageEntry: StorageEntryMetadataLatest, imports: TypeImports): [boolean, string, string, string] {
Function dualParamsNotation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function dualParamsNotation (registry: Registry, wrapper: string, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean): string {
Avoid deeply nested control flow statements. Open
if (ver) {
const methods = Object.entries(ver.methods);
const mcount = methods.length;
if (mcount) {
Avoid deeply nested control flow statements. Open
if (params.length) {
describe('params', (): void => {
for (const { name, type } of params) {
if (skipInspectTypes.includes(type)) {
continue;
Function filterEvents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function filterEvents (txHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[], status: ExtrinsicStatus): { events?: EventRecord[], txIndex?: number, blockNumber?: BlockNumber } {
// extrinsics to hashes
for (const [txIndex, x] of extrinsics.entries()) {
if (x.hash.eq(txHash)) {
return {
- Read upRead up
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 singleParamNotation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function singleParamNotation (registry: Registry, wrapper: string, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean): string {
Function tsResultGetter
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function tsResultGetter (registry: Registry, definitions: Record<string, ModuleTypes>, resultName = '', getter: 'Ok' | 'Err', def: TypeDef, imports: TypeImports): string {
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(', ')}]`);
}
Function extractStorageArgs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function extractStorageArgs (registry: Registry, creator: StorageEntry, _args: unknown[]): [StorageEntry, unknown[]] {
const args = _args.filter((a) => !isUndefined(a));
if (creator.meta.type.isPlain) {
if (args.length !== 0) {
- Read upRead up
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 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 {
Avoid deeply nested control flow statements. Open
if (!skipInspectType) {
it(`output ${type} is known`, (): void => {
expect(() => inspectType(type)).not.toThrow();
});
}
Function splitAlternatives
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function splitAlternatives (type: string): string[] {
const alternatives = [];
let beginOfAlternative = 1;
let level = 0;
- Read upRead up
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 generateCallTypes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export function generateCallTypes (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
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 {
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 {
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 {
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[]> {