open-learning-exchange/planet

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

Summary

Maintainability
C
7 hrs
Test Coverage

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

    SurveysComponent has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Component({
      'templateUrl': './surveys.component.html',
      styles: [ `
        /* Column Widths */
        .mat-column-select {
    Severity: Minor
    Found in src/app/surveys/surveys.component.ts - About 2 hrs to fix

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

        applyFilter(filterValue: string) {
          this.surveys.filter = filterValue;
          this.selection.deselect(...selectedOutOfFilter(this.surveys.filteredData, this.selection, this.paginator));
        }
      Severity: Major
      Found in src/app/surveys/surveys.component.ts and 1 other location - About 1 hr to fix
      src/app/meetups/meetups.component.ts on lines 109..112

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

      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.deleteDialog = this.dialog.open(DialogsPromptComponent, {
            data: {
              okClick,
              amount,
              changeType: 'delete',
      Severity: Major
      Found in src/app/surveys/surveys.component.ts and 1 other location - About 1 hr to fix
      src/app/shared/forms/planet-tag-input-dialog.component.ts on lines 188..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 56.

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

        ngAfterViewInit() {
          this.surveys.sort = this.sort;
          this.surveys.paginator = this.paginator;
        }
      Severity: Major
      Found in src/app/surveys/surveys.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/teams/teams.component.ts on lines 161..164

      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