cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

Method FavoritesDBStore.List has 5 return statements (exceeds 4 allowed).
Open

func (p *FavoritesDBStore) List(userGUID string) ([]*UserFavoriteRecord, error) {
    log.Debug("List")
    rows, err := p.db.Query(getFavorites, userGUID)
    if err != nil {
        return nil, fmt.Errorf("Unable to retrieve User Favorite records: %v", err)

    Method CloudFoundrySpecification.Info has 5 return statements (exceeds 4 allowed).
    Open

    func (c *CloudFoundrySpecification) Info(apiEndpoint string, skipSSLValidation bool) (interfaces.CNSIRecord, interface{}, error) {
        log.Debug("Info")
        var v2InfoResponse interfaces.V2Info
        var newCNSI interfaces.CNSIRecord
    
    
    Severity: Major
    Found in src/jetstream/plugins/cloudfoundry/main.go - About 35 mins to fix

      Function readCFFile has 5 return statements (exceeds 4 allowed).
      Open

      func readCFFile() (*CFConfigFile, *url.URL, error) {
      
          var url *url.URL
          usr, err := user.Current()
          if err != nil {
      Severity: Major
      Found in src/jetstream/plugins/desktop/cloudfoundry.go - About 35 mins to fix

        Method KubeConfigFile.GetUserForCluster has 5 return statements (exceeds 4 allowed).
        Open

        func (k *KubeConfigFile) GetUserForCluster(clusterEndpoint string) (*KubeConfigUser, error) {
        
            var cluster *KubeConfigCluster
            var err error
        
        
        Severity: Major
        Found in src/jetstream/plugins/kubernetes/config/kube_config.go - About 35 mins to fix

          Method ConsoleConfig.IsSetupComplete has 5 return statements (exceeds 4 allowed).
          Open

          func (consoleConfig *ConsoleConfig) IsSetupComplete() bool {
          
              // No auth, then setup is complete
              if AuthEndpointTypes[consoleConfig.AuthEndpointType] == AuthNone {
                  return true
          Severity: Major
          Found in src/jetstream/repository/interfaces/structs.go - About 35 mins to fix

            Function getRecentLogs has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
            Open

            func getRecentLogs(ac *AuthorizedConsumer, cnsiGUID, appGUID string) ([]*events.LogMessage, error) {
                log.Debug("getRecentLogs")
                messages, err := ac.consumer.RecentLogs(appGUID, ac.authToken)
                if err != nil {
                    errorPattern := "Failed to get recent messages for App %s on CNSI %s [%v]"
            Severity: Minor
            Found in src/jetstream/plugins/cloudfoundry/cf_websocket_streams.go - About 35 mins 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 portalProxy.loginToCNSI has 5 return statements (exceeds 4 allowed).
            Open

            func (p *portalProxy) loginToCNSI(c echo.Context) error {
                log.Debug("loginToCNSI")
            
                var systemSharedToken = false
            
            
            Severity: Major
            Found in src/jetstream/authcnsi.go - About 35 mins to fix

              Function init has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
              Open

              func init() {
                  RegisterMigration(20191008121900, "PrimaryKeys", func(txn *sql.Tx, conf *goose.DBConf) error {
              
                      // Make sure all tokens have a CNSI guid
                      ensureTokensHaveCnsi := "UPDATE tokens SET cnsi_guid='STRATOS' WHERE token_type='uaa' and cnsi_guid IS NULL;"
              Severity: Minor
              Found in src/jetstream/datastore/20191008121900_PrimaryKeys.go - About 35 mins 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 portalProxy.RefreshOAuthToken has 5 return statements (exceeds 4 allowed).
              Open

              func (p *portalProxy) RefreshOAuthToken(skipSSLValidation bool, cnsiGUID, userGUID, client, clientSecret, tokenEndpoint string) (t interfaces.TokenRecord, err error) {
                  log.Debug("refreshToken")
                  userToken, ok := p.GetCNSITokenRecordWithDisconnected(cnsiGUID, userGUID)
                  if !ok {
                      return t, fmt.Errorf("Info could not be found for user with GUID %s", userGUID)
              Severity: Major
              Found in src/jetstream/oauth_requests.go - About 35 mins to fix

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

                func (p *portalProxy) writeSessionHook(c echo.Context) func() {
                    return func() {
                        // Has the session been modified and need saving?
                        sessionModifed := c.Get(jetStreamSessionContextUpdatedKey)
                        sessionIntf := c.Get(jetStreamSessionContextKey)
                Severity: Minor
                Found in src/jetstream/session.go - About 35 mins 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 PgsqlTokenRepository.FindAuthToken has 5 return statements (exceeds 4 allowed).
                Open

                func (p *PgsqlTokenRepository) FindAuthToken(userGUID string, encryptionKey []byte) (interfaces.TokenRecord, error) {
                    log.Debug("FindAuthToken")
                    if userGUID == "" {
                        msg := "Unable to find UAA Token without a valid User GUID."
                        log.Debug(msg)
                Severity: Major
                Found in src/jetstream/repository/tokens/pgsql_tokens.go - About 35 mins to fix

                  Function row has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
                  Open

                    @Input('row')
                    set row(row: APIResource<IServiceInstance>) {
                      super.row = row;
                      if (row) {
                        this.serviceInstanceEntity = row;

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

                  export function jetstreamErrorHandler(
                    error: any,
                    action: EntityRequestAction,
                    catalogEntity: StratosBaseCatalogEntity,
                    requestType: ApiRequestTypes,

                  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 10 (exceeds 8 allowed). Consider refactoring.
                  Open

                    constructor(
                      private store: Store<any>,
                      private route: ActivatedRoute,
                      router: Router,
                      kubeId: BaseKubeGuid,

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

                    private applyRoutesFromExtensions(router: Router) {
                      const routeConfig = [...router.config];
                  
                      // Find the route that has the 'about' page as a child - this is the dashboard base
                      const dashboardRoute = routeConfig.find(r => {
                  Severity: Minor
                  Found in src/frontend/packages/core/src/core/extension/extension-service.ts - About 35 mins 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 ngOnInit has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
                  Open

                    ngOnInit() {
                      const events$ = this.eventService.events$.pipe(
                        map(events => {
                          if (this.endpointOnly) {
                            return events.filter(event => event.key.split('-')[0] === 'endpointError');

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

                  export const arraysEqual = (a: any[], b: any[]): boolean => {
                    // Both falsy
                    if (!a && !b) {
                      return true;
                    }
                  Severity: Minor
                  Found in src/frontend/packages/core/src/core/utils.service.ts - About 35 mins 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 ngOnInit has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
                  Open

                    ngOnInit() {
                  
                      const helmLastModifiedRegEx = /seconds:([0-9]*)/;
                  
                      this.sessionData$ = this.store.select(s => s.auth).pipe(

                  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

                  Avoid too many return statements within this function.
                  Open

                              return appStateMatch[extState];

                    Avoid too many return statements within this function.
                    Open

                      return state;
                      Severity
                      Category
                      Status
                      Source
                      Language