open-learning-exchange/planet

View on GitHub

Showing 58 of 299 total issues

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

    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

      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

        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

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

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

            ResourcesComponent has 32 functions (exceeds 20 allowed). Consider refactoring.
            Open

            @Component({
              selector: 'planet-resources',
              templateUrl: './resources.component.html',
              styleUrls: [ './resources.scss' ],
              encapsulation: ViewEncapsulation.None
            Severity: Minor
            Found in src/app/resources/resources.component.ts - About 4 hrs to fix

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

              import { Component, OnInit, OnDestroy, ViewEncapsulation, HostListener } from '@angular/core';
              import { Subject, forkJoin, of, throwError } from 'rxjs';
              import { takeUntil, finalize, switchMap, map, catchError, tap } from 'rxjs/operators';
              import { StateService } from '../shared/state.service';
              import { NewsService } from '../news/news.service';
              Severity: Minor
              Found in src/app/community/community.component.ts - About 3 hrs to fix

                UserService has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                @Injectable({
                  providedIn: 'root'
                })
                export class UserService {
                  private user: any = { name: '' };
                Severity: Minor
                Found in src/app/shared/user.service.ts - About 3 hrs to fix

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

                  import { Component, OnInit, OnDestroy, Input } from '@angular/core';
                  import { CoursesService } from '../courses/courses.service';
                  import { Router, ActivatedRoute, ParamMap } from '@angular/router';
                  import { Subject, forkJoin, of } from 'rxjs';
                  import { takeUntil, switchMap, catchError } from 'rxjs/operators';
                  Severity: Minor
                  Found in src/app/exams/exams-view.component.ts - About 3 hrs to fix

                    File manager-dashboard.component.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { Component, OnInit, isDevMode, OnDestroy } from '@angular/core';
                    import { UserService } from '../shared/user.service';
                    import { CouchService } from '../shared/couchdb.service';
                    import { findDocuments } from '../shared/mangoQueries';
                    import { switchMap, takeUntil } from 'rxjs/operators';
                    Severity: Minor
                    Found in src/app/manager-dashboard/manager-dashboard.component.ts - About 3 hrs to fix

                      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

                        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

                          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

                            Function aiChatStream has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

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

                            ChatSidebarComponent has 25 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

                              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

                                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

                                  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

                                    Function aiChatNonStream has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export async function aiChatNonStream(
                                      messages: ChatMessage[],
                                      aiProvider: AIProvider,
                                      assistant: boolean,
                                      context: any = '',
                                    Severity: Minor
                                    Found in chatapi/src/utils/chat-helpers.utils.ts - 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 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language