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 = [];
Severity: Minor
Found in src/worker/worker.loader.ts - About 1 hr to fix

    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);
    Severity: Minor
    Found in src/routing/controllers/controller.loader.ts - About 1 hr to fix

      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>) => {
      Severity: Minor
      Found in src/routing/controllers/controller.loader.ts - About 1 hr to fix

        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";
        Severity: Minor
        Found in src/dto/dto.validator.ts - About 1 hr to fix

          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];
          Severity: Minor
          Found in src/dto/dto.validator.ts - About 1 hr to fix

            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);
            Severity: Minor
            Found in src/comiler/binders.ts - About 55 mins to fix

            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";
            Severity: Minor
            Found in src/dto/dto.validator.ts - About 55 mins to fix

            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) ||
            Severity: Major
            Found in src/dependency/dependency.composer.ts - About 40 mins to fix

              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) {
              Severity: Minor
              Found in src/dependency/dependency.composer.ts - About 35 mins to fix

              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;
                  }
              
              
              Severity: Minor
              Found in src/utils/directory.loader.ts - About 35 mins to fix

              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);
              
              
              Severity: Minor
              Found in src/dto/dto.transformer.ts - About 25 mins to fix

              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() };
              Severity: Minor
              Found in src/dto/dto.decorators.ts - About 25 mins to fix

              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

              Severity
              Category
              Status
              Source
              Language