TypeScript-Web-Framework/ts-web-framework

View on GitHub

Showing 5 of 29 total issues

Function constructor has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    constructor(public request: Request, public response: Response) {
        process.on('unhandledRejection', error => {
            Debug.xlog("Exception:", error);
            this.httpInternalServerError();
        });
Severity: Minor
Found in src/core/Controller.ts - About 6 hrs 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

Controller has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

export abstract class Controller implements InterfaceController {
    // noinspection TypeScriptAbstractClassConstructorCanBeMadeProtected
    constructor(public request: Request, public response: Response) {
        process.on('unhandledRejection', error => {
            Debug.xlog("Exception:", error);
Severity: Minor
Found in src/core/Controller.ts - About 2 hrs to fix

    Function inject has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public inject () : void {
            if (Manifiest.exists("http.security.xss")) {
                this.use(helmet.xssFilter(<any>{
                    setOnOldIE: Manifiest.get("http.security.xss.setOnOldIE"),
                    reportUri: Manifiest.get("http.security.xss.reportUri")
    Severity: Minor
    Found in src/middleware/Security.middleware.ts - About 2 hrs 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

    Avoid deeply nested control flow statements.
    Open

                            if (typeof manifiestRoot === 'string' && manifiestRoot.trim().length > 0) route.push(manifiestRoot.trim());
    Severity: Major
    Found in src/app.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                      if (callback !== true) return this.httpBadRequest(itm.message);
      Severity: Major
      Found in src/core/Controller.ts - About 45 mins to fix
        Severity
        Category
        Status
        Source
        Language