cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

Avoid too many return statements within this function.
Open

      return true;

    Avoid too many return statements within this function.
    Open

      return false;
    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 0;

        Avoid too many return statements within this function.
        Open

              return true;

          Avoid too many return statements within this function.
          Open

                return false;

            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

              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

              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

              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

              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

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

                public createPaginationAction(isAdmin: boolean, cfGuid: string, orgGuid?: string, spaceGuid?: string): Observable<PaginatedAction> {
                  if (isAdmin) {
                    const allCfUsersAction = this.createCfGetAllUsersAction(cfGuid);
              
                    if (!orgGuid) {

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

              export function autoscalerTransformMapToArray(oldPolicy: AppAutoscalerPolicyLocal) {
                const newPolicy: AppAutoscalerPolicy = {
                  instance_min_count: oldPolicy.instance_min_count,
                  instance_max_count: oldPolicy.instance_max_count
                };

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

                protected setQParam(setQ: QParam, qs: QParam[]): boolean {
                  const existing = qs.find((q: QParam) => q.key === setQ.key);
                  let changed = true;
                  if (setQ.value && setQ.value.length) {
                    if (existing) {
              Severity: Minor
              Found in src/frontend/packages/cloud-foundry/src/shared/cf-list-data-source.ts - 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 initServiceObservables has a Cognitive Complexity of 9 (exceeds 8 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),

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

                private applyDefaultExcludes() {
                  const defaultExcludedPackages = ['@example/theme', '@example/extensions', '@stratosui/desktop-extensions'];
                  if (this.stratosConfig && this.stratosConfig.packages && this.stratosConfig.packages.desktop) {
                    defaultExcludedPackages.pop();
                    this.log('Building with desktop package');
              Severity: Minor
              Found in src/frontend/packages/devkit/src/lib/stratos.config.ts - 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 open has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
              Open

                open() {
                  if (this.isOpen) {
                    return;
                  }
              
              

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

                public scan(packageJson: any) {
                  this.pkgReadMap = new Map<string, PackageInfo>();
              
                  if (packageJson.peerDependencies) {
                    Object.keys(packageJson.peerDependencies).forEach(dep => {
              Severity: Minor
              Found in src/frontend/packages/devkit/src/lib/packages.ts - 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

              Severity
              Category
              Status
              Source
              Language