cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

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

func (p *portalProxy) RefreshOidcToken(skipSSLValidation bool, cnsiGUID, userGUID, client, clientSecret, tokenEndpoint string) (t interfaces.TokenRecord, err error) {
    log.Debug("RefreshOidcToken")
    userToken, ok := p.GetCNSITokenRecordWithDisconnected(cnsiGUID, userGUID)
    if !ok {
        return t, fmt.Errorf("Info could not be found for user with GUID %s", userGUID)
Severity: Minor
Found in src/jetstream/oidc_requests.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

Method ConsoleConfigRepository.GetConsoleConfig has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func (c *ConsoleConfigRepository) GetConsoleConfig() (*interfaces.ConsoleConfig, error) {
    log.Debug("Get ConsoleConfig")
    rows, err := c.db.Query(getConsoleConfig)
    if err != nil {
        return nil, fmt.Errorf("Unable to retrieve console config record: %v", err)
Severity: Minor
Found in src/jetstream/repository/console_config/psql_console_config.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 paginate has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

function paginate(action, state: PaginationState = {}, updatePagination) {
  if (action.type === ApiActionTypes.API_REQUEST_START) {
    return state;
  }

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

  ngOnInit() {
    this.endpointId = this.activatedRoute.snapshot.params && this.activatedRoute.snapshot.params.endpointId ?
      this.activatedRoute.snapshot.params.endpointId : null;
    if (!this.endpointIds$ && this.endpointId) {
      this.endpointIds$ = observableOf([this.endpointId]);

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

  private update() {
    this.initials = null;
    this.gravatar = null;
    const user = this.userInfo;

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

func init() {
    RegisterMigration(20170818120003, "InitialSchema", func(txn *sql.Tx, conf *goose.DBConf) error {
        binaryDataType := "BYTEA"
        if strings.Contains(conf.Driver.Name, "mysql") {
            binaryDataType = "BLOB"
Severity: Minor
Found in src/jetstream/datastore/20170818120003_InitialSchema.go - About 1 hr to fix

    Function initServiceObservables has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private initServiceObservables() {
        this.serviceEntityService = cfEntityCatalog.service.store.getEntityService(this.serviceGuid, this.cfGuid, {});
        this.service$ = this.serviceEntityService.waitForEntity$.pipe(
          filter(o => !!o && !!o.entity),
          map(o => o.entity),

      Function processObject has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function processObject(object: any, output?: any, nested?: boolean) {
        if (nested && output) {
          output = { properties: output };
        } else {
          output = output || {};

        Function succeedRequest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function succeedRequest(state: BaseRequestState, action: ISuccessRequestAction) {
          if (!isNullOrUndefined(action.apiAction.guid)) {
            const apiAction = action.apiAction as BaseEntityRequestAction;
            const successAction = action as WrapperRequestActionSuccess;
            const requestSuccessState = getEntityRequestState(state, apiAction);

          Function setupObservables has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private setupObservables() {
              this.metricsEndpoints$ = this.endpointsMonitor.currentPage$.pipe(
                map((endpoints: any) => {
                  const result: MetricsEndpointProvider[] = [];
                  const metrics = endpoints.filter(e => e.cnsi_type === 'metrics');

            Function map has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public map() {
                if (!this.report.report || !this.report.report.popeye) {
                  return;
                }
            
            

              Function newPortalProxy has 63 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func newPortalProxy(pc interfaces.PortalConfig, dcp *sql.DB, ss HttpSessionStore, sessionStoreOptions *sessions.Options, env *env.VarSet) *portalProxy {
                  log.Debug("newPortalProxy")
              
                  // Generate cookie name - avoids issues if the cookie domain is changed
                  cookieName := jetstreamSessionName
              Severity: Minor
              Found in src/jetstream/main.go - About 1 hr to fix

                Function graph has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    ).subscribe(([g, report]) => {
                      const newNodes: CustomHelmReleaseGraphNode[] = [];
                      Object.values(g.nodes).forEach((node: HelmReleaseGraphNode) => {
                        const colors = this.getColor(node.data.status);
                        const icon = getIcon(node.data.kind);

                  Function createCoreStore has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static createCoreStore<Y, ABC extends OrchestratedActionBuilders>(
                      actionOrchestrator: ActionOrchestrator<ABC>,
                      entityKey: string,
                      getSchema: (schema: string) => EntitySchema
                    ): CoreEntityCatalogEntityStore<Y, ABC> {

                    Function start has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func start(config interfaces.PortalConfig, p *portalProxy, needSetupMiddleware bool, isUpgrade bool, envLookup *env.VarSet) error {
                        log.Debug("start")
                        e := echo.New()
                        e.HideBanner = true
                        e.HidePort = true
                    Severity: Minor
                    Found in src/jetstream/main.go - About 1 hr to fix

                      Function deleteOrgWarn has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        deleteOrgWarn() {
                          this.cfOrgService.org$.pipe(
                            map(org => org.entity.entity.name),
                            first()
                          ).subscribe(name => {

                        Function initialiseObservables has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private initialiseObservables() {
                            this.org$ = this.cfUserService.isConnectedUserAdmin(this.cfGuid).pipe(
                              switchMap(isAdmin => {
                                const relations = [
                                  createEntityRelationKey(organizationEntityType, spaceEntityType),

                          Function apply has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            public apply(webpackConfig: any, config: StratosConfig, options: any) {
                          
                              // Generate the module file to import the appropriate extensions
                              const dir = path.join(config.rootDir, path.dirname(options.main));
                              const overrideFile = path.resolve(path.join(dir, './_custom-import.module.ts'));
                          Severity: Minor
                          Found in src/frontend/packages/devkit/src/build/extensions.ts - About 1 hr to fix

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

                              constructor(
                                catalogEntity: StratosBaseCatalogEntity,
                                store: Store<any>
                              ) {
                                super();

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

                                ngOnInit() {
                                  this.endpointId = this.activatedRoute.snapshot.params && this.activatedRoute.snapshot.params.endpointId ?
                                    this.activatedRoute.snapshot.params.endpointId : null;
                                  if (!this.endpointIds$ && this.endpointId) {
                                    this.endpointIds$ = observableOf([this.endpointId]);
                                Severity
                                Category
                                Status
                                Source
                                Language