SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Function constructor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(
    definition: IStratosEntityDefinition | IStratosEndpointDefinition | IStratosBaseEntityDefinition,
    public readonly builders: EntityCatalogBuilders<T, Y, AB> = {}
  ) {
    this.definition = this.populateEntity(definition);

    Function canActivate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      canActivate(route: ActivatedRouteSnapshot, routeState: RouterStateSnapshot): Observable<boolean> {
        // Reroute user to endpoint/no endpoint screens if there are no connected or registered endpoints
        return observableCombineLatest(
          this.store.select('auth'),
          this.store.select(endpointStatusSelector)
    Severity: Minor
    Found in src/frontend/packages/core/src/core/endpoints.service.ts - About 1 hr to fix

      Method Monocular.syncOnStartup has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

      func (m *Monocular) syncOnStartup() {
          // Always sync all repositories on startup
      
          // Get all of the helm endpoints
          endpoints, err := m.portalProxy.ListEndpoints()
      Severity: Minor
      Found in src/jetstream/plugins/monocular/main.go - About 1 hr 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 MetricsSpecification.getCloudFoundryMetrics has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

      func (m *MetricsSpecification) getCloudFoundryMetrics(c echo.Context) error {
          userGUID, err := m.portalProxy.GetSessionStringValue(c, "user_id")
          if err != nil {
              return errors.New("Could not find session user_id")
          }
      Severity: Minor
      Found in src/jetstream/plugins/metrics/cloud_foundry.go - About 1 hr 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 CFAppPush.deploy has 13 return statements (exceeds 4 allowed).
      Open

      func (cfAppPush *CFAppPush) deploy(echoContext echo.Context) error {
      
          cnsiGUID := echoContext.Param("cnsiGuid")
          orgGUID := echoContext.Param("orgGuid")
          spaceGUID := echoContext.Param("spaceGuid")
      Severity: Major
      Found in src/jetstream/plugins/cfapppush/deploy.go - About 1 hr to fix

        Function start has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
        Open

        func start(config interfaces.PortalConfig, p *portalProxy, needSetupMiddleware bool, isUpgrade bool, envLookup *env.VarSet) error {
            log.Debug("start")
            e := echo.New()
            e.HideBanner = true
            e.HidePort = true
        Severity: Minor
        Found in src/jetstream/main.go - About 1 hr 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 cnsiTokenBackup.restoreBackup has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
        Open

        func (ctb *cnsiTokenBackup) restoreBackup(backup *RestoreRequest) error {
            log.Debug("restoreBackup")
        
            data := &BackupContent{}
            if err := json.Unmarshal([]byte(backup.Data), data); err != nil {
        Severity: Minor
        Found in src/jetstream/plugins/backup/backup_restore.go - About 1 hr 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 CFAppSSH.appSSH has 13 return statements (exceeds 4 allowed).
        Open

        func (cfAppSsh *CFAppSSH) appSSH(c echo.Context) error {
            // Need to get info for the endpoint
            // Get the CNSI and app IDs from route parameters
            cnsiGUID := c.Param("cnsiGuid")
            userGUID := c.Get("user_id").(string)
        Severity: Major
        Found in src/jetstream/plugins/cfappssh/app_ssh.go - About 1 hr to fix

          Function NewDatabaseConnectionParametersFromConfig has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
          Open

          func NewDatabaseConnectionParametersFromConfig(dc DatabaseConfig) (DatabaseConfig, error) {
          
              if len(dc.DatabaseProvider) == 0 {
                  dc.DatabaseProvider = DefaultDatabaseProvider
              }
          Severity: Minor
          Found in src/jetstream/datastore/datastore.go - About 1 hr 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 readLoop has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
          Open

          func readLoop(c *websocket.Conn, stopchan chan<- bool, pausechan chan<- bool) {
              for {
          
                  messageType, r, err := c.NextReader()
                  if err != nil {
          Severity: Minor
          Found in src/jetstream/plugins/kubernetes/get_release.go - About 1 hr 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.UpdateTokenAuth has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
          Open

          func (p *PgsqlTokenRepository) UpdateTokenAuth(userGUID string, tr interfaces.TokenRecord, encryptionKey []byte) error {
              log.Debug("UpdateTokenAuth")
          
              if userGUID == "" {
                  msg := "Unable to save Token without a valid User GUID."
          Severity: Minor
          Found in src/jetstream/repository/tokens/pgsql_tokens.go - About 1 hr 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 WaitForMigrations has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
          Open

          func WaitForMigrations(db *sql.DB) error {
              migrations := GetOrderedMigrations()
              targetVersion := migrations[len(migrations)-1]
          
              // Timeout after which we will give up
          Severity: Minor
          Found in src/jetstream/datastore/datastore.go - About 1 hr 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 localAuth.localLogin has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
          Open

          func (a *localAuth) localLogin(c echo.Context) (string, string, error) {
              log.Debug("doLocalLogin")
          
              username := c.FormValue("username")
              password := c.FormValue("password")
          Severity: Minor
          Found in src/jetstream/authlocal.go - About 1 hr 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 mergeDeep has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
          Open

            private mergeDeep(target, ...sources) {
              if (!sources.length) {
                return target;
              }
              const source = sources.shift();

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

            constructor(
              private loggedInService: LoggedInService,
              store: Store<AuthOnlyAppState>,
              public themeService: ThemeService,
              @Inject(DOCUMENT) private document: Document,
          Severity: Minor
          Found in src/frontend/packages/core/src/app.component.ts - About 1 hr 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 setProps has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
          Open

            setProps(props: KubernetesResourceViewerConfig) {
              this.title = props.title;
              this.analysis = props.analysis;
              this.component = props.component;
          
          

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

            init() {
              const eventStreams = this.userActiveEvents.map((eventName) => {
                return fromEvent(document, eventName);
              });
          
          
          Severity: Minor
          Found in src/frontend/packages/core/src/logged-in.service.ts - About 1 hr 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 InstallDashboard has 56 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func InstallDashboard(p interfaces.PortalProxy, endpointGUID, userGUID string) error {
              // Download the Yaml for the dashboard
              kubeDashboardImage := p.Env().String("STRATOS_KUBERNETES_DASHBOARD_IMAGE", "")
              if len(kubeDashboardImage) == 0 {
                  kubeDashboardImage = dashboardInstallYAMLDownloadURL
          Severity: Minor
          Found in src/jetstream/plugins/kubernetes/dashboard/configure.go - About 1 hr to fix

            Function MigrateSetupData has 56 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func MigrateSetupData(portal interfaces.PortalProxy, configStore Repository) error {
            
                // Determine if we need to migrate data first
                _, ok, err := configStore.GetValue(systemGroupName, configSetupNeededMarker)
                if err != nil {
            Severity: Minor
            Found in src/jetstream/repository/console_config/env_lookup.go - About 1 hr to fix

              Function EntitySchema has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function EntitySchema(key, definition, options) {
                  if (definition === void 0) {
                    definition = {};
                  }
              
              
              Severity: Minor
              Found in src/frontend/packages/store/src/normalizr/normalizr.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language