NGO-DB/ndb-core

View on GitHub

Showing 307 of 308 total issues

Function exports has 42 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 build/karma-ci.conf.js - About 1 hr to fix

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

      constructor(
        elementRef: ElementRef<HTMLElement>,
        errorStateMatcher: ErrorStateMatcher,
        @Optional() @Self() ngControl: NgControl,
        @Optional() parentForm: NgForm,
    src/app/core/basic-datatypes/boolean/edit-boolean/boolean-input/boolean-input.component.ts on lines 34..48

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

    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

      constructor(
        elementRef: ElementRef<HTMLElement>,
        errorStateMatcher: ErrorStateMatcher,
        @Optional() @Self() ngControl: NgControl,
        @Optional() parentForm: NgForm,
    src/app/core/common-components/basic-autocomplete/basic-autocomplete.component.ts on lines 156..170

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

    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 parseFieldDefinition has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private parseFieldDefinition(
        fieldDef: ConfigFieldRaw,
        entityType: string,
      ): { id: string; schema: EntitySchemaField } {
        const fieldId = fieldDef.id ?? generateIdFromLabel(fieldDef.label);
    Severity: Minor
    Found in src/app/features/config-setup/config-import-parser.service.ts - About 1 hr to fix

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

          const everyoneInOneEventAbsent = ActivityAttendance.create(new Date(), [
            generateEventWithAttendance([
              ["1", AttendanceLogicalStatus.PRESENT],
              ["2", AttendanceLogicalStatus.ABSENT],
            ]),
      src/app/child-dev-project/attendance/model/activity-attendance.spec.ts on lines 130..143
      src/app/child-dev-project/attendance/model/activity-attendance.spec.ts on lines 155..168

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

      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

        beforeEach(() => {
          fixture = TestBed.createComponent(TestEntityDetailsComponent);
          component = fixture.componentInstance;
      
          Object.assign(component, routeConfig);
      src/app/core/entity-details/entity-details/entity-details.component.spec.ts on lines 67..77

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

      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("converts objects to keys for database format", () => {
          const testOptionKey = "TEST_1";
          const entity = new TestEntity();
          entity.option = TEST_CONFIG.find((c) => c.id === testOptionKey);
      
      
      src/app/child-dev-project/notes/model/note.spec.ts on lines 137..147

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

      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

          const record = ActivityAttendance.create(new Date(), [
            generateEventWithAttendance([
              ["1", AttendanceLogicalStatus.PRESENT],
              ["2", AttendanceLogicalStatus.ABSENT],
            ]),
      src/app/child-dev-project/attendance/model/activity-attendance.spec.ts on lines 58..71
      src/app/child-dev-project/attendance/model/activity-attendance.spec.ts on lines 155..168

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

      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

          const record = ActivityAttendance.create(new Date(), [
            generateEventWithAttendance([
              ["1", AttendanceLogicalStatus.PRESENT],
              ["2", AttendanceLogicalStatus.ABSENT],
            ]),
      src/app/child-dev-project/attendance/model/activity-attendance.spec.ts on lines 58..71
      src/app/child-dev-project/attendance/model/activity-attendance.spec.ts on lines 130..143

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

      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("transforms interactionType from config", function () {
          const interactionTypeKey = "HOME_VISIT";
          const entity = new Note();
          entity.category = testInteractionTypes.find(
            (c) => c.id === interactionTypeKey,
      Severity: Major
      Found in src/app/child-dev-project/notes/model/note.spec.ts and 1 other location - About 1 hr to fix
      src/app/core/basic-datatypes/configurable-enum/configurable-enum-datatype/configurable-enum.datatype.spec.ts on lines 72..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 86.

      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

          for (const child of children) {
            const relation = new ChildSchoolRelation();
            relation.childId = child.getId();
            relation.schoolId = school.getId();
            relation.start = new Date();
      Severity: Major
      Found in src/app/core/export/query.service.spec.ts and 1 other location - About 1 hr to fix
      src/app/core/export/data-transformation-service/data-transformation.service.spec.ts on lines 416..422

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

      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

        beforeEach(() => {
          fixture = TestBed.createComponent(EntityDetailsComponent);
          component = fixture.componentInstance;
      
          Object.assign(component, routeConfig);
      src/app/core/entity-details/abstract-entity-details/abstract-entity-details.component.spec.ts on lines 53..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 86.

      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

          for (const child of students) {
            const childSchoolRel = new ChildSchoolRelation();
            childSchoolRel.childId = child.getId();
            childSchoolRel.schoolId = school.getId();
            childSchoolRel.start = new Date();
      src/app/core/export/query.service.spec.ts on lines 668..674

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

      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

        it("adds an info alert", function () {
          const message = "info alert";
          service.addInfo(message);
      
          expect(service.alerts[0].message).toEqual(message);
      Severity: Major
      Found in src/app/core/alerts/alert.service.spec.ts and 2 other locations - About 1 hr to fix
      src/app/core/alerts/alert.service.spec.ts on lines 41..47
      src/app/core/alerts/alert.service.spec.ts on lines 49..55

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

      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

        it("adds a warning alert", function () {
          const message = "warning alert";
          service.addWarning(message);
      
          expect(service.alerts[0].message).toEqual(message);
      Severity: Major
      Found in src/app/core/alerts/alert.service.spec.ts and 2 other locations - About 1 hr to fix
      src/app/core/alerts/alert.service.spec.ts on lines 33..39
      src/app/core/alerts/alert.service.spec.ts on lines 49..55

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

      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

        it("adds a danger alert", function () {
          const message = "danger alert";
          service.addDanger(message);
      
          expect(service.alerts[0].message).toEqual(message);
      Severity: Major
      Found in src/app/core/alerts/alert.service.spec.ts and 2 other locations - About 1 hr to fix
      src/app/core/alerts/alert.service.spec.ts on lines 33..39
      src/app/core/alerts/alert.service.spec.ts on lines 41..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 85.

      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 handleInheritedMode has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private handleInheritedMode(
          formGroup: FormGroup,
          fieldName: string,
          defaultValueConfig: DefaultValueConfig,
          isNew: boolean,

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

          toBeEnabled: (util) => {
            return makeCustomMatcher(
              (form: AbstractControl) => form.enabled,
              (form) => `Expected form ${util.pp(form.value)} to be enabled`,
              (form) => `Expected form ${util.pp(form.value)} not to be enabled`,
        Severity: Major
        Found in src/app/utils/test-utils/form-matchers.spec.ts and 1 other location - About 1 hr to fix
        src/app/utils/test-utils/form-matchers.spec.ts on lines 29..35

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

        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

          toBeValidForm: (util) => {
            return makeCustomMatcher(
              (form: AbstractControl) => form.valid,
              (form) => `Expected form ${util.pp(form.value)} to be valid`,
              (form) => `Expected form ${util.pp(form.value)} not to be valid`,
        Severity: Major
        Found in src/app/utils/test-utils/form-matchers.spec.ts and 1 other location - About 1 hr to fix
        src/app/utils/test-utils/form-matchers.spec.ts on lines 36..42

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

        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 initSideDetails has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private async initSideDetails(
            side: MatchingSideConfig,
            sideIndex: number,
          ): Promise<MatchingSide> {
            const newSide = Object.assign({}, side) as MatchingSide; // we are transforming it into this type here
          Severity
          Category
          Status
          Source
          Language