cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

Method CustomBinder.bindData has 6 return statements (exceeds 4 allowed).
Open

func (b *CustomBinder) bindData(ptr interface{}, data map[string][]string, tag string) error {
    typ := reflect.TypeOf(ptr).Elem()
    val := reflect.ValueOf(ptr).Elem()

    if typ.Kind() != reflect.Struct {
Severity: Major
Found in src/jetstream/custombinder/custombinder.go - About 40 mins to fix

    Method UserFavorites.create has 6 return statements (exceeds 4 allowed).
    Confirmed

    func (uf *UserFavorites) create(c echo.Context) error {
    
        store, err := userfavoritesstore.NewFavoritesDBStore(uf.portalProxy.GetDatabaseConnection())
        if err != nil {
            return interfaces.NewHTTPShadowError(
    Severity: Major
    Found in src/jetstream/plugins/userfavorites/favorites.go - About 40 mins to fix

      Function CreateServiceAccount has 6 return statements (exceeds 4 allowed).
      Open

      func CreateServiceAccount(p interfaces.PortalProxy, endpointGUID, userGUID string) error {
          log.Debug("CreateServiceAccount")
      
          svc, err := getKubeDashboardServiceInfo(p, endpointGUID, userGUID)
          if err != nil {
      Severity: Major
      Found in src/jetstream/plugins/kubernetes/dashboard/configure.go - About 40 mins to fix

        Function createPluginForEndpointType has 6 return statements (exceeds 4 allowed).
        Open

        func createPluginForEndpointType(endpointType string) GeneratedEndpointPlugin {
            log.Debugf("Generating plugin %s", endpointType)
            gep := GeneratedEndpointPlugin{}
            gep.endpointType = endpointType
            gep.subTypes = make(map[string]pluginConfig)
        Severity: Major
        Found in src/jetstream/plugins/yamlgenerated/main.go - About 40 mins to fix

          Method portalProxy.initialiseConsoleConfig has 6 return statements (exceeds 4 allowed).
          Open

          func (p *portalProxy) initialiseConsoleConfig(envLookup *env.VarSet) (*interfaces.ConsoleConfig, error) {
              log.Debug("initialiseConsoleConfig")
          
              consoleConfig := &interfaces.ConsoleConfig{}
              if err := config.Load(consoleConfig, envLookup.Lookup); err != nil {
          Severity: Major
          Found in src/jetstream/setup_console.go - About 40 mins to fix

            Method UserFavorites.setMetadata has 6 return statements (exceeds 4 allowed).
            Open

            func (uf *UserFavorites) setMetadata(c echo.Context) error {
            
                store, err := userfavoritesstore.NewFavoritesDBStore(uf.portalProxy.GetDatabaseConnection())
                if err != nil {
                    return err
            Severity: Major
            Found in src/jetstream/plugins/userfavorites/favorites.go - About 40 mins to fix

              Method GeneratedEndpointPlugin.Connect has 6 return statements (exceeds 4 allowed).
              Open

              func (gep GeneratedEndpointPlugin) Connect(ec echo.Context, cnsiRecord interfaces.CNSIRecord, userId string) (*interfaces.TokenRecord, bool, error) {
                  params := new(interfaces.LoginToCNSIParams)
                  err := interfaces.BindOnce(params, ec)
                  if err != nil {
                      return nil, false, err
              Severity: Major
              Found in src/jetstream/plugins/yamlgenerated/main.go - About 40 mins to fix

                Method portalProxy.buildCNSIList has 6 return statements (exceeds 4 allowed).
                Open

                func (p *portalProxy) buildCNSIList(c echo.Context) ([]*interfaces.CNSIRecord, error) {
                    log.Debug("buildCNSIList")
                
                    if p.GetConfig().UserEndpointsEnabled != config.UserEndpointsConfigEnum.Disabled {
                        userID, err := p.GetSessionValue(c, "user_id")
                Severity: Major
                Found in src/jetstream/cnsi.go - About 40 mins to fix

                  Function saveLocalUserConsoleConfig has 6 return statements (exceeds 4 allowed).
                  Open

                  func saveLocalUserConsoleConfig(consoleRepo console_config.Repository, consoleConfig *interfaces.ConsoleConfig) error {
                  
                      log.Debug("saveLocalUserConsoleConfig")
                  
                      if err := consoleRepo.SetValue(systemGroupName, "AUTH_ENDPOINT_TYPE", "local"); err != nil {
                  Severity: Major
                  Found in src/jetstream/setup_console.go - About 40 mins to fix

                    Method PostgresCNSIRepository.listBy has 6 return statements (exceeds 4 allowed).
                    Open

                    func (p *PostgresCNSIRepository) listBy(query string, match string, encryptionKey []byte) ([]*interfaces.CNSIRecord, error) {
                        rows, err := p.db.Query(query, match)
                        if err != nil {
                            return nil, fmt.Errorf("Unable to retrieve CNSI records: %v", err)
                        }
                    Severity: Major
                    Found in src/jetstream/repository/cnsis/pgsql_cnsis.go - About 40 mins to fix

                      Method ConsoleConfigRepository.GetConsoleConfig has 6 return statements (exceeds 4 allowed).
                      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: Major
                      Found in src/jetstream/repository/console_config/psql_console_config.go - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                            if (isAdmin) {
                              const allCfUsersAction = this.createCfGetAllUsersAction(cfGuid);
                        
                              if (!orgGuid) {
                                return observableOf(allCfUsersAction);

                          Method PgsqlTokenRepository.FindAllCNSITokenBackup has 6 return statements (exceeds 4 allowed).
                          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)
                          Severity: Major
                          Found in src/jetstream/repository/tokens/pgsql_tokens.go - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                if (!secrets ||
                                  !secrets.consoleUsers || !secrets.consoleUsers.admin || !secrets.consoleUsers.nonAdmin ||
                                  !secrets.endpoints || !secrets.endpoints.cf
                                ) {
                                  throw new Error(`Failed to validate secrets`);
                            Severity: Major
                            Found in src/test-e2e/helpers/secrets-helpers.ts - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                if (ep.provider && ep.provider.metadata && ep.provider.metadata && ep.provider.metadata.metrics_stratos
                                  && Array.isArray(ep.provider.metadata.metrics_stratos)) {
                                  ep.provider.metadata.metrics_stratos.forEach(endp => {
                                    // See if we already know about this endpoint
                                    const hasEndpoint = data.findIndex(i => compareUrl(i.url, endp.url) || compareUrl(i.url, endp.cfEndpoint)) !== -1;
                              Severity: Major
                              Found in src/frontend/packages/core/src/features/metrics/metrics.helpers.ts - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    if (dsEndpointType || onlyConnected) {
                                      transformEntities.push((entities: EndpointModel[]) => {
                                        return dsEndpointType || onlyConnected ? entities.filter(endpoint => {
                                          return (!onlyConnected || endpoint.connectionStatus === 'connected') &&
                                            (!dsEndpointType || endpoint.cnsi_type === dsEndpointType);

                                  Function start has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func start(config interfaces.PortalConfig, p *portalProxy, needSetupMiddleware bool, isUpgrade bool, envLookup *env.VarSet) error {
                                  Severity: Minor
                                  Found in src/jetstream/main.go - About 35 mins to fix

                                    Function initSessionStore has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    func initSessionStore(db *sql.DB, databaseProvider string, pc interfaces.PortalConfig, sessionExpiry int, env *env.VarSet) (HttpSessionStore, *sessions.Options, error) {
                                    Severity: Minor
                                    Found in src/jetstream/main.go - About 35 mins to fix

                                      Function newPortalProxy has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      func newPortalProxy(pc interfaces.PortalConfig, dcp *sql.DB, ss HttpSessionStore, sessionStoreOptions *sessions.Options, env *env.VarSet) *portalProxy {
                                      Severity: Minor
                                      Found in src/jetstream/main.go - About 35 mins to fix

                                        Method portalProxy.login has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        func (p *portalProxy) login(c echo.Context, skipSSLValidation bool, client string, clientSecret string, endpoint string) (uaaRes *interfaces.UAAResponse, u *interfaces.JWTUserTokenInfo, err error) {
                                        Severity: Minor
                                        Found in src/jetstream/auth.go - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language