SUSE/stratos

View on GitHub

Showing 885 of 1,395 total issues

Avoid too many return statements within this function.
Open

          return 'none';
Severity: Major
Found in src/frontend/packages/core/src/shared/components/list/list.component.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return this.precisionIfUseful(mb) + ' MB';
    Severity: Major
    Found in src/frontend/packages/core/src/core/utils.service.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return { message: 'Authentication mechanism is not supported', warning: true };

        Avoid too many return statements within this function.
        Open

              return true;

          Avoid too many return statements within this function.
          Open

            return value;

            Avoid too many return statements within this function.
            Open

                return 0;

              Avoid too many return statements within this function.
              Open

                    return true;

                Method UserInvite.refreshToken has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func (invite *UserInvite) refreshToken(clientID, clientSecret string, endpoint interfaces.CNSIRecord) (*interfaces.UAAResponse, *interfaces.TokenRecord, error) {
                    now := time.Now()
                    clientSecret = strings.TrimSpace(clientSecret)
                    authEndpoint := fmt.Sprintf("%s/oauth/token", endpoint.TokenEndpoint)
                
                
                Severity: Minor
                Found in src/jetstream/plugins/userinvite/auth.go - About 25 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 KubernetesSpecification.ProxyKubernetesAPI has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func (c *KubernetesSpecification) ProxyKubernetesAPI(userID string, f KubeProxyFunc) (KubeProxyResponses, error) {
                
                    var p = c.portalProxy
                    k8sList := make([]*interfaces.ConnectedEndpoint, 0)
                    eps, err := p.ListEndpointsByUser(userID)
                Severity: Minor
                Found in src/jetstream/plugins/kubernetes/api_proxy.go - About 25 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 UserInvite.invite has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func (invite *UserInvite) invite(c echo.Context) error {
                    log.Debug("Invite User")
                    cfGUID := c.Param("id")
                
                    // Check that there is an endpoint with the specified ID and that it is a Cloud Foundry endpoint
                Severity: Minor
                Found in src/jetstream/plugins/userinvite/invite.go - About 25 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 makePrometheusRequestInfos has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func makePrometheusRequestInfos(c echo.Context, userGUID string, metrics map[string]EndpointMetricsRelation, prometheusOp string, queries string, addJob bool) []interfaces.ProxyRequestInfo {
                    // Construct the metadata for proxying
                    requests := make([]interfaces.ProxyRequestInfo, 0)
                    for _, metric := range metrics {
                        req := interfaces.ProxyRequestInfo{}
                Severity: Minor
                Found in src/jetstream/plugins/metrics/cloud_foundry.go - About 25 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 detectTLSCert has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func detectTLSCert(pc interfaces.PortalConfig) (string, string, error) {
                    log.Debug("detectTLSCert")
                    certFilename := "pproxy.crt"
                    certKeyFilename := "pproxy.key"
                
                
                Severity: Minor
                Found in src/jetstream/main.go - About 25 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 UserInvite.AssociateSpaceRoles has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func (invite *UserInvite) AssociateSpaceRoles(cnsiGUID, userID, newUserGUID string, inviteRequest *UserInviteReq) (*CFError, error) {
                    if inviteRequest.SpaceRoles.Auditor {
                        if cfError, err := invite.AssociateSpaceRoleForUser(cnsiGUID, userID, newUserGUID, inviteRequest.Space, "auditors"); err != nil {
                            return cfError, err
                        }
                Severity: Minor
                Found in src/jetstream/plugins/userinvite/invite.go - About 25 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 KubeDashboardStatus has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func KubeDashboardStatus(p interfaces.PortalProxy, endpointGUID, userGUID string, includeToken bool) (*StatusResponse, error) {
                
                    status := &StatusResponse{
                        Endpoint:  endpointGUID,
                        Installed: false,
                Severity: Minor
                Found in src/jetstream/plugins/kubernetes/dashboard/status.go - About 25 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 NewKubeTerminal has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func NewKubeTerminal(p interfaces.PortalProxy) *KubeTerminal {
                    // Only enabled in tech preview
                    if !p.GetConfig().EnableTechPreview {
                        log.Info("Kube Terminal not enabled - requires tech preview")
                        return nil
                Severity: Minor
                Found in src/jetstream/plugins/kubernetes/terminal/terminal.go - About 25 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.logoutOfCNSI has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func (p *portalProxy) logoutOfCNSI(c echo.Context) error {
                    log.Debug("logoutOfCNSI")
                
                    cnsiGUID := c.Param("cnsi_guid")
                
                
                Severity: Minor
                Found in src/jetstream/authcnsi.go - About 25 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 NewConfigFileLookup has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func NewConfigFileLookup(path string) env.Lookup {
                
                    // Check if the config file exists
                    if _, err := os.Stat(path); err != nil {
                        return env.NoopLookup
                Severity: Minor
                Found in src/jetstream/repository/interfaces/config/config.go - About 25 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 getJSONValue has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                func getJSONValue(data map[string]interface{}, valuePath string) string {
                    parts := strings.Split(valuePath, ".")
                    value := data[parts[0]]
                    if value != nil {
                        if len(parts) == 1 {
                Severity: Minor
                Found in src/jetstream/plugins/yamlgenerated/main.go - About 25 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.login has a Cognitive Complexity of 9 (exceeds 8 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) {
                    log.Debug("login")
                    if c.Request().Method == http.MethodGet {
                        code := c.QueryParam("code")
                        state := c.QueryParam("state")
                Severity: Minor
                Found in src/jetstream/auth.go - About 25 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 getXDomainLine has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                Open

                  getXDomainLine(): any[] {
                    let values = [];
                
                    for (const results of this.lineChart) {
                      for (const d of results.series) {

                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