Aam-Digital/ndb-core

View on GitHub

Showing 282 of 313 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    this.entityFields = Array.from(this.entityConstructor.schema.entries())
      .filter(([key, field]) => field.label)
      .map(([key, field]) => ({
        key: key,
        label: field.label,
src/app/core/admin/admin-entity/admin-entity-general-settings/admin-entity-general-settings.component.ts on lines 108..114

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 78.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      private async getReportResults(
        report: ReportEntity,
        from: Date,
        to: Date,
      ): Promise<any[]> {
    Severity: Minor
    Found in src/app/features/reporting/reporting/reporting.component.ts - About 1 hr to fix

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

        async updateFromAddressSearch(
          value: GeoLocation | undefined,
          skipConfirmation: boolean = false,
        ) {
          if (
      Severity: Minor
      Found in src/app/features/location/address-edit/address-edit.component.ts - About 1 hr to fix

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

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

          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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export const genders: ConfigurableEnumValue[] = [
              {
                id: "",
                label: "",
              },
            Severity: Major
            Found in src/app/child-dev-project/children/model/genders.ts and 1 other location - About 1 hr to fix
            src/app/child-dev-project/warning-level.ts on lines 24..41

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                for (const task of evaluationEntries) {
                  const targetNumber = faker.number.int({ min: 5, max: 50 });
                  dashboardProgressWidget.parts.push({
                    label: task,
                    currentValue: faker.number.int(targetNumber),
            src/app/features/dashboard-widgets/progress-dashboard-widget/demo-progress-dashboard-widget-generator.service.ts on lines 44..51

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                let form: EntityForm<any> = {
                  formGroup: new FormGroup<any>({
                    field1: new FormControl(),
                    field2: new FormControl(),
                  }),
            Severity: Major
            Found in src/app/core/default-values/inherited-value.service.spec.ts and 1 other location - About 1 hr to fix
            src/app/core/default-values/inherited-value.service.spec.ts on lines 126..135

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                let form: EntityForm<any> = {
                  formGroup: new FormGroup<any>({
                    field1: new FormControl(),
                    field2: new FormControl(),
                  }),
            Severity: Major
            Found in src/app/core/default-values/inherited-value.service.spec.ts and 1 other location - About 1 hr to fix
            src/app/core/default-values/inherited-value.service.spec.ts on lines 83..92

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                for (const task of this.DEMO_TASKS) {
                  const targetNumber = faker.number.int({ min: 5, max: 50 });
                  dashboardProgressWidget.parts.push({
                    label: task,
                    currentValue: faker.number.int(targetNumber),
            src/app/features/dashboard-widgets/progress-dashboard-widget/demo-progress-dashboard-widget-generator.service.ts on lines 64..71

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              [
                {
                  id: "",
                  label: "",
                },
            Severity: Major
            Found in src/app/child-dev-project/warning-level.ts and 1 other location - About 1 hr to fix
            src/app/child-dev-project/children/model/genders.ts on lines 3..20

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

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

                  setDefaultValue(
                    targetFormControl: AbstractControl<any, any>,
                    fieldConfig: EntitySchemaField,
                  ) {
                    switch (fieldConfig.defaultValue.value) {
                Severity: Minor
                Found in src/app/core/default-values/dynamic-placeholder-value.service.ts - About 1 hr to fix

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

                    constructor(
                      private confirmationDialog: ConfirmationDialogService,
                      private snackBar: MatSnackBar,
                      private router: Router,
                      private entityMapper: EntityMapperService,
                  Severity: Minor
                  Found in src/app/core/entity/entity-actions/entity-actions.service.ts - About 1 hr to fix

                    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 (
                      Severity
                      Category
                      Status
                      Source
                      Language