Aam-Digital/ndb-core

View on GitHub

Showing 123 of 288 total issues

Function generateEntities has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public generateEntities(): Note[] {
    const data = [];

    for (const child of this.demoChildren.entities) {
      if (!child.isActive) {

    Function createMatch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async createMatch() {
        const newMatchEntity = new (this.entityRegistry.get(
          this.onMatch.newEntityType,
        ))();
    
    

      Function calculateGroupBy has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private calculateGroupBy(
          properties: string[],
          aggregations: any[],
          label: string,
          data: any[],
      Severity: Minor
      Found in src/app/features/reporting/data-aggregation.service.ts - About 1 hr to fix

        Function initSettings has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private initSettings() {
            this.fieldIdForm = this.fb.control(this.fieldId, {
              validators: [Validators.required],
              asyncValidators: [
                uniqueIdValidator(Array.from(this.entityType.schema.keys())),

          Function createEventsIndex has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private createEventsIndex(): Promise<void> {
              const designDoc = {
                _id: "_design/events_index",
                views: {
                  by_date: {
          Severity: Minor
          Found in src/app/child-dev-project/attendance/attendance.service.ts - About 1 hr to fix

            Function transformRawDataToEntities has 33 lines of code (exceeds 25 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 1 hr to fix

              Function onDropListEntered has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                onDropListEntered({ item, container }: CdkDragEnter) {
                  if (container == this.placeholder) {
                    return;
                  }
                  const placeholderElement: HTMLElement =
              Severity: Minor
              Found in src/app/core/admin/admin-entity-list/admin-entity-list.component.ts - About 1 hr to fix

                Function selectDay has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function generateOrUpdateDetailsViewConfig has 32 lines of code (exceeds 25 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

                    Function recalculateStats has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      recalculateStats() {
                        this.individualStatusTypeCounts = new Map();
                        this.individualLogicalStatusCounts = new Map();
                    
                        for (const event of this.events) {
                    Severity: Minor
                    Found in src/app/child-dev-project/attendance/model/activity-attendance.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 alignAvailableAndSelectedEntities has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private async alignAvailableAndSelectedEntities(availableEntities: E[]) {
                        if (this.form.value === null || this.form.value === 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 generateEntities has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public generateEntities(): Note[] {
                        const data = [];
                    
                        for (const child of this.demoChildren.entities) {
                          if (!child.isActive) {

                    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 30 lines of code (exceeds 25 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 1 hr to fix

                      Function generateChildEntities has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function generateChildEntities(): Child[] {
                        const data = [];
                      
                        const a1 = new Child("1");
                        a1.name = "Arjun A.";
                      Severity: Minor
                      Found in src/app/child-dev-project/children/children.service.spec.ts - About 1 hr to fix

                        Function withState has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          static withState(
                            loginState = LoginState.LOGGED_IN,
                            data: Entity[] = [new User(TEST_USER)],
                          ): ModuleWithProviders<MockedTestingModule> {
                            environment.session_type = SessionType.mock;
                        Severity: Minor
                        Found in src/app/utils/mocked-testing.module.ts - About 1 hr to fix

                          Function anonymizeEntity has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async anonymizeEntity(entity: Entity): Promise<CascadingActionResult> {
                              if (!entity.getConstructor().hasPII) {
                                // entity types that are generally without PII by default retain all fields
                                // this should only be called through a cascade action anyway
                                return new CascadingActionResult();
                          Severity: Minor
                          Found in src/app/core/entity/entity-actions/entity-anonymize.service.ts - About 1 hr to fix

                            Function generateIndexOnProperty has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              generateIndexOnProperty<
                                E extends Entity,
                                REF extends keyof E & string,
                                SEC extends keyof E & string,
                              >(
                            Severity: Minor
                            Found in src/app/core/entity/database-indexing/database-indexing.service.ts - About 1 hr to fix

                              Function exportFile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                async exportFile(data: any[], entityConstructor: EntityConstructor) {
                                  const entitySchema = entityConstructor.schema;
                                  const columnLabels = new Map<string, string>();
                              
                                  for (const [id, field] of entitySchema.entries()) {
                              Severity: Minor
                              Found in src/app/core/export/download-service/download.service.ts - About 1 hr to fix

                                Function generateEntities has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  generateEntities(): School[] {
                                    const data = [];
                                
                                    for (let i = 1; i <= this.config.count; i++) {
                                      const school = new School(String(i));
                                Severity: Minor
                                Found in src/app/child-dev-project/schools/demo-school-generator.service.ts - About 1 hr to fix

                                  Function descriptionForValidator has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    private descriptionForValidator(
                                      validator: DynamicValidator | string,
                                      validationValue: any,
                                    ): string {
                                      switch (validator) {
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language