Showing 1,111 of 1,370 total issues
Function constructor
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
private config: IListDataSourceConfig<A, T>,
) {
super();
this.init(config);
E2EHelpers
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export class E2EHelpers {
static e2eItemPrefix = 'acceptance.e2e.';
static customOrgSpaceLabel = E2EHelpers.e2eItemPrefix + (process.env.CUSTOM_ORG_SPACE_LABEL || process.env.USER);
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']
})
KubernetesEffects
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class KubernetesEffects {
proxyAPIVersion = environment.proxyAPIVersion;
constructor(private http: HttpClient, private actions$: Actions, private store: Store<AppState>) { }
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (a *noAuth) generateLoginSuccessResponse(c echo.Context, userGUID string, username string) error {
log.Debug("generateLoginResponse")
var err error
var expiry int64
- Read upRead up
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 329.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (a *localAuth) generateLoginSuccessResponse(c echo.Context, userGUID string, username string) error {
log.Debug("generateLoginResponse")
var err error
var expiry int64
- Read upRead up
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 329.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File kube-config-import.component.ts
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Component, ComponentFactoryResolver, Injector, OnDestroy } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { Store } from '@ngrx/store';
import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs';
import { distinctUntilChanged, filter, first, map, pairwise, startWith, withLatestFrom } from 'rxjs/operators';
Function constructor
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(public helmReleaseHelper: HelmReleaseHelperService) {
// Use the ame column layout as the Helm CLI
this.columns = [
{
Function generateHelmEntities
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function generateHelmEntities(): StratosBaseCatalogEntity[] {
const helmRepoRenderPriority = 10;
const endpointDefinition: StratosEndpointExtensionDefinition = {
type: HELM_ENDPOINT_TYPE,
logoUrl: '/core/assets/custom/helm.svg',
Method CFAppSSH.appSSH
has a Cognitive Complexity of 22 (exceeds 8 allowed). Consider refactoring. Open
func (cfAppSsh *CFAppSSH) appSSH(c echo.Context) error {
// Need to get info for the endpoint
// Get the CNSI and app IDs from route parameters
cnsiGUID := c.Param("cnsiGuid")
userGUID := c.Get("user_id").(string)
- 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
Method PgsqlTokenRepository.FindAllCNSITokenBackup
has a Cognitive Complexity of 22 (exceeds 8 allowed). Consider refactoring. Open
func (p *PgsqlTokenRepository) FindAllCNSITokenBackup(cnsiGUID string, encryptionKey []byte) ([]interfaces.BackupTokenRecord, error) {
log.Debug("FindAllCNSITokenBackup")
if cnsiGUID == "" {
msg := "Unable to find CNSI Token without a valid CNSI GUID."
log.Debug(msg)
- 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 home-page.component.ts
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ScrollDispatcher } from '@angular/cdk/scrolling';
import {
AfterViewInit,
Component,
ElementRef,
File build-tab.component.ts
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { GitCommit, gitEntityCatalog, GitRepo, GitSCMService, GitSCMType, SCMIcon } from '@stratosui/git';
import { combineLatest as observableCombineLatest, Observable, of as observableOf, of } from 'rxjs';
Method portalProxy.updateEndpoint
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *portalProxy) updateEndpoint(ec echo.Context) error {
log.Debug("updateEndpoint")
params := new(interfaces.UpdateEndpointParams)
if err := ec.Bind(params); err != nil {
File pgsql_tokens.go
has 521 lines of code (exceeds 500 allowed). Consider refactoring. Open
package tokens
import (
"database/sql"
"errors"
Function onPrepare
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
onPrepare() {
// https://webdriver.io/docs/api/chromium.html#setnetworkconditions
// browser.driver.setNetworkConditions({
// offline: false,
// latency: 2000, // Additional latency (ms).
File helm-release-helper.service.ts
has 270 lines of code (exceeds 250 allowed). Consider refactoring. 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 ngOnInit
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
const guid = this.kubeEndpointService.baseKube.guid;
const podsObs = kubeEntityCatalog.pod.store.getPaginationService(guid);
const pods$ = podsObs.entities$;
File form.po.ts
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { browser, by, element, promise } from 'protractor';
import { ElementArrayFinder, ElementFinder, protractor } from 'protractor/built';
import { Key } from 'selenium-webdriver';
import { Component } from './component.po';
Function constructor
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
gitSCMService: GitSCMService,
activatedRoute: ActivatedRoute,
private fb: FormBuilder,
private snackBarService: SnackBarService,