Aam-Digital/ndb-core

View on GitHub

Showing 131 of 308 total issues

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

  handle(formGroup: FormGroup, entity: Entity): void {
    let schema = entity.getSchema();

    let defaultValueConfigs = Array.from(schema.entries()).filter(
      ([key, fieldSchema]) => {
Severity: Minor
Found in src/app/core/entity/default-value.service.ts - About 1 hr to fix

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

      private updateIfPossible() {
        const currentVersion =
          localStorage.getItem(LatestChangesDialogService.VERSION_KEY) || "";
        if (currentVersion.startsWith(this.UPDATE_PREFIX)) {
          // Sometimes this is triggered multiple times for one update
    Severity: Minor
    Found in src/app/core/ui/latest-changes/update-manager.service.ts - About 1 hr to fix

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

        private generateHealthCheckHistoryForChild(child: Child): HealthCheck[] {
          const data = [];
      
          let date = new Date(child.admissionDate.getTime());
          let previousRecord = new HealthCheck("");

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

          private detectBrowser(): Browser {
            let browser: Browser;
            const userAgent = this.window.navigator.userAgent;
            if (/opera/i.test(userAgent)) {
              browser = Browser.Opera;
        Severity: Minor
        Found in src/app/core/pwa-install/pwa-install.service.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 selectDay has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          selectDay(newDate?: Date) {
            if (!newDate) {
              this.selectedDate = undefined;
              this.selectedEvent = undefined;
              this.selectedEventAttendance = undefined;

        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 getRouteDataFromRouter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          private getRouteDataFromRouter(path: string, routes: Route[]) {
            // removing leading slash
            path = path.replace(/^\//, "");
        
            function isPathMatch(genericPath: string, path: string) {
        Severity: Minor
        Found in src/app/core/permissions/permission-guard/abstract-permission.guard.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 delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          async delete<E extends Entity>(
            entityParam: E | E[],
            navigate: boolean = false,
          ): Promise<boolean> {
            let textForDeleteEntity = "";
        Severity: Minor
        Found in src/app/core/entity/entity-actions/entity-actions.service.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

        Function resolveByManualEdit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          public async resolveByManualEdit(diffStringToApply: string) {
            const originalDoc = merge({}, this.doc);
            const diffToApply = JSON.parse(diffStringToApply);
            merge(this.doc, diffToApply);
        
        

        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 calculateAggregations has a Cognitive Complexity of 8 (exceeds 5 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 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

        Function getReadableValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function getReadableValue(value: any): any {
          if (isConfigurableEnum(value)) {
            return value.label;
          } else if (Array.isArray(value)) {
            if (value.length > 0 && value.every((val) => value.indexOf(val) === 0)) {

        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 transformEntityToDatabaseFormat has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          public transformEntityToDatabaseFormat(
            entity: Entity,
            schema?: EntitySchema,
          ): any {
            if (!schema) {
        Severity: Minor
        Found in src/app/core/entity/schema/entity-schema.service.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

        Function getAttendanceArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          private getAttendanceArray(
            events: Note[],
            includeSchool = false,
          ): AttendanceInfo[] {
            const attendances: AttendanceInfo[] = [];
        Severity: Minor
        Found in src/app/core/export/query.service.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

        Function generateRowsFromActivityAttendance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          private generateRowsFromActivityAttendance(
            att: ActivityAttendance,
            from: Moment,
            to: Moment,
          ): AttendanceWeekRow[] {

        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 countPercentage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          private countPercentage(
            matchingType: AttendanceLogicalStatus,
            rounded: boolean = false,
          ) {
            const calculatedStats = this.events
        Severity: Minor
        Found in src/app/child-dev-project/attendance/model/activity-attendance.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

        Function generateFormFieldStory has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          editComponent,
          defaultValue,
          withTooltip = true,
          additionalSchema = {},
          additionalProviders = [],
        Severity: Minor
        Found in src/app/core/entity/default-datatype/edit-component-story-utils.ts - About 35 mins to fix

          Function testDatatype has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            dataType: D | (new (params: any) => D),
            objectValue,
            databaseValue,
            additionalSchemaFieldConfig?: any,
            additionalProviders?: any[],
          Severity: Minor
          Found in src/app/core/entity/schema/entity-schema.service.spec.ts - About 35 mins to fix

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

              private processToken(token: string): SessionInfo {
                if (!token) {
                  throw new Error("No token received from Keycloak");
                }
            
            
            Severity: Minor
            Found in src/app/core/session/auth/keycloak/keycloak-auth.service.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

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

              public transformDatabaseToEntityFormat<T = Entity>(
                data: any,
                schema: EntitySchema,
              ): T {
                const transformed = {};
            Severity: Minor
            Found in src/app/core/entity/schema/entity-schema.service.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

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

              private detectOS(): OS {
                let os: OS;
                const userAgent = this.window.navigator.userAgent;
                if (/iphone|ipad|ipod|macintosh/i.test(userAgent)) {
                  if (this.window.innerWidth < 1025) {
            Severity: Minor
            Found in src/app/core/pwa-install/pwa-install.service.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

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

              @Input() set icon(icon: string) {
                if (!icon) {
                  this._icon = undefined;
                  return;
                }

            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