Aam-Digital/ndb-core

View on GitHub

Showing 131 of 308 total issues

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

              constructor(components: ComponentRegistry) {
                components.addAll([
                  [
                    "Import",
                    () =>
            Severity: Minor
            Found in src/app/core/import/import.module.ts - About 1 hr to fix

              Function testEntitySubclass has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function testEntitySubclass(
                entityType: string,
                entityClass: EntityConstructor,
                expectedDatabaseFormat: any,
                skipTestbedConfiguration = false,
              Severity: Minor
              Found in src/app/core/entity/model/entity.spec.ts - About 1 hr to fix

                Function generateChildSchoolRelationEntities has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function generateChildSchoolRelationEntities(): ChildSchoolRelation[] {
                  const data: ChildSchoolRelation[] = [];
                  const rel1: ChildSchoolRelation = new ChildSchoolRelation("1");
                  rel1.childId = "Child:1";
                  rel1.schoolId = "School:1";
                Severity: Minor
                Found in src/app/child-dev-project/children/children.service.spec.ts - About 1 hr to fix

                  Function generateAserResultsForChild has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private generateAserResultsForChild(child: Child): Aser[] {
                      const data = [];
                  
                      let date = new Date(child.admissionDate.getTime());
                      let previousResult = new Aser("");

                    Function login has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async login(): Promise<SessionInfo> {
                        if (!this.keycloakInitialised) {
                          this.keycloakInitialised = true;
                          const loggedIn = await this.keycloak.init({
                            config: window.location.origin + "/assets/keycloak.json",
                    Severity: Minor
                    Found in src/app/core/session/auth/keycloak/keycloak-auth.service.ts - About 1 hr to fix

                      Function initSideDetails has a Cognitive Complexity of 10 (exceeds 5 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

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

                        private getValidator(
                          key: DynamicValidator,
                          value: any,
                        ):
                          | { async?: false; fn: ValidatorFn }

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

                        getEntityTypesReferencingType(type: string): {
                          entityType: EntityConstructor;
                          referencingProperties: string[];
                        }[] {
                          const referencingTypes = [];
                      Severity: Minor
                      Found in src/app/core/entity/schema/entity-schema.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 handleDynamicMode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

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

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

                        private async loadAttendanceOfAbsentees() {
                          const previousMonday = moment()
                            .startOf("isoWeek")
                            .subtract(1, "week")
                            .add(this.daysOffset, "days");

                        Function getAttendanceReport has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private getAttendanceReport(
                            attendances: AttendanceInfo[],
                          ): AttendanceReport[] {
                            const participantMap: { [key in string]: AttendanceReport } = {};
                            attendances.forEach((attendance) => {
                        Severity: Minor
                        Found in src/app/core/export/query.service.ts - About 1 hr to fix

                          Function loadActivities has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private async loadActivities() {
                              this.allActivities = await this.entityMapper
                                .loadType(RecurringActivity)
                                .then((res) => res.filter((a) => a.isActive));
                          
                          

                            Function drop has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              drop(event: CdkDragDrop<ColumnConfig[], ColumnConfig[]>) {
                                const prevFieldsArray = event.previousContainer.data;
                                const newFieldsArray = event.container.data;
                            
                                if (

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

                                  @Input() set icon(icon: string) {
                                    if (!icon) {
                                      this._icon = undefined;
                                      return;
                                    }
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language