Aam-Digital/ndb-core

View on GitHub

Showing 282 of 313 total issues

EntitiesTableComponent has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

@UntilDestroy()
@Component({
  selector: "app-entities-table",
  standalone: true,
  imports: [

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

              {
                header: {
                  label: "Total # of old children",
                  groupedBy: [],
                  result: 5,
    Severity: Major
    Found in src/app/features/reporting/data-aggregation.service.spec.ts and 1 other location - About 2 hrs to fix
    src/app/features/reporting/reporting/reporting.component.spec.ts on lines 171..191

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

    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

          {
            header: { label: "Total # of schools", groupedBy: [], result: 3 },
            subRows: [
              {
                header: {
    src/app/features/reporting/data-aggregation.service.spec.ts on lines 462..486

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

    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

    File ability.service.spec.ts has 289 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { fakeAsync, TestBed, tick, waitForAsync } from "@angular/core/testing";
    
    import { AbilityService } from "./ability.service";
    import { BehaviorSubject, Subject } from "rxjs";
    import { Note } from "../../../child-dev-project/notes/model/note";
    Severity: Minor
    Found in src/app/core/permissions/ability/ability.service.spec.ts - About 2 hrs to fix

      Function transformRawDataToEntities has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        async transformRawDataToEntities(
          rawData: any[],
          entityType: string,
          columnMapping: ColumnMapping[],
        ): Promise<Entity[]> {
      Severity: Minor
      Found in src/app/core/import/import.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

      File reporting.component.spec.ts has 285 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
        ComponentFixture,
        fakeAsync,
        TestBed,
        tick,
      Severity: Minor
      Found in src/app/features/reporting/reporting/reporting.component.spec.ts - About 2 hrs to fix

        File inherited-value.service.spec.ts has 283 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { fakeAsync, TestBed, tick } from "@angular/core/testing";
        
        import { InheritedValueService } from "./inherited-value.service";
        import { Entity } from "../entity/model/entity";
        import { EntityMapperService } from "../entity/entity-mapper/entity-mapper.service";
        Severity: Minor
        Found in src/app/core/default-values/inherited-value.service.spec.ts - About 2 hrs to fix

          File entity-list.component.ts has 282 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {
            Component,
            EventEmitter,
            Input,
            OnChanges,
          Severity: Minor
          Found in src/app/core/entity-list/entity-list/entity-list.component.ts - About 2 hrs to fix

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

            export class Entity {
              /**
               * The entity's type.
               * In classes extending Entity this is usually overridden by the class annotation `@DatabaseEntity('NewEntity')`.
               * The type needs to be used as routing path in lower case. The routing path can be defined in the configuration file.
            Severity: Minor
            Found in src/app/core/entity/model/entity.ts - About 2 hrs to fix

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

              @Injectable()
              export class PouchDatabase extends Database {
                /**
                 * Small helper function which creates a database with in-memory PouchDB initialized
                 */
              Severity: Minor
              Found in src/app/core/database/pouch-database.ts - About 2 hrs to fix

                File entity-actions.service.spec.ts has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { fakeAsync, TestBed, tick } from "@angular/core/testing";
                import { EntityActionsService } from "./entity-actions.service";
                import { EntityMapperService } from "../entity-mapper/entity-mapper.service";
                import {
                  MatSnackBar,
                Severity: Minor
                Found in src/app/core/entity/entity-actions/entity-actions.service.spec.ts - About 2 hrs to fix

                  File admin-entity-field.component.ts has 273 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import {
                    Component,
                    Inject,
                    Input,
                    OnChanges,

                    Function generate has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async generate<T extends Entity>(
                        filterConfigs: FilterConfig[],
                        entityConstructor: EntityConstructor<T>,
                        data: T[],
                        onlyShowUsedOptions = false,
                    Severity: Major
                    Found in src/app/core/filter/filter-generator/filter-generator.service.ts - About 2 hrs to fix

                      File pouch-database.spec.ts has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*
                       *     This file is part of ndb-core.
                       *
                       *     ndb-core is free software: you can redistribute it and/or modify
                       *     it under the terms of the GNU General Public License as published by
                      Severity: Minor
                      Found in src/app/core/database/pouch-database.spec.ts - About 2 hrs to fix

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

                          it("produces a summary of all records when there are duplicates", () => {
                            setRecordsAndGenerateSummary(
                              { category: "PENCIL", amount: 1 },
                              { category: "PAPER", amount: 1 },
                              { category: "PENCIL", amount: 3 },
                        src/app/core/entity-details/related-entities-with-summary/related-entities-with-summary.component.spec.ts on lines 166..175

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

                        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

                          it("should emit valueChange event when changed form is valid (static mode)", () => {
                            spyOn(component.valueChange, "emit");
                            component.form.setValue({
                              mode: "static",
                              value: "New value",
                        src/app/core/admin/admin-entity-details/admin-entity-field/default-value-options/default-value-options.component.spec.ts on lines 64..75

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

                        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

                          it("should emit valueChange event when changed form is valid (dynamic mode)", () => {
                            spyOn(component.valueChange, "emit");
                            component.form.setValue({
                              mode: "dynamic",
                              value: "New value",
                        src/app/core/admin/admin-entity-details/admin-entity-field/default-value-options/default-value-options.component.spec.ts on lines 52..63

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

                        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

                          it("produces summary of all records when both average and total are true", () => {
                            setRecordsAndGenerateSummary(
                              { category: "PENCIL", amount: 1 },
                              { category: "PAPER", amount: 1 },
                              { category: "PENCIL", amount: 3 },
                        src/app/core/entity-details/related-entities-with-summary/related-entities-with-summary.component.spec.ts on lines 116..125

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

                        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

                          it("should display date range filter when report mode is reporting", () => {
                            const report = new ReportEntity();
                            report.mode = "reporting";
                            component.reports = [report];
                        
                        
                        src/app/features/reporting/reporting/select-report/select-report.component.spec.ts on lines 58..67

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

                        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

                          it("should mark relation with end date in the future as active", () => {
                            const relation = new TimePeriod();
                            relation.start = moment().subtract(1, "week").toDate();
                            relation.end = moment().add(1, "day").toDate();
                            expect(relation.isActive).toBeTrue();
                        src/app/core/entity-details/related-time-period-entities/time-period.spec.ts on lines 42..47

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language