inversify/inversify-express-utils

View on GitHub
src/server.ts

Summary

Maintainability
C
1 day
Test Coverage

File server.ts has 317 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import express, { Application, NextFunction, Request, RequestHandler, Response, Router } from 'express';
import { interfaces } from 'inversify';
import { BaseMiddleware, Controller } from './index';
import { getControllersFromMetadata, getControllersFromContainer, getControllerMetadata, getControllerMethodMetadata, getControllerParameterMetadata, instanceOfIHttpActionResult } from './utils';
import { TYPE, METADATA_KEY, DEFAULT_ROUTING_ROOT_PATH, PARAMETER_TYPE, DUPLICATED_CONTROLLER_NAME, } from './constants';
Severity: Minor
Found in src/server.ts - About 3 hrs to fix

    Function registerControllers has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private registerControllers(): void {
        // Fake HttpContext is needed during registration
        this._container
          .bind<HttpContext>(TYPE.HttpContext)
          .toConstantValue({} as HttpContext);
    Severity: Minor
    Found in src/server.ts - About 2 hrs to fix

      Function extractParameters has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private extractParameters(
          req: Request,
          res: Response,
          next: NextFunction,
          params: Array<ParameterMetadata>,
      Severity: Minor
      Found in src/server.ts - About 1 hr to fix

        Function handlerFactory has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private handlerFactory(
            controllerName: string,
            key: string,
            parameterMetadata: Array<ParameterMetadata>,
          ): express.RequestHandler {
        Severity: Minor
        Found in src/server.ts - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status