Genese complexity report

<- async_hooks.d.ts
Methods : 16
Complexity index : 8.9
Cyclomatic complexity : 15
Cognitive complexity
100 % Correct 16/16
0 % Warning 0/16 (threshold : 10)
0 % Error 0/16 (threshold : 20)
Cyclomatic complexity
100 % Correct 16/16
0 % Warning 0/16 (threshold : 5)
0 % Error 0/16 (threshold : 10)
Methods of async_hooks.d.ts
executionAsyncId Complexity Index 0.1 Cyclomatic complexity 1
                            
                                
            
                /**
                 * Returns the asyncId of the current execution context.
                 */
                function executionAsyncId(): number; // --------------------------- +0.1 Complexity index (+0.1 atomic)
            
                            
                        
executionAsyncResource Complexity Index 0.1 Cyclomatic complexity 1
                            
                                
                
            
                /**
                 * The resource representing the current execution.
                 *  Useful to store data within the resource.
                 *
                 * Resource objects returned by `executionAsyncResource()` are most often internal
                 * Node.js handle objects with undocumented APIs. Using any functions or properties
                 * on the object is likely to crash your application and should be avoided.
                 *
                 * Using `executionAsyncResource()` in the top-level execution context will
                 * return an empty object as there is no handle or request object to use,
                 * but having an object representing the top-level can be helpful.
                 */
                function executionAsyncResource(): object; // ------------------------------------------------ +0.1 Complexity index (+0.1 atomic)
            
                            
                        
triggerAsyncId Complexity Index 0.1 Cyclomatic complexity 1
                            
                                
                
            
                /**
                 * Returns the ID of the resource responsible for calling the callback that is currently being executed.
                 */
                function triggerAsyncId(): number; // ----------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
            
                            
                        
createHook Complexity Index 0.4 Cyclomatic complexity 1
                            
                                
                
            
                /**
                 * Registers functions to be called for different lifetime events of each async operation.
                 * @param options the callbacks to register
                 * @return an AsyncHooks instance used for disabling and enabling hooks
                 */
                function createHook(options: HookCallbacks): AsyncHook; // ------------------------------------------ +0.4 Complexity index (+0.4 atomic)
            
                            
                        
Complexity Index 0.5 Cyclomatic complexity 0
                            
                                
                
                    /**
                     * AsyncResource() is meant to be extended. Instantiating a
                     * new AsyncResource() also triggers init. If triggerAsyncId is omitted then
                     * async_hook.executionAsyncId() is used.
                     * @param type The type of async event.
                     * @param triggerAsyncId The ID of the execution context that created
                     *   this async event (default: `executionAsyncId()`), or an
                     *   AsyncResourceOptions object (since 9.3)
                     */
                    constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions); // ----------- +0.5 Complexity index (+0.5 atomic)
            
                            
                        
bind Complexity Index 1.3 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * Binds the given function to the current execution context.
                     * @param fn The function to bind to the current execution context.
                     * @param type An optional name to associate with the underlying `AsyncResource`.
                     */
                    static bind<Func extends (...args: any[]) => any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource }; // ------- +1.3 Complexity index (+1.3 atomic)
            
                            
                        
bind Complexity Index 1.1 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * Binds the given function to execute to this `AsyncResource`'s scope.
                     * @param fn The function to bind to the current `AsyncResource`.
                     */
                    bind<Func extends (...args: any[]) => any>(fn: Func): Func & { asyncResource: AsyncResource }; // ----------------------------- +1.1 Complexity index (+1.1 atomic)
            
                            
                        
runInAsyncScope Complexity Index 1.6 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * Call the provided function with the provided arguments in the
                     * execution context of the async resource. This will establish the
                     * context, trigger the AsyncHooks before callbacks, call the function,
                     * trigger the AsyncHooks after callbacks, and then restore the original
                     * execution context.
                     * @param fn The function to call in the execution context of this
                     *   async resource.
                     * @param thisArg The receiver to be used for the function call.
                     * @param args Optional arguments to pass to the function.
                     */
                    runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result; // ------- +1.6 Complexity index (+1.6 atomic)
            
                            
                        
emitDestroy Complexity Index 0.2 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * Call AsyncHooks destroy callbacks.
                     */
                    emitDestroy(): void; // ----------------------------------------------------------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
            
                            
                        
asyncId Complexity Index 0.1 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * @return the unique ID assigned to this AsyncResource instance.
                     */
                    asyncId(): number; // ------------------------------------------------------ +0.1 Complexity index (+0.1 atomic)
            
                            
                        
triggerAsyncId Complexity Index 0.1 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * @return the trigger ID for this AsyncResource instance.
                     */
                    triggerAsyncId(): number; // ---------------------------------------- +0.1 Complexity index (+0.1 atomic)
            
                            
                        
disable Complexity Index 0.2 Cyclomatic complexity 1
                            
                                
                
                    /**
                     * This method disables the instance of `AsyncLocalStorage`. All subsequent calls
                     * to `asyncLocalStorage.getStore()` will return `undefined` until
                     * `asyncLocalStorage.run()` is called again.
                     *
                     * When calling `asyncLocalStorage.disable()`, all current contexts linked to the
                     * instance will be exited.
                     *
                     * Calling `asyncLocalStorage.disable()` is required before the
                     * `asyncLocalStorage` can be garbage collected. This does not apply to stores
                     * provided by the `asyncLocalStorage`, as those objects are garbage collected
                     * along with the corresponding async resources.
                     *
                     * This method is to be used when the `asyncLocalStorage` is not in use anymore
                     * in the current process.
                     */
                    disable(): void; // ------------------------------------------------------------------------ +0.2 Complexity index (+0.2 atomic)
            
                            
                        
getStore Complexity Index 0.3 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * This method returns the current store. If this method is called outside of an
                     * asynchronous context initialized by calling `asyncLocalStorage.run`, it will
                     * return `undefined`.
                     */
                    getStore(): T | undefined; // ------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
            
                            
                        
run Complexity Index 1.3 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * This methods runs a function synchronously within a context and return its
                     * return value. The store is not accessible outside of the callback function or
                     * the asynchronous operations created within the callback.
                     *
                     * Optionally, arguments can be passed to the function. They will be passed to the
                     * callback function.
                     *
                     * I the callback function throws an error, it will be thrown by `run` too. The
                     * stacktrace will not be impacted by this call and the context will be exited.
                     */
                    // TODO: Apply generic vararg once available
                    run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R; // -------------------- +1.3 Complexity index (+1.3 atomic)
            
                            
                        
exit Complexity Index 1.1 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * This methods runs a function synchronously outside of a context and return its
                     * return value. The store is not accessible within the callback function or the
                     * asynchronous operations created within the callback.
                     *
                     * Optionally, arguments can be passed to the function. They will be passed to the
                     * callback function.
                     *
                     * If the callback function throws an error, it will be thrown by `exit` too. The
                     * stacktrace will not be impacted by this call and the context will be
                     * re-entered.
                     */
                    // TODO: Apply generic vararg once available
                    exit<R>(callback: (...args: any[]) => R, ...args: any[]): R; // ----------------------------- +1.1 Complexity index (+1.1 atomic)
            
                            
                        
enterWith Complexity Index 0.4 Cyclomatic complexity 1
                            
                                
                    
            
                    /**
                     * Calling `asyncLocalStorage.enterWith(store)` will transition into the context
                     * for the remainder of the current synchronous execution and will persist
                     * through any following asynchronous calls.
                     */
                    enterWith(store: T): void; // ------------------------------------------------------------- +0.4 Complexity index (+0.4 atomic)