NGO-DB/ndb-core

View on GitHub

Showing 128 of 288 total issues

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

      private async applyChanges(externallyUpdatedEntity: T) {
        if (this.formIsUpToDate(externallyUpdatedEntity)) {
          Object.assign(this.entity, externallyUpdatedEntity);
          return;
        }

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

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

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

                                    protected generateEntities(): HistoricalEntityData[] {
                                      const config = this.configGenerator.entities[0];
                                      const attributes: any[] = Object.keys(
                                        (
                                          config.data[
                                  Severity: Minor
                                  Found in src/app/features/historical-data/demo-historical-data-generator.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language