cloudfoundry-incubator/stratos

View on GitHub

Showing 1,111 of 1,370 total issues

Method portalProxy.setupGetAvailableScopes has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
Open

func (p *portalProxy) setupGetAvailableScopes(c echo.Context) error {

    // Check if already set up
    if p.GetConfig().ConsoleConfig.IsSetupComplete() {
        return c.NoContent(http.StatusServiceUnavailable)
Severity: Minor
Found in src/jetstream/setup_console.go - 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

Function initialiseSpaceObservables has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
Open

  private initialiseSpaceObservables() {
    this.space$ = this.cfUserService.isConnectedUserAdmin(this.cfGuid).pipe(
      switchMap(isAdmin => {
        const relations = [
          createEntityRelationKey(spaceEntityType, spaceQuotaEntityType),

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

  constructor() {
    super();
    this.artifactHubAndHelmRepoTypes$ = stratosEntityCatalog.endpoint.store.getAll.getPaginationService().entities$.pipe(
      filter(endpoints => !!endpoints), // Wait until we have some entities
      first(),

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

function arraysAreEqual(a1: any[], a2: any[]): boolean {
  if (a1.length !== a2.length) {
    return false;
  }

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

  onChanges() {
    this.sub = this.editProfileForm.valueChanges.subscribe(values => {
      // Old password is required if either email or new pw is specified (uaa)
      // or only if new pw is specified (local account)
      const required = this.needsPasswordForEmailChange ?

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 Monocular.fetchChartsFromArtifactHub has 52 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (m *Monocular) fetchChartsFromArtifactHub(c echo.Context, endpointID string) error {
    cacheFolder := path.Join(m.CacheFolder, endpointID)
    indexFile := path.Join(cacheFolder, "hub_index.json")
    if ok := useCachedFile(indexFile); ok {
        // Just send the cached file
Severity: Minor
Found in src/jetstream/plugins/monocular/artifacthub.go - About 1 hr to fix

    Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor(
        store: Store<CFAppState>,
        datePipe: DatePipe,
        private cfOrgSpaceService: CfOrgSpaceDataService,
        currentUserPermissionsService: CurrentUserPermissionsService,

      Function fetchCfUserRole has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function fetchCfUserRole(store: Store<AppState>, action: GetCurrentCfUserRelations, httpClient: HttpClient): Observable<boolean> {
        const url = `pp/v1/proxy/v2/users/${action.guid}/${action.relationType}`;
        const params = {
          headers: {
            'x-cap-cnsi-list': action.endpointGuid,

        Function handleCreateServiceResult has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private handleCreateServiceResult(request: RequestInfoState, state: CreateServiceInstanceState): Observable<StepOnNextResult> {
            const bindApp = !!state.bindAppGuid;
        
            if (this.longRunningOpService.isLongRunning(request)) {
              // This request has taken too long for the browser/jetstream and is on going. Treat this as a success

          Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(
              listConfig: ListConfig<APIResource>,
            ) {
              this.filtersFormGroup = new FormGroup({
                actee: new FormControl(null, []),

            Function generateCFServicePlanEntity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function generateCFServicePlanEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
              const definition: IStratosEntityDefinition = {
                type: servicePlanEntityType,
                schema: cfEntityFactory(servicePlanEntityType),
                label: 'Service Plan',
            Severity: Minor
            Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

              Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor(
                  private store: Store<CFAppState>,
                  private appService: ApplicationService,
                  private utilsService: UtilsService,
                  private router: Router,

                Function generateCFServiceEntity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function generateCFServiceEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                  const definition: IStratosEntityDefinition = {
                    type: serviceEntityType,
                    schema: cfEntityFactory(serviceEntityType),
                    label: 'Service',
                Severity: Minor
                Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                  Function generateStackEntity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function generateStackEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                    const definition: IStratosEntityDefinition = {
                      type: stackEntityType,
                      schema: cfEntityFactory(stackEntityType),
                      label: 'Stack',
                  Severity: Minor
                  Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                    Function currentCfUserRolesReducer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const currentCfUserRolesReducer: EntityUserRolesReducer<IAllCfRolesState> = (
                      state: IAllCfRolesState = {},
                      action: Action
                    ): IAllCfRolesState => {
                      switch (action.type) {

                      Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        constructor(
                          private store: Store<AppState>,
                          public id: string,
                          public entityKey: string,
                          public schema: EntitySchema,
                      Severity: Minor
                      Found in src/frontend/packages/store/src/monitors/entity-monitor.ts - About 1 hr to fix

                        Function generateCFDomainEntity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function generateCFDomainEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                          const definition: IStratosEntityDefinition = {
                            type: domainEntityType,
                            schema: cfEntityFactory(domainEntityType),
                            label: 'Domain',
                        Severity: Minor
                        Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                          Function generateJsonSchemaFromObject has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function generateJsonSchemaFromObject(title, object) {
                            let processOutput;
                            const output: any = {
                              $schema: DRAFT
                            };

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

                              ngOnInit() {
                                if (!this.id) {
                                  return;
                                }
                            
                            

                              Function isNewer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                public isNewer(other: Version): boolean {
                                  if (!this.valid || !other.valid) {
                                    return false;
                                  }
                              
                              
                                Severity
                                Category
                                Status
                                Source
                                Language