SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Method PgsqlLocalUsersRepository.AddLocalUser has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
Open

func (p *PgsqlLocalUsersRepository) AddLocalUser(user interfaces.LocalUser) error {

    log.Debug("AddLocalUser")

    //Validate args
Severity: Minor
Found in src/jetstream/repository/localusers/psql_localusers.go - About 45 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.setupGetAvailableScopes has 7 return statements (exceeds 4 allowed).
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: Major
Found in src/jetstream/setup_console.go - About 45 mins to fix

    Function normalizeValue has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      _proto.normalizeValue = function normalizeValue(value, parent, key, visit, addEntity, visitedEntities) {
    Severity: Minor
    Found in src/frontend/packages/store/src/normalizr/normalizr.js - About 45 mins to fix

      Function updateCFFIle has 7 return statements (exceeds 4 allowed).
      Open

      func updateCFFIle(updates map[string]string) error {
          usr, err := user.Current()
          if err != nil {
              return err
          }
      Severity: Major
      Found in src/jetstream/plugins/desktop/kubernetes/kubeconfig.go - About 45 mins to fix

        Method CloudFoundrySpecification.openNoaaConsumer has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
        Open

        func (c CloudFoundrySpecification) openNoaaConsumer(echoContext echo.Context) (*AuthorizedConsumer, error) {
        
            ac := &AuthorizedConsumer{}
        
            // Get the CNSI and app IDs from route parameters
        Severity: Minor
        Found in src/jetstream/plugins/cloudfoundry/cf_websocket_streams.go - About 45 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 init has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
        Open

        func init() {
            RegisterMigration(20180413135700, "MetricsSchema", func(txn *sql.Tx, conf *goose.DBConf) error {
                if strings.Contains(conf.Driver.Name, "sqlite3") {
                    // SQLite does not support MODIFY on ALTER TABLE - but fortunately it doesn't mind about the column sizes
                    return nil
        Severity: Minor
        Found in src/jetstream/datastore/20180413135700_MetricsSchema.go - About 45 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

        Avoid deeply nested control flow statements.
        Open

                    if consoleConfig.AuthorizationEndpoint == nil {
                        // No Authorization endpoint
                        consoleConfig.AuthorizationEndpoint = consoleConfig.UAAEndpoint
                        log.Debugf("Using UAA Endpoint for Auth Endpoint: %s", consoleConfig.AuthorizationEndpoint)
                    }
        Severity: Major
        Found in src/jetstream/setup_console.go - About 45 mins to fix

          Method PgsqlTokenRepository.SaveAuthToken has 7 return statements (exceeds 4 allowed).
          Open

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

            Method portalProxy.DoLoginToCNSIwithConsoleUAAtoken has 7 return statements (exceeds 4 allowed).
            Open

            func (p *portalProxy) DoLoginToCNSIwithConsoleUAAtoken(c echo.Context, theCNSIrecord interfaces.CNSIRecord) error {
                userID, err := p.GetSessionStringValue(c, "user_id")
                if err != nil {
                    return errors.New("could not find correct session value")
                }
            Severity: Major
            Found in src/jetstream/authcnsi.go - About 45 mins to fix

              Method portalProxy.ProxyRequest has 7 return statements (exceeds 4 allowed).
              Open

              func (p *portalProxy) ProxyRequest(c echo.Context, uri *url.URL) (map[string]*interfaces.CNSIRequest, error) {
                  log.Debug("ProxyRequest")
                  cnsiList := strings.Split(c.Request().Header.Get("x-cap-cnsi-list"), ",")
                  shouldPassthrough := "true" == c.Request().Header.Get("x-cap-passthrough")
                  longRunning := "true" == c.Request().Header.Get(longRunningTimeoutHeader)
              Severity: Major
              Found in src/jetstream/passthrough.go - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if err != nil {
                                        return fmt.Errorf("Can not get endpoint type for %s: '%v'", endpoint.CNSIType, err)
                                    }
                Severity: Major
                Found in src/jetstream/cnsi.go - About 45 mins to fix

                  Function normalize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    _proto.normalize = function normalize(input, parent, key, visit, addEntity, visitedEntities) {
                  Severity: Minor
                  Found in src/frontend/packages/store/src/normalizr/normalizr.js - About 45 mins to fix

                    Function updateUser has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      apiUsers: IRequestEntityTypeState<APIResource<CfUser>>,
                      existingUsers: IRequestEntityTypeState<APIResource<CfUser>>,
                      newUsers: IRequestEntityTypeState<APIResource<CfUser>>,
                      orgOrSpace,
                      orgSpaceParamName: string,

                      Function normalize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        _proto.normalize = function normalize(input, parent, key, visit, addEntity, visitedEntities) {
                      Severity: Minor
                      Found in src/frontend/packages/store/src/normalizr/normalizr.js - About 45 mins to fix

                        Function normalize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          _proto.normalize = function normalize(input, parent, key, visit, addEntity, visitedEntities) {
                        Severity: Minor
                        Found in src/frontend/packages/store/src/normalizr/normalizr.js - About 45 mins to fix

                          Function normalize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            _proto.normalize = function normalize(input, parent, key, visit, addEntity, visitedEntities) {
                          Severity: Minor
                          Found in src/frontend/packages/store/src/normalizr/normalizr.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        if (scExtState) {
                                          extState = scExtState;
                                        } else {
                                          extState = pkgState + '(' +
                                            this.formatCount(counts.running) + ',' +

                              Function apply has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                              Open

                                public apply(src: string): string {
                              
                                  // Patch different page title if there is one
                                  const title = this.config.stratosConfig.title || 'Stratos';
                                  src = src.replace(/@@TITLE@@/g, title);
                              Severity: Minor
                              Found in src/frontend/packages/devkit/src/build/index.transform.ts - About 45 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 constructor has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                              Open

                                constructor(dir: string, options?: any, loggingEnabled = true) {
                                  this.angularJsonFile = this.findFileOrFolderInChain(dir, 'angular.json');
                                  this.angularJson = JSON.parse(fs.readFileSync(this.angularJsonFile, 'utf8').toString());
                                  this.loggingEnabled = loggingEnabled;
                              
                              
                              Severity: Minor
                              Found in src/frontend/packages/devkit/src/lib/stratos.config.ts - About 45 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 constructor has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                              Open

                                constructor(
                                  private store: Store<CFAppState>,
                                  private activeRouteCfOrgSpace: ActiveRouteCfOrgSpace,
                                  private cfUserService: CfUserService,
                                  private route: ActivatedRoute

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language