open-learning-exchange/planet

View on GitHub

Showing 215 of 299 total issues

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

export class CoursesSearchListComponent {

  @Input() category;
  @Input() items;
  @Input() selected: string[] = [];
Severity: Major
Found in src/app/courses/search-courses/courses-search.component.ts and 1 other location - About 1 day to fix
src/app/resources/search-resources/resources-search.component.ts on lines 37..64

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 263.

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

export class ResourcesSearchListComponent {

  @Input() category;
  @Input() items;
  @Input() selected: string[] = [];
src/app/courses/search-courses/courses-search.component.ts on lines 36..63

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 263.

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

  sendResource() {
    return (selectedPlanets: any) => {
      const items = this.selection.selected.map(id => findByIdInArray(this.resources.data, id));
      this.syncService.createChildPullDoc(items, 'resources', selectedPlanets).subscribe(() => {
        const childType = {
Severity: Major
Found in src/app/resources/resources.component.ts and 1 other location - About 1 day to fix
src/app/courses/courses.component.ts on lines 438..450

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 212.

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

  sendCourse() {
    return (selected: any) => {
      const coursesToSend = this.selection.selected.map(id => findByIdInArray(this.courses.data, id));
      this.syncService.createChildPullDoc(coursesToSend, 'courses', selected).subscribe(() => {
        const childType = {
Severity: Major
Found in src/app/courses/courses.component.ts and 1 other location - About 1 day to fix
src/app/resources/resources.component.ts on lines 364..376

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 212.

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

File teams-view.component.ts has 510 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, OnInit, OnDestroy, ViewChild, AfterViewChecked, ViewEncapsulation, HostListener } from '@angular/core';
import { CouchService } from '../shared/couchdb.service';
import { Router, ActivatedRoute, ParamMap } from '@angular/router';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { MatTab } from '@angular/material/tabs';
Severity: Major
Found in src/app/teams/teams-view.component.ts - About 1 day to fix

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

    export const levelList = [
      { 'label': $localize`Early Education`, 'value': 'Early Education' },
      { 'label': $localize`Lower Primary`, 'value': 'Lower Primary' },
      { 'label': $localize`Upper Primary`, 'value': 'Upper Primary' },
      { 'label': $localize`Lower Secondary`, 'value': 'Lower Secondary' },
    Severity: Major
    Found in src/app/resources/resources-constants.ts and 1 other location - About 7 hrs to fix
    src/app/resources/resources-constants.ts on lines 45..54

    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 179.

    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

    export const openWith = [
      { 'label': $localize`Just download`, 'value': 'Just download' },
      { 'label': $localize`HTML`, 'value': 'HTML' },
      { 'label': $localize`PDF.js`, 'value': 'PDF.js' },
      { 'label': $localize`Bell-Reader`, 'value': 'Bell-Reader' },
    Severity: Major
    Found in src/app/resources/resources-constants.ts and 1 other location - About 7 hrs to fix
    src/app/resources/resources-constants.ts on lines 27..36

    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 179.

    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

    File courses.component.ts has 425 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Component, OnInit, AfterViewInit, ViewChild, OnDestroy, HostListener, Input, OnChanges } from '@angular/core';
    import { CouchService } from '../shared/couchdb.service';
    import { DialogsPromptComponent } from '../shared/dialogs/dialogs-prompt.component';
    import { MatDialog, MatDialogRef } from '@angular/material/dialog';
    import { MatPaginator, PageEvent } from '@angular/material/paginator';
    Severity: Minor
    Found in src/app/courses/courses.component.ts - About 6 hrs to fix

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

      describe('PageNotFoundComponent', () => {
        let component: PageNotFoundComponent;
        let fixture: ComponentFixture<PageNotFoundComponent>;
      
        beforeEach(async(() => {
      Severity: Major
      Found in src/app/page-not-found/page-not-found.component.spec.ts and 5 other locations - About 6 hrs to fix
      src/app/courses/view-courses/courses-view.component.spec.ts on lines 5..25
      src/app/manager-dashboard/manager-dashboard.component.spec.ts on lines 6..26
      src/app/meetups/view-meetups/meetups-view.component.spec.ts on lines 5..25
      src/app/notifications/notifications.component.spec.ts on lines 5..25
      src/app/shared/forms/form-error-messages.component.spec.ts on lines 5..25

      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 158.

      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 6 locations. Consider refactoring.
      Open

      describe('ManagerDashboardComponent', () => {
        let component: ManagerDashboardComponent;
        let fixture: ComponentFixture<ManagerDashboardComponent>;
      
        beforeEach(async(() => {
      src/app/courses/view-courses/courses-view.component.spec.ts on lines 5..25
      src/app/meetups/view-meetups/meetups-view.component.spec.ts on lines 5..25
      src/app/notifications/notifications.component.spec.ts on lines 5..25
      src/app/page-not-found/page-not-found.component.spec.ts on lines 6..26
      src/app/shared/forms/form-error-messages.component.spec.ts on lines 5..25

      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 158.

      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 6 locations. Consider refactoring.
      Open

      describe('ViewMeetupsComponent', () => {
        let component: MeetupsViewComponent;
        let fixture: ComponentFixture<MeetupsViewComponent>;
      
        beforeEach(async(() => {
      Severity: Major
      Found in src/app/meetups/view-meetups/meetups-view.component.spec.ts and 5 other locations - About 6 hrs to fix
      src/app/courses/view-courses/courses-view.component.spec.ts on lines 5..25
      src/app/manager-dashboard/manager-dashboard.component.spec.ts on lines 6..26
      src/app/notifications/notifications.component.spec.ts on lines 5..25
      src/app/page-not-found/page-not-found.component.spec.ts on lines 6..26
      src/app/shared/forms/form-error-messages.component.spec.ts on lines 5..25

      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 158.

      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 6 locations. Consider refactoring.
      Open

      describe('ViewCoursesComponent', () => {
        let component: CoursesViewComponent;
        let fixture: ComponentFixture<CoursesViewComponent>;
      
        beforeEach(async(() => {
      Severity: Major
      Found in src/app/courses/view-courses/courses-view.component.spec.ts and 5 other locations - About 6 hrs to fix
      src/app/manager-dashboard/manager-dashboard.component.spec.ts on lines 6..26
      src/app/meetups/view-meetups/meetups-view.component.spec.ts on lines 5..25
      src/app/notifications/notifications.component.spec.ts on lines 5..25
      src/app/page-not-found/page-not-found.component.spec.ts on lines 6..26
      src/app/shared/forms/form-error-messages.component.spec.ts on lines 5..25

      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 158.

      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 6 locations. Consider refactoring.
      Open

      describe('NotificationsComponent', () => {
        let component: NotificationsComponent;
        let fixture: ComponentFixture<NotificationsComponent>;
      
        beforeEach(async(() => {
      Severity: Major
      Found in src/app/notifications/notifications.component.spec.ts and 5 other locations - About 6 hrs to fix
      src/app/courses/view-courses/courses-view.component.spec.ts on lines 5..25
      src/app/manager-dashboard/manager-dashboard.component.spec.ts on lines 6..26
      src/app/meetups/view-meetups/meetups-view.component.spec.ts on lines 5..25
      src/app/page-not-found/page-not-found.component.spec.ts on lines 6..26
      src/app/shared/forms/form-error-messages.component.spec.ts on lines 5..25

      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 158.

      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

        openSendResourceDialog() {
          this.dialogsListService.getListAndColumns('communityregistrationrequests', { 'registrationRequest': 'accepted' })
          .pipe(takeUntil(this.onDestroy$))
          .subscribe((planet) => {
            const data = { okClick: this.sendResource().bind(this),
      Severity: Major
      Found in src/app/resources/resources.component.ts and 1 other location - About 5 hrs to fix
      src/app/courses/courses.component.ts on lines 424..436

      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 152.

      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

        openSendCourseDialog() {
          this.dialogsListService.getListAndColumns('communityregistrationrequests', { 'registrationRequest': 'accepted' })
          .pipe(takeUntil(this.onDestroy$))
          .subscribe((planet) => {
            const data = { okClick: this.sendCourse().bind(this),
      Severity: Major
      Found in src/app/courses/courses.component.ts and 1 other location - About 5 hrs to fix
      src/app/resources/resources.component.ts on lines 350..362

      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 152.

      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

      CoursesComponent has 42 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Component({
        selector: 'planet-courses',
        templateUrl: './courses.component.html',
        styleUrls: [ './courses.scss' ]
      })
      Severity: Minor
      Found in src/app/courses/courses.component.ts - About 5 hrs to fix

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

          masterToggle() {
            const start = this.paginator.pageIndex * this.paginator.pageSize;
            const end = start + this.paginator.pageSize;
            if (this.isAllSelected()) {
              this.selection.clear();
        Severity: Major
        Found in src/app/manager-dashboard/manager-fetch.component.ts and 1 other location - About 5 hrs to fix
        src/app/courses/courses.component.ts on lines 302..310

        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 140.

        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

          masterToggle() {
            const start = this.paginator.pageIndex * this.paginator.pageSize;
            const end = start + this.paginator.pageSize;
            if (this.isAllSelected()) {
              this.selection.clear();
        Severity: Major
        Found in src/app/courses/courses.component.ts and 1 other location - About 5 hrs to fix
        src/app/manager-dashboard/manager-fetch.component.ts on lines 69..77

        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 140.

        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

        TeamsViewComponent has 39 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Component({
          templateUrl: './teams-view.component.html',
          styleUrls: [ './teams-view.scss' ],
          encapsulation: ViewEncapsulation.None
        })
        Severity: Minor
        Found in src/app/teams/teams-view.component.ts - About 5 hrs to fix

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

            reset({ startingSelection = {}, isInit = false } = {}) {
              this.selected = this.categories.reduce((select, category) => ({ ...select, [category.label]: [] }), {});
              this.selected = { ...this.selected, ...startingSelection };
              if (!isInit) {
                this.searchListComponents.forEach((component) => component.reset());
          src/app/courses/search-courses/courses-search.component.ts on lines 105..111

          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 135.

          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

          Severity
          Category
          Status
          Source
          Language