Aam-Digital/ndb-core

View on GitHub

Showing 122 of 287 total issues

File ability.service.spec.ts has 284 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 { Child } from "../../../child-dev-project/children/model/child";
Severity: Minor
Found in src/app/core/permissions/ability/ability.service.spec.ts - About 2 hrs to fix

    Function generate has 70 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 entities-table.component.ts has 278 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
        AfterViewInit,
        Component,
        EventEmitter,
        Input,

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

        @Component({
          selector: "app-basic-autocomplete",
          templateUrl: "basic-autocomplete.component.html",
          styleUrls: ["./basic-autocomplete.component.scss"],
          providers: [

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

          import {
            Component,
            Inject,
            Input,
            OnChanges,

            File entity-actions.service.spec.ts has 271 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

              PouchDatabase has 23 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-list.component.ts has 263 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

                  QueryService has 21 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Injectable({
                    providedIn: "root",
                  })
                  export class QueryService {
                    private entities: { [type: string]: { [id: string]: Entity } } = {};
                  Severity: Minor
                  Found in src/app/core/export/query.service.ts - About 2 hrs to fix

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

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

                      File session-manager.service.spec.ts has 252 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/session/session-service/session-manager.service.spec.ts - About 2 hrs to fix

                        File pouch-database.ts has 251 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.ts - About 2 hrs to fix

                          File attendance.service.ts has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { Injectable } from "@angular/core";
                          import { EntityMapperService } from "../../core/entity/entity-mapper/entity-mapper.service";
                          import moment from "moment";
                          import { RecurringActivity } from "./model/recurring-activity";
                          import { ActivityAttendance } from "./model/activity-attendance";
                          Severity: Minor
                          Found in src/app/child-dev-project/attendance/attendance.service.ts - About 2 hrs to fix

                            Function generateFormFieldStory has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function generateFormFieldStory<T>(
                              editComponent,
                              defaultValue,
                              withTooltip = true,
                              additionalSchema = {},
                            Severity: Minor
                            Found in src/app/core/entity/default-datatype/edit-component-story-utils.ts - About 1 hr to fix

                              Function createNotesIndex has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                private async createNotesIndex(): Promise<any> {
                                  const designDoc = {
                                    _id: "_design/notes_index",
                                    views: {
                                      note_child_by_date: {
                              Severity: Minor
                              Found in src/app/child-dev-project/children/children.service.ts - About 1 hr to fix

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

                                  private calculateAggregations(
                                    aggregations: Aggregation[] = [],
                                    data?: any[],
                                    additionalValues: GroupByDescription[] = [],
                                  ): ReportRow[] {
                                Severity: Minor
                                Found in src/app/features/reporting/data-aggregation.service.ts - About 1 hr to fix

                                  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

                                    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

                                      Function generateOrUpdateDetailsViewConfig has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        private generateOrUpdateDetailsViewConfig(
                                          fieldDef: ConfigFieldRaw,
                                          entityType: string,
                                          fieldId: string,
                                        ) {
                                      Severity: Minor
                                      Found in src/app/features/config-setup/config-import-parser.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 cascadeActionToRelatedEntities has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        protected async cascadeActionToRelatedEntities(
                                          entity: Entity,
                                          compositeAction: (
                                            relatedEntity: Entity,
                                            refField?: string,
                                      Severity: Minor
                                      Found in src/app/core/entity/entity-actions/cascading-entity-action.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language