Bernd-L/exDateMan

View on GitHub

Showing 114 of 114 total issues

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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

          {
            icon: Icon.Thing,
            title: this.ts.things[this.inventoryUuid].find(
              thing => thing.uuid === this.thingUuid
            ).name,
    Severity: Major
    Found in frontend/src/app/components/stocks/stocks.component.ts and 2 other locations - About 2 hrs to fix
    frontend/src/app/components/add-stock/add-stock.component.ts on lines 64..70
    frontend/src/app/components/edit-stock/edit-stock.component.ts on lines 74..80

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 78.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

          {
            icon: Icon.Thing,
            title: this.ts.things[this.inventoryUuid].find(
              thing => thing.uuid === this.thingUuid
            ).name,
    frontend/src/app/components/edit-stock/edit-stock.component.ts on lines 74..80
    frontend/src/app/components/stocks/stocks.component.ts on lines 56..62

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 78.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

          {
            icon: Icon.Thing,
            title: this.ts.things[this.inventoryUuid].find(
              thing => thing.uuid === this.thingUuid
            ).name,
    frontend/src/app/components/add-stock/add-stock.component.ts on lines 64..70
    frontend/src/app/components/stocks/stocks.component.ts on lines 56..62

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 78.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    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 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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        onEditStock(): void {
          this.editStock().then(() => {
            if (!this.oof) {
              this.router.navigate([".."], { relativeTo: this.route });
            }
      frontend/src/app/components/account/account.component.ts on lines 76..82
      frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 175..181

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 68.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        onSubmit(): void {
          this.updateInventory().then(() => {
            if (!this.oof) {
              this.router.navigate(["things"], { relativeTo: this.route });
            }
      frontend/src/app/components/account/account.component.ts on lines 76..82
      frontend/src/app/components/edit-stock/edit-stock.component.ts on lines 103..109

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 68.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        onSave(): void {
          this.save().then(() => {
            if (!this.oof) {
              this.router.navigate(["/inventories"], { relativeTo: this.route });
            }
      Severity: Major
      Found in frontend/src/app/components/account/account.component.ts and 2 other locations - About 1 hr to fix
      frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 175..181
      frontend/src/app/components/edit-stock/edit-stock.component.ts on lines 103..109

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 68.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

      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 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

      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 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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            async testLogin(): Promise<void> {
              const res = await this.as.getCurrentUser();
          
              this.authStatus = res;
          
          
          Severity: Major
          Found in frontend/src/app/app.component.ts and 1 other location - About 1 hr to fix
          frontend/src/app/components/side-nav/side-nav.component.ts on lines 33..39

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 62.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            async testLogin(): Promise<void> {
              const res = await this.as.getCurrentUser();
          
              this.authStatus = res;
          
          
          Severity: Major
          Found in frontend/src/app/components/side-nav/side-nav.component.ts and 1 other location - About 1 hr to fix
          frontend/src/app/app.component.ts on lines 58..64

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 62.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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 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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  CrumbTrailComponent.crumbs = [
                    {
                      icon: Icon.Inventory,
                      title: this.inventory.name,
                      routerLink: `/inventories`
              Severity: Major
              Found in frontend/src/app/components/things/things.component.ts and 1 other location - About 1 hr to fix
              frontend/src/app/components/categories/categories.component.ts on lines 48..58

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  CrumbTrailComponent.crumbs = [
                    {
                      icon: Icon.Inventory,
                      title: this.inventory.name,
                      routerLink: `/inventories`
              frontend/src/app/components/things/things.component.ts on lines 42..52

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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
                Severity
                Category
                Status
                Source
                Language