OwenKelvin/Angular-School-Management-System

View on GitHub

Showing 54 of 218 total issues

File student-guardian-form.component.ts has 376 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { FormGroup, Validators, FormBuilder, FormControl, FormArray } from '@angular/forms';
import { IdNumberValidator } from '../validators/student-id-taken.validator';
import { SET_STUDENT_ID_NUMBER } from '../../store/actions/pages.actions';
import { Store, select } from '@ngrx/store';

    Function getItems has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getItems(): object {
        const items: object = {
          preIcon: 'local_library',
          label: 'Library',
          postIcon: 'arrow_right',
    Severity: Major
    Found in src/app/pages/library/services/menu-items.service.ts - About 3 hrs to fix

      Function ngOnInit has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        ngOnInit() {
          if (typeof this.multiple === 'string') {
            this.multipleSelector = true;
          }
          this.error = { required: 'Please Select a Category' };
      Severity: Major
      Found in src/app/core/select/select.component.ts - About 3 hrs to fix

        Function getItems has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getItems(): object {
            const items: object = {
              preIcon: 'drive_file_rename_outline',
              label: 'Curriculum Management',
              postIcon: 'arrow_right',
        Severity: Major
        Found in src/app/pages/curriculum-maintenance/services/menu-items.service.ts - About 3 hrs to fix

          File create-unit.component.ts has 282 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
          import {
            FormBuilder,
            FormGroup,
            Validators,

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

            @Component({
              selector: 'app-student-guardian-form',
              templateUrl: './student-guardian-form.component.html',
              styleUrls: ['./student-guardian-form.component.css']
            })

              Function intercept has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
                      return next.handle(request).pipe(catchError(err => {
                          const error = err.statusText || err.error.message;
                          if (err.status === 500) {
                              this.message = {
              Severity: Major
              Found in src/app/core/interceptors/error.interceptor.ts - About 2 hrs to fix

                Function ngOnInit has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  ngOnInit() {
                    this.newForm = true;
                    this.errors = {
                      name: '',
                      abbr: '',

                  Function getItems has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    getItems(): object {
                      const items: object = {
                        preIcon: 'group_add',
                        label: 'Admission',
                        postIcon: 'arrow_right',
                  Severity: Major
                  Found in src/app/pages/admissions/services/menu-items.service.ts - About 2 hrs to fix

                    Function ngOnInit has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      ngOnInit() {
                        this.newForm = true;
                        this.errors = {
                          name: '',
                          abbr: '',

                      Function ngOnInit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        ngOnInit() {
                      
                          this.getGenders.getAll().subscribe(data => {
                            this.genders = data;
                          });

                        Function ngOnInit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          ngOnInit() {
                            this.phoneErrorMatcher = new MyErrorStateMatcher();
                            this.selectedPhone = { code: 254, country: 'KE' };
                            this.allowedPhoneNumbers.getAllowedCountries().subscribe(data => {
                              this.allowedPhoneCountries = data;

                          Function validateFirstName has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                            validateFirstName(i): void {
                              this.createError(i);
                              const changeFirstNameError = () => {
                                if ((this.guardians().controls[i].get('firstName').dirty || this.guardians().controls[i].get('firstName').touched) &&
                                  !this.guardians().controls[i].get('firstName').valid) {

                          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 validateFirstName has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                            validateFirstName({ blur } = { blur: true }) {
                              const changeFirstNameError = () => {
                                if ((this.userIdentificaionForm.get('firstName').dirty || this.userIdentificaionForm.get('firstName').touched) &&
                                  !this.userIdentificaionForm.get('firstName').valid) {
                                  if (this.userIdentificaionForm.get('firstName').errors.required) {

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

                            submit() {
                              if (this.unitForm.valid) {
                                this.unit.submit(this.unitForm.value).subscribe(() => {
                                  this.submitted.emit();
                                  if (this.newForm) {

                            Function reducer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function reducer(state, action) {
                              const freshState: State = {
                                app: {
                                  user: {
                                    first_name: '',
                            Severity: Minor
                            Found in src/app/store/reducers/index.ts - About 1 hr to fix

                              Function exports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              module.exports = function (config) {
                                config.set( {
                                  browsers: [ 'Chrome', 'ChromeHeadless', 'ChromeHeadlessNoSandbox' ],
                                  customLaunchers: {
                                    ChromeHeadlessNoSandbox: {
                              Severity: Minor
                              Found in karma.conf.js - About 1 hr to fix

                                Function login has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  login({ username, password, rememberMe }) {
                                    const loginData: OauthInterface = {
                                      grant_type: this.config.grantType,
                                      client_id: this.config.clientId,
                                      client_secret: this.config.clientSecret,
                                Severity: Minor
                                Found in src/app/core/services/authentication/authentication.service.ts - About 1 hr to fix

                                  Function submit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    submit() {
                                      if (this.classLevelForm.valid) {
                                        this.classLevel.submit(this.classLevelForm.value).subscribe(() => {
                                          this.submitted.emit(true);
                                          if (this.newForm) {

                                    Function levenshtein has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      levenshtein(a: string, b: string): number {
                                        if (a.length === 0) {
                                          return b.length;
                                        }
                                        if (b.length === 0) {
                                    Severity: Minor
                                    Found in src/app/core/services/path-resolve/path-resolve.service.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language