open-learning-exchange/planet

View on GitHub

Showing 196 of 281 total issues

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

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

            constructor(
              private formBuilder: FormBuilder,
              private couchService: CouchService,
              private planetMessageService: PlanetMessageService,
              private validatorService: ValidatorService,
          Severity: Major
          Found in src/app/configuration/configuration.component.ts and 6 other locations - About 2 hrs to fix
          src/app/courses/step-view-courses/courses-step-view.component.ts on lines 39..48
          src/app/manager-dashboard/requests/requests.component.ts on lines 38..47
          src/app/manager-dashboard/sync.directive.ts on lines 22..31
          src/app/news/news-list-item.component.ts on lines 38..47
          src/app/shared/dialogs/change-password.directive.ts on lines 91..100
          src/app/submissions/submissions.service.ts on lines 37..46

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

          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

            ngOnInit() {
              this.managerService.getPushedList().subscribe((pushedList: any) => {
                this.pushedItems.data = pushedList;
                this.emptyData = !this.pushedItems.data.length;
              });
          Severity: Major
          Found in src/app/manager-dashboard/manager-fetch.component.ts and 1 other location - About 2 hrs to fix
          src/app/manager-dashboard/certifications/certifications.component.ts on lines 54..59

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

          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

            getCertifications() {
              this.certificationsService.getCertifications().subscribe((certifications: any) => {
                this.certifications.data = certifications;
                this.emptyData = !this.certifications.data.length;
              });
          src/app/manager-dashboard/manager-fetch.component.ts on lines 46..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 80.

          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

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

          @Component({
            templateUrl: 'courses-add.component.html',
            styleUrls: [ './courses-add.scss' ]
          })
          export class CoursesAddComponent implements OnInit, OnDestroy {
          Severity: Minor
          Found in src/app/courses/add-courses/courses-add.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

              File user.service.ts has 254 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Injectable } from '@angular/core';
              import { CouchService } from './couchdb.service';
              import { catchError, switchMap, map, tap } from 'rxjs/operators';
              import { of, Observable, Subject, BehaviorSubject, forkJoin } from 'rxjs';
              import { findDocuments } from '../shared/mangoQueries';
              Severity: Minor
              Found in src/app/shared/user.service.ts - About 2 hrs to fix

                Function validate_doc_update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  function (newDoc, oldDoc, userCtx, secObj) {
                    function require(field) {
                      var errMessage = field + ' is required';
                      if (!newDoc[field]) {
                        throw { forbidden: errMessage };
                Severity: Minor
                Found in design/nations/nation-validators.js - About 2 hrs 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 aiChatStream has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                export async function aiChatStream(
                  messages: ChatMessage[],
                  aiProvider: AIProvider,
                  callback?: (response: string) => void
                ): Promise<string> {
                Severity: Minor
                Found in chatapi/src/utils/chat-helpers.utils.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

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

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

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

                  openArchiveTransactionDialog(transaction) {
                    this.deleteDialog = this.dialog.open(DialogsPromptComponent, {
                      data: {
                        okClick: this.archiveTransaction(transaction),
                        changeType: 'delete',
                Severity: Major
                Found in src/app/teams/teams-view-finances.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.component.ts on lines 248..257

                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

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

                  constructor(
                    iconRegistry: MatIconRegistry,
                    sanitizer: DomSanitizer,
                    public router: Router,
                    private stateService: StateService
                Severity: Minor
                Found in src/app/app.component.ts - About 1 hr to fix

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

                      if (this.achievements.purpose) {
                        optionals.push(
                          { text: 'My Purpose', style: 'subHeader', alignment: 'center' },
                          { text: this.achievements.purpose, alignment: 'left', margin: [ 20, 5 ] }
                        );
                  src/app/users/users-achievements/users-achievements.component.ts on lines 141..146

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

                  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

                      if (this.achievements.goals) {
                        optionals.push(
                          { text: 'My Goals', style: 'subHeader', alignment: 'center' },
                          { text: this.achievements.goals, alignment: 'left', margin: [ 20, 5 ] }
                        );
                  src/app/users/users-achievements/users-achievements.component.ts on lines 134..139

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

                  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