src/frontend/packages/kubernetes/src/kubernetes/workloads/release/tabs/helm-release-helper.service.ts
Function isNewer
has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring. Open
Open
public isNewer(other: Version): boolean {
if (!this.valid || !other.valid) {
return false;
}
- Read upRead up
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
File helm-release-helper.service.ts
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Injectable } from '@angular/core';
import { combineLatest, Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { helmEntityCatalog } from '../../../../helm/helm-entity-catalog';
Function hasUpgrade
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public hasUpgrade(returnLatest = false): Observable<InternalHelmUpgrade> {
const updates = combineLatest(this.getCharts(), this.release$);
return updates.pipe(
map(([charts, release]) => {
let score = -1;
Function mapPods
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private mapPods(pods: KubernetesPod[]): HelmReleaseChartData {
const podPhases: { [phase: string]: number, } = {};
const containers = {
ready: {
name: 'Ready',
Function isNewer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public isNewer(other: Version): boolean {
if (!this.valid || !other.valid) {
return false;
}
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return this.prerelease > other.prerelease;
Avoid too many return
statements within this function. Open
Open
return this.revision > other.revision;
Function compareCharts
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
Open
private compareCharts(a: ChartMetadata, b: ChartMetadata): number {
// Basic properties must be the same
if (a.name !== b.name) {
return -1;
}
- Read upRead up
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"