open-learning-exchange/planet

View on GitHub
src/app/teams/teams.component.ts

Summary

Maintainability
C
1 day
Test Coverage

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

    Function getTeams has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

      getTeams() {
        const thirtyDaysAgo = time => {
          const date = new Date(time);
          return new Date(date.getFullYear(), date.getMonth(), date.getDate() - 30).getTime();
        };
    Severity: Minor
    Found in src/app/teams/teams.component.ts - About 1 hr to fix

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

        archiveClick(team) {
          this.deleteDialog = this.dialog.open(DialogsPromptComponent, {
            data: {
              okClick: this.archiveTeam(team),
              changeType: 'delete',
      Severity: Major
      Found in src/app/teams/teams.component.ts and 2 other locations - About 1 hr to fix
      src/app/tasks/tasks.component.ts on lines 87..96
      src/app/teams/teams-view-finances.component.ts on lines 161..170

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

      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

                this.teams.data = this.teamList(teams.filter((team: any) => {
                  return (team.type === this.mode || (team.type === undefined && this.mode === 'team'))
                  && this.excludeIds.indexOf(team._id) === -1;
                }));
      Severity: Major
      Found in src/app/teams/teams.component.ts and 1 other location - About 1 hr to fix
      src/app/teams/teams.component.ts on lines 118..120

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

      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

            this.teams.data = this.teamList(teams.filter(team => {
              return (team.type === this.mode || (team.type === undefined && this.mode === 'team')) && this.excludeIds.indexOf(team._id) === -1;
            }));
      Severity: Major
      Found in src/app/teams/teams.component.ts and 1 other location - About 1 hr to fix
      src/app/teams/teams.component.ts on lines 132..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 69.

      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

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

        @HostListener('window:resize') onResize() {
          this.deviceType = this.deviceInfoService.getDeviceType();
          this.isMobile = this.deviceType === DeviceType.MOBILE;
        }
      Severity: Major
      Found in src/app/teams/teams.component.ts and 1 other location - About 1 hr to fix
      src/app/users/users-table.component.ts on lines 144..147

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

      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 8 locations. Consider refactoring.
      Invalid

        ngAfterViewInit() {
          this.teams.sort = this.sort;
          this.teams.paginator = this.paginator;
        }
      Severity: Major
      Found in src/app/teams/teams.component.ts and 7 other locations - About 35 mins to fix
      src/app/feedback/feedback.component.ts on lines 100..103
      src/app/manager-dashboard/manager-fetch.component.ts on lines 53..56
      src/app/manager-dashboard/reports/myplanet-table.component.ts on lines 46..49
      src/app/manager-dashboard/reports/reports-detail-activities.component.ts on lines 60..63
      src/app/manager-dashboard/reports/reports-table.component.ts on lines 41..44
      src/app/meetups/meetups.component.ts on lines 87..90
      src/app/surveys/surveys.component.ts on lines 92..95

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

      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

      There are no issues that match your filters.

      Category
      Status