Showing 6 of 8 total issues
File TestInject.ts
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { expect } from 'chai';
import { spy, stub } from 'sinon';
import { BaseOptions, Container, Contract } from '../../src/Container.js';
import { BaseError } from '../../src/error/BaseError.js';
Function getInject
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
export function getInject(target: any): Array<Dependency> {
if (Reflect.has(target, injectionSymbol)) {
const existing = Reflect.get(target, injectionSymbol);
if (Array.isArray(existing)) {
return existing;
- 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 getFields
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
export function getFields(target: object): Array<Binding> {
if (Reflect.has(target, fieldSymbol)) {
const existing = Reflect.get(target, fieldSymbol);
// console.log('target has fields', target, existing);
if (Array.isArray(existing)) {
- 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 create
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
public async create<TReturn, TOptions extends BaseOptions>(
contract: Contract<TReturn, TOptions>,
options: PartialOptions<TOptions> = {},
...args: ExtraArgs
): Promise<TReturn> {
- 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
TODO found Open
// TODO: this shouldn't need any, but TInner is not sufficiently provable and causes a TS error
- Exclude checks
TODO found Open
// TODO: do these options need to extend BaseOptions?
- Exclude checks