Showing 114 of 365 total issues
Function resolveModuleIdentifier
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static async resolveModuleIdentifier<T extends ModuleInstance = ModuleInstance>(
resolver: ModuleResolver,
path: ModuleIdentifier,
required?: boolean,
): Promise<T | undefined> {
- 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 poll
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private poll() {
this._pollId = setTimeoutEx(
async () => {
try {
await this.processIncomingQueries()
- 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 getPayload
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private async getPayload(hash: Hash): Promise<Payload | undefined> {
const cache = await this.getCache()
const payloadFromCache = (await cache.get([hash])).at(0)
if (isAnyPayload(payloadFromCache)) {
return payloadFromCache
- 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
Avoid deeply nested control flow statements. Open
if (!result) {
result = await this.resolveModuleIdentifier<T>(resolverInstance, id)
}
Avoid deeply nested control flow statements. Open
if (proxy) {
const wrapped = wrapModuleWithType(proxy, await Account.random()) as unknown as T
return remainingParts ? wrapped?.resolve(remainingParts, options) : wrapped
}
Function attachNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private attachNode(node: NodeInstance) {
const listener = async (event: MessageEvent) => {
const message = event.data as Message
switch (message.type) {
case 'xyoQuery': {
- 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
Avoid deeply nested control flow statements. Open
if (!seen.has(serialized)) {
// Add it to the set of seen combinations
seen.add(serialized)
// Add the new combination to the list of new combinations
newCombinations.push(newPerm)
Avoid deeply nested control flow statements. Open
if (response && (response?.$meta as unknown as { sourceQuery: string })?.sourceQuery === sourceQuery) {
this.logger?.debug(`Found response to query: ${sourceQuery}`)
// Get any payloads associated with the response
const payloads: PayloadWithMeta[] = response.payload_hashes?.length > 0 ? await responseArchivist.get(response.payload_hashes) : []
this.queryCache.set(sourceQuery, [response, payloads, []])
Function resolveAddressToInstanceDown
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const resolveAddressToInstanceDown = async (
root: ModuleInstance,
address: Address,
includePrivate: boolean | undefined = undefined,
ignore: Address[] = [],
- 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
Avoid deeply nested control flow statements. Open
if (newCombination.length === schemas.indexOf(element) + 1) {
newCombinations.push(newCombination)
}
Consider simplifying this complex logical expression. Open
if (destination && Array.isArray(destination) && destination?.length > 0) {
const targetFilter = assertEx(destination, () => 'Missing destination')
// Find all BWs that satisfy the destination constraint
bws = bws.filter((bw) => {
const targetDestinationField = (bw?.$meta as { destination?: string[] })?.destination
Function getProviderFromEnv
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const getProviderFromEnv = (
chainId: number = 0x01,
{ providerSource = 'infura', providerType = 'rpc' }: GetProvidersFromEnvOptions = {},
): Provider => {
let provider: Provider | undefined = undefined
- 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 resolvePathToInstance
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const resolvePathToInstance = async (
root: ModuleInstance,
path: string,
includePrivate: boolean | undefined = undefined,
transformers: ModuleIdentifierTransformer[] = ResolveHelperStatic.transformers,
- 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 getProviderFromEnv
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const getProviderFromEnv = (
chainId: number = 0x01,
{ providerSource = 'infura', providerType = 'rpc' }: GetProvidersFromEnvOptions = {},
): Provider => {
let provider: Provider | undefined = undefined
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(config?: TConfig) {
if (config?.security?.allowed) {
for (const [schema, addresses] of Object.entries(config.security?.allowed)) {
this.allowed[schema] = addresses.map(toAddressesString)
}
- 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 validateRequiredResolve
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static validateRequiredResolve(
required: boolean | 'warn' | 'log',
result: ModuleInstance[] | ModuleInstance | undefined,
idOrFilter: ModuleIdentifier | ModuleFilter,
logger = this.defaultLogger,
- 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 resolve
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private async resolve<T extends ModuleInstance>(id: ModuleIdentifier, typeCheck: TypeCheck<T>): Promise<T | undefined> {
if (Date.now() - (this._lastResolveFailure[id] ?? 0) < this._reResolveDelay) {
return
}
this._lastResolveFailure[id] = Date.now()
- 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
Avoid too many return
statements within this function. Open
return (await Promise.all(filter.name.map(item => this.resolve(item, options)))).filter(exists)
Avoid too many return
statements within this function. Open
return result
Avoid too many return
statements within this function. Open
return Object.values(value).every(item => isSerializable(item, maxDepth - 1))