Showing 12 of 52 total issues
Function bindWorker
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private bindWorker(classType: Constructor, filePath: string, workerThreads: typeof import ("worker_threads")) {
const instance = new classType();
const storage: WorkerHandlers = [];
Function bindHandler
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public bindHandler(target: IController, classType: Constructor, property: string, rawParams: FunctionParam[]): RequestHandler {
const paramsGetter = buildParamsFunc(rawParams);
return async (req, res) => {
const ctrl: IController = Object.assign(new classType, target);
Function processBase
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async processBase() {
const auth = DependencyContainer.getContainer().getById("auth") as IAuth<object, object, IUser<object, object>>;
const { app } = this.options;
return async (classType: Constructor<IController>) => {
Function extractBase
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extractBase(type: Constructor) {
let base: any = { type: null };
if (type === String) {
base.type = "string";
Function buildSchema
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function buildSchema(target: Constructor) {
const instance = new target();
const reflectedProperties = (getDtoProps(Object.getPrototypeOf(instance)));
let requiredProperties = [...reflectedProperties];
Function extractParamsAliases
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function extractParamsAliases(rawParams: FunctionParam[]) {
const params = [];
for (const { name, type } of rawParams) {
const md = metadata(type);
- 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 extractBase
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function extractBase(type: Constructor) {
let base: any = { type: null };
if (type === String) {
base.type = "string";
- 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
Consider simplifying this complex logical expression. Open
if (metadata(dependency).hasMetadata(INJECT_ID) || predefined) {
const id = depId ||
metadata(Object.getPrototypeOf(parentObject), propertyKey).getMetadata(AUTOWIRED) ||
metadata(dependency).getMetadata(INJECT_ID) ||
Function proccessDependency
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private async proccessDependency(parentObject: Instance, dependency: Constructor, depId?: string, propertyKey?: string | symbol) {
// Check if there are any predefined/instantiated components of this type
const predefined = ComponentSettingsStorage.has(dependency) || this.container.contain(dependency);
if (metadata(dependency).hasMetadata(INJECT_ID) || predefined) {
- 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 findExport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function findExport(imp: any): any {
if (imp.default && isMainComponent(imp.default)) {
return imp.default;
}
- 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 processProperty
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function processProperty<T>(instance: Instance, propertyKey: string | symbol, objectPart: any, prototype: any) {
const type = reflectType(instance, propertyKey);
const sourceValue = objectPart[propertyKey];
const isPrimitive = [ Number, String, Boolean, Object ].includes(type);
- 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 ArrayOf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const ArrayOf = (targetClass: any ) => (target: Propotype, propertyKey: string | symbol) => {
const items =
isObject(targetClass) ? targetClass :
isFunction(targetClass) ? DtoSchemaStorage.get(targetClass) :
{ type: targetClass.name.toLoweCase() };
- 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"