Bernd-L/exDateMan

View on GitHub

Showing 30 of 114 total issues

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

  async ngOnInit() {
    this.inventoryUuid = this.route.snapshot.params.inventoryUuid;
    this.thingUuid = this.route.snapshot.params.thingUuid;

    await this.is.ready;
Severity: Minor
Found in frontend/src/app/components/add-stock/add-stock.component.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

      Function ngOnInit has 26 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;
      
          await this.is.ready;
      Severity: Minor
      Found in frontend/src/app/components/edit-thing/edit-thing.component.ts - About 1 hr to fix

        Function updateUsersProjection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          public static updateUsersProjection(event: UserEvent) {
            const index = Authentication.usersProjection.findIndex(
              (user: User) => user.uuid === event.data.userUuid,
            );
        
        
        Severity: Minor
        Found in backend/src/app/authentication.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 checkEventLegitimacy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          public checkEventLegitimacy(
            event: InventoryEvent,
            userUuid: string,
          ): boolean {
            try {
        Severity: Minor
        Found in backend/src/app/authorization.ts - About 45 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 (process.env.EDM_SSL === "true") {
              // Use SSL
        
              /**
               * The private key for SSL
        Severity: Major
        Found in backend/src/server.ts - About 40 mins to fix

          Function loadUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            async loadUser(): Promise<void> {
              try {
                this.user = ((await this.as.getCurrentUser()).user as unknown) as User; // TODO FixMe
                console.log(this.user);
          
          
          Severity: Minor
          Found in frontend/src/app/components/account/account.component.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

          Avoid too many return statements within this function.
          Open

                return false;
          Severity: Major
          Found in backend/src/app/authorization.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return (
                    Authorization.inventoriesProjection[event.inventoryUuid].ownerUuid ===
                      userUuid ||
                    Authorization.inventoriesProjection[
                      event.inventoryUuid
            Severity: Major
            Found in backend/src/app/authorization.ts - About 30 mins to fix

              Function fetchInventoryEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                private async fetchInventoryEvents() {
                  // Initialize the inventory projection dictionary
                  InventoryService.inventoriesProjection = {};
              
                  // Wait for EventSourcingService to be ready
              Severity: Minor
              Found in frontend/src/app/services/inventory/inventory.service.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