cloudfoundry/stratos

View on GitHub
src/frontend/packages/kubernetes/src/kubernetes/workloads/chart-values-editor/chart-values-editor.component.ts

Summary

Maintainability
C
1 day
Test Coverage

File chart-values-editor.component.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { HttpClient } from '@angular/common/http';
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core';
import { JsonSchemaFormComponent } from '@cfstratos/ajsf-core';
import * as yaml from 'js-yaml';
import { BehaviorSubject, combineLatest, fromEvent, Observable, of, Subscription } from 'rxjs';

    ChartValuesEditorComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Component({
      selector: 'app-chart-values-editor',
      templateUrl: './chart-values-editor.component.html',
      styleUrls: ['./chart-values-editor.component.scss']
    })

      Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private init() {
          // Observabled for loading schema and values for the Chart
          const schema$ = this.httpClient.get(this.schemaUrl).pipe(catchError(e => of(null)));
          const values$: Observable<string> = this.httpClient.get(this.valuesUrl, { responseType: 'text' }).pipe(
            catchError(e => of(null))

        Function editModeChanged has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          editModeChanged(mode) {
            this.mode = mode.value;
        
            if (this.mode === EditorMode.CodeEditor) {
              // Form -> Editor

          Function editModeChanged has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
          Open

            editModeChanged(mode) {
              this.mode = mode.value;
          
              if (this.mode === EditorMode.CodeEditor) {
                // Form -> Editor

          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 init has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
          Open

            private init() {
              // Observabled for loading schema and values for the Chart
              const schema$ = this.httpClient.get(this.schemaUrl).pipe(catchError(e => of(null)));
              const values$: Observable<string> = this.httpClient.get(this.valuesUrl, { responseType: 'text' }).pipe(
                catchError(e => of(null))

          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

          There are no issues that match your filters.

          Category
          Status