Bernd-L/exDateMan

View on GitHub

Showing 30 of 114 total issues

File authentication.ts has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Router, Request, Response } from "express";
import { readFileSync } from "fs";
import * as jwt from "jsonwebtoken";
import { ServerEvents, UserEvent } from "./server-events";
import { compareSync, hashSync } from "bcrypt";
Severity: Minor
Found in backend/src/app/authentication.ts - About 2 hrs to fix

    Function applyCategoryEvent has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    private async applyCategoryEvent(categoryEvent: Event) {
    await this.is.ready;
     
    const newCategory = {
    name: categoryEvent.data.categoryData?.name,
    Severity: Major
    Found in frontend/src/app/services/category/category.service.ts - About 2 hrs to fix

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

      private async fetchAllInventoryThingStocks() {
      console.log("fetch all Stocks");
       
      // Wait for the other services to be ready
      await this.ts.ready;
      Severity: Minor
      Found in frontend/src/app/services/stock/stock.service.ts - About 2 hrs to fix

      Function applyStockEvent has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      private async applyStockEvent(stockEvent: Event) {
      await this.is.ready;
       
      /**
      * One date representing now
      Severity: Minor
      Found in frontend/src/app/services/stock/stock.service.ts - About 1 hr to fix

        Function fetchAllInventoryCategories has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        private async fetchAllInventoryCategories() {
        // Wait for the other services to be ready
        await this.is.ready;
        await this.ess.ready;
         
         
        Severity: Minor
        Found in frontend/src/app/services/category/category.service.ts - About 1 hr to fix

        Function applyCategoryEvent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        private async applyCategoryEvent(categoryEvent: Event) {
        await this.is.ready;
         
        const newCategory = {
        name: categoryEvent.data.categoryData?.name,
        Severity: Minor
        Found in frontend/src/app/services/category/category.service.ts - About 1 hr to fix

        Function fetchSingleInventoryEvents has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        private async fetchSingleInventoryEvents(
        inventoryUuid: string
        ): Promise<void> {
        let res: Event[] = await this.api
        .get<Event[]>(this.baseUrl + "/events/" + inventoryUuid)
        Severity: Minor
        Found in frontend/src/app/services/EventSourcing/event-sourcing.service.ts - About 1 hr to fix

          Function checkEventLegitimacy has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          public checkEventLegitimacy(
          event: InventoryEvent,
          userUuid: string,
          ): boolean {
          try {
          Severity: Minor
          Found in backend/src/app/authorization.ts - About 1 hr to fix

            Function start has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async start() {
            // Connect to the db
            await db();
             
            // Set the ports
            Severity: Minor
            Found in backend/src/server.ts - About 1 hr to fix

              Function ngOnInit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async ngOnInit(): Promise<void> {
              this.inventoryUuid = this.route.snapshot.params.inventoryUuid;
              this.thingUuid = this.route.snapshot.params.thingUuid;
              this.stockUuid = this.route.snapshot.params.stockUuid;
               
               
              Severity: Minor
              Found in frontend/src/app/components/edit-stock/edit-stock.component.ts - About 1 hr to fix

                Function updateInventoriesProjection has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                public updateInventoriesProjection(event: InventoryEvent): Inventory {
                // Make sure the event is about an inventory
                if (event.data.itemType !== itemType.INVENTORY)
                throw new Error(
                "Cannot update inventoriesProjection with non-inventory event.",
                Severity: Minor
                Found in backend/src/app/authorization.ts - About 1 hr to fix

                  Function deleteInventory has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  async deleteInventory(): Promise<void> {
                  const dialogRef: MatDialogRef<any> = this.dialog.open(
                  DeleteConfirmationDialogComponent,
                  {
                  data: { inventory: this.inventory }

                  Function fetchSingleInventoryEvents has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  private async fetchSingleInventoryEvents(
                  inventoryUuid: string
                  ): Promise<void> {
                  let res: Event[] = await this.api
                  .get<Event[]>(this.baseUrl + "/events/" + inventoryUuid)
                  Severity: Minor
                  Found in frontend/src/app/services/EventSourcing/event-sourcing.service.ts - About 1 hr to fix

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

                  private async handleLogin(req: Request, res: Response) {
                  try {
                  /**
                  * The saltedPwdHash from the users projection
                  */
                  Severity: Minor
                  Found in backend/src/app/authentication.ts - About 1 hr to fix

                    Function updateInventoriesProjection has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    private updateInventoriesProjection(event: Event): Inventory {
                    /**
                    * The inventory to be created or updated (ignored for delete events)
                    */
                    const newInventory = {
                    Severity: Minor
                    Found in frontend/src/app/services/inventory/inventory.service.ts - About 1 hr to fix

                      Function updateStock has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async updateStock(
                      stock: Stock,
                      inventoryUuid: string,
                      thingUuid: string
                      ): Promise<void> {
                      Severity: Minor
                      Found in frontend/src/app/services/stock/stock.service.ts - About 1 hr to fix

                        Function handleRegister has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        private async handleRegister(req: Request, res: Response) {
                        // Check for duplicate email
                        if (
                        Authentication.usersProjection.find((user: User) => {
                        return user.email === req.body.email;
                        Severity: Minor
                        Found in backend/src/app/authentication.ts - About 1 hr to fix

                          Function exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function (config) {
                          config.set({
                          basePath: '',
                          frameworks: ['jasmine', '@angular-devkit/build-angular'],
                          plugins: [
                          Severity: Minor
                          Found in frontend/karma.conf.js - About 1 hr to fix

                            Function applyThingEvent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            private applyThingEvent(event: Event, inventoryUuid: string) {
                            /**
                            * The index of the event in the projection, if any
                            */
                            const index = ThingService.inventoryTingsProjection[
                            Severity: Minor
                            Found in frontend/src/app/services/thing/thing.service.ts - About 1 hr to fix

                              Function getCurrentUser has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async getCurrentUser(): Promise<GetStatusResponse> {
                              let response: GetStatusResponse;
                               
                              try {
                              // Try to get the data from the API
                              Severity: Minor
                              Found in frontend/src/app/services/auth/auth.service.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language