NGO-DB/ndb-core

View on GitHub

Showing 128 of 288 total issues

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

    export function resizeImage(
      file: File,
      maxSize = 360,
    ): Promise<HTMLCanvasElement> {
      const image = new Image();
    Severity: Minor
    Found in src/app/features/file/file-utils.ts - About 1 hr to fix

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

            generateEntities(): EventNote[] {
              const data = [];
          
              for (const activity of this.demoActivities.entities) {
                for (

          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

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

            private getAllDistances(compareCoordinates: Coordinates[], e: Entity) {
              const results: number[] = [];
              for (const prop of this.config.coordinatesProperties) {
                for (const coord of compareCoordinates) {
                  if (e[prop] && coord) {
          Severity: Minor
          Found in src/app/features/location/view-distance/view-distance.component.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 migrateFormFieldConfigView2ViewComponent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const migrateFormFieldConfigView2ViewComponent: ConfigMigration = (
            key,
            configPart,
          ) => {
            if (
          Severity: Minor
          Found in src/app/core/config/config.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

          Severity
          Category
          Status
          Source
          Language