open-learning-exchange/planet

View on GitHub

Showing 190 of 280 total issues

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

  recordSearch(complete = false) {
    if (this.resources.filter !== '') {
      this.searchService.recordSearch({
        text: this._titleSearch,
        type: this.dbName,
Severity: Major
Found in src/app/resources/resources.component.ts and 1 other location - About 3 hrs to fix
src/app/courses/courses.component.ts on lines 359..367

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

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

  recordSearch(complete = false) {
    if (this.courses.filter !== '') {
      this.searchService.recordSearch({
        text: this._titleSearch,
        type: this.dbName,
Severity: Major
Found in src/app/courses/courses.component.ts and 1 other location - About 3 hrs to fix
src/app/resources/resources.component.ts on lines 324..332

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

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 resources-add.component.ts has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { UserService } from '../shared/user.service';
import {
  FormBuilder,
Severity: Minor
Found in src/app/resources/resources-add.component.ts - About 3 hrs to fix

    TeamsService has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Injectable({
      providedIn: 'root'
    })
    export class TeamsService {
    
    
    Severity: Minor
    Found in src/app/teams/teams.service.ts - About 3 hrs to fix

      ReportsService has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Injectable({
        providedIn: 'root'
      })
      export class ReportsService {
      
      
      Severity: Minor
      Found in src/app/manager-dashboard/reports/reports.service.ts - About 3 hrs to fix

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

        export const educationLevel = [
          { 'label': $localize`Beginner`, 'value': 'Beginner' },
          { 'label': $localize`Intermediate`, 'value': 'Intermediate' },
          { 'label': $localize`Advanced`, 'value': 'Advanced' },
          { 'label': $localize`Expert`, 'value': 'Expert' }
        Severity: Major
        Found in src/app/users/user-constants.ts and 1 other location - About 3 hrs to fix
        src/app/resources/resources-constants.ts on lines 38..43

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

        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 media = [
          { 'label': $localize`Text`, 'value': 'Text' },
          { 'label': $localize`Graphic/Pictures`, 'value': 'Graphic/Pictures' },
          { 'label': $localize`Audio/Music/Book`, 'value': 'Audio/Music/Book' },
          { 'label': $localize`Video`, 'value': 'Video' }
        Severity: Major
        Found in src/app/resources/resources-constants.ts and 1 other location - About 3 hrs to fix
        src/app/users/user-constants.ts on lines 1..6

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

        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 surveys.component.ts has 285 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Component, OnInit, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';
        import { Router, ActivatedRoute } from '@angular/router';
        import { FormGroup } from '@angular/forms';
        import { MatDialog, MatDialogRef } from '@angular/material/dialog';
        import { MatPaginator, PageEvent } from '@angular/material/paginator';
        Severity: Minor
        Found in src/app/surveys/surveys.component.ts - About 2 hrs to fix

          PlanetTagInputComponent has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

          @Component({
            'selector': 'planet-tag-input',
            'templateUrl': './planet-tag-input.component.html',
            'styleUrls': [ 'planet-tag-input.scss' ],
            'providers': [
          Severity: Minor
          Found in src/app/shared/forms/planet-tag-input.component.ts - About 2 hrs to fix

            Function generatePDF has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              generatePDF() {
                const formattedBirthDate = format(new Date(this.user.birthDate), 'MMM d, y, h:mm:ss a');
                let contentArray = [
                  {
                    text: `${`${this.user.firstName}'s achievements`}`,
            Severity: Major
            Found in src/app/users/users-achievements/users-achievements.component.ts - About 2 hrs to fix

              ChatSidebarComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

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

                PlanetTagInputDialogComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
                Open

                @Component({
                  'templateUrl': 'planet-tag-input-dialog.component.html',
                  'styles': [ `
                    :host .mat-list-option span {
                      font-weight: inherit;
                Severity: Minor
                Found in src/app/shared/forms/planet-tag-input-dialog.component.ts - About 2 hrs to fix

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

                    isAllSelected() {
                      const itemsShown = Math.min(this.paginator.length - (this.paginator.pageIndex * this.paginator.pageSize), this.paginator.pageSize);
                      return this.selection.selected.length === itemsShown;
                    }
                  Severity: Major
                  Found in src/app/courses/courses.component.ts and 1 other location - About 2 hrs to fix
                  src/app/manager-dashboard/manager-fetch.component.ts on lines 63..66

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

                  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

                    isAllSelected() {
                      const itemsShown = Math.min(this.paginator.length - (this.paginator.pageIndex * this.paginator.pageSize), this.paginator.pageSize);
                      return this.selection.selected.length === itemsShown;
                    }
                  Severity: Major
                  Found in src/app/manager-dashboard/manager-fetch.component.ts and 1 other location - About 2 hrs to fix
                  src/app/courses/courses.component.ts on lines 296..299

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

                  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

                  CoursesProgressLeaderComponent has 23 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Component({
                    templateUrl: 'courses-progress-leader.component.html',
                    styleUrls: [ 'courses-progress.scss' ]
                  })
                  export class CoursesProgressLeaderComponent implements OnInit, OnDestroy {
                  Severity: Minor
                  Found in src/app/courses/progress-courses/courses-progress-leader.component.ts - About 2 hrs to fix

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

                      onFilterChange(filterValue: string, field: string) {
                        this.filter[field] = filterValue === 'All' ? '' : filterValue;
                        // Force filter to update by setting it to a space if empty
                        this.feedback.filter = this.feedback.filter ? this.feedback.filter : ' ';
                      }
                    Severity: Major
                    Found in src/app/feedback/feedback.component.ts and 1 other location - About 2 hrs to fix
                    src/app/shared/dialogs/dialogs-list.component.ts on lines 192..196

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

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

                      ngOnInit() {
                        if (this.route.snapshot.data.update) {
                          this.initUpdate();
                        }
                        this.loginForm = this.formBuilder.group({
                    Severity: Major
                    Found in src/app/configuration/configuration.component.ts - About 2 hrs to fix

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

                        isAllSelected() {
                          const itemsShown = Math.min(this.paginator.length - (this.paginator.pageIndex * this.paginator.pageSize), this.paginator.pageSize);
                          return this.selection.selected.length === itemsShown;
                        }
                      Severity: Major
                      Found in src/app/meetups/meetups.component.ts and 1 other location - About 2 hrs to fix
                      src/app/users/users-table.component.ts on lines 157..160

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

                      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.component.ts has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { Component, OnInit, ViewChild, AfterViewInit, Input, EventEmitter, Output, HostListener } from '@angular/core';
                      import { MatDialog } from '@angular/material/dialog';
                      import { MatPaginator } from '@angular/material/paginator';
                      import { MatSort } from '@angular/material/sort';
                      import { MatTableDataSource } from '@angular/material/table';
                      Severity: Minor
                      Found in src/app/teams/teams.component.ts - About 2 hrs to fix

                        CommunityComponent has 22 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        @Component({
                          selector: 'planet-community',
                          templateUrl: './community.component.html',
                          preserveWhitespaces: true,
                          styleUrls: [ './community.scss' ],
                        Severity: Minor
                        Found in src/app/community/community.component.ts - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language