SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Function load has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  load(): Observable<boolean> {
    const guid = this.endpoint.guid;
    const podsObs = kubeEntityCatalog.pod.store.getPaginationService(guid);
    const pods$ = podsObs.entities$;
    const nodesObs = kubeEntityCatalog.node.store.getPaginationService(guid);

    Method KubeTerminal.Start has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
    Open

    func (k *KubeTerminal) Start(c echo.Context) error {
        log.Debug("Kube Terminal start request")
    
        endpointGUID := c.Param("guid")
        userGUID := c.Get("user_id").(string)
    Severity: Minor
    Found in src/jetstream/plugins/kubernetes/terminal/start.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 portalProxy.loginToUAA has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
    Open

    func (p *portalProxy) loginToUAA(c echo.Context) (*interfaces.LoginRes, error) {
        log.Debug("loginToUAA")
        uaaRes, u, err := p.login(c, p.Config.ConsoleConfig.SkipSSLValidation, p.Config.ConsoleConfig.ConsoleClient, p.Config.ConsoleConfig.ConsoleClientSecret, p.getUAAIdentityEndpoint())
        var resp *interfaces.LoginRes
        if err != nil {
    Severity: Minor
    Found in src/jetstream/authuaa.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 TokenStore.FindCNSIToken has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
    Open

    func (d *TokenStore) FindCNSIToken(cnsiGUID string, userGUID string, encryptionKey []byte) (interfaces.TokenRecord, error) {
    
        local, cfg, err := ListKubernetes()
        if err == nil {
            for _, cluster := range local {
    Severity: Minor
    Found in src/jetstream/plugins/desktop/kubernetes/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

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

    func (p *portalProxy) initialiseConsoleConfig(envLookup *env.VarSet) (*interfaces.ConsoleConfig, error) {
        log.Debug("initialiseConsoleConfig")
    
        consoleConfig := &interfaces.ConsoleConfig{}
        if err := config.Load(consoleConfig, envLookup.Lookup); err != nil {
    Severity: Minor
    Found in src/jetstream/setup_console.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 MigrateSetupData has 15 return statements (exceeds 4 allowed).
    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: Major
    Found in src/jetstream/repository/console_config/env_lookup.go - About 1 hr to fix

      Function getYDomainLine has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
      Open

        getYDomainLine(): any[] {
          const domain = [];
      
          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

      Function parseAuth has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
      Open

        public parseAuth(cluster: KubeConfigFileCluster, user: KubeConfigFileUser): RowState {
      
          // Default subtype is generic Kubernetes ('') or previously determined/selected sub type
          cluster._subType = cluster._subType || '';
      
      

      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 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        ngOnInit() {
          this.appSub$ = this.applicationService.entityService.entityMonitor.entityRequest$.subscribe(requestInfo => {
            if (
              requestInfo.deleting.deleted ||
              requestInfo.error

        Function ngOnInit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          ngOnInit() {
            this.boundApps$ = combineLatest([
              this.config$.asObservable().pipe(first()),
              this.row$
            ]).pipe(

          Function ngOnInit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            ngOnInit() {
              this.addOrg = new FormGroup({
                orgName: new FormControl('', [Validators.required as any, this.nameTakenValidator()]),
                quotaDefinition: new FormControl(),
              });

            Function getPaginationStore has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static getPaginationStore<Y, ABC extends OrchestratedActionBuilders = OrchestratedActionBuilders>(
                builders: KnownActionBuilders<ABC>,
                entityKey: string,
                getSchema: (schema: string) => EntitySchema
              ): CustomEntityCatalogEntityStore<Y, ABC> {

              Function userFavoriteGroupsReducer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function userFavoriteGroupsReducer(
                state: IUserFavoritesGroupsState = getDefaultFavoriteGroupsState(),
                action: Action
              ): IUserFavoritesGroupsState {
                switch (action.type) {

                Function apply has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private apply(response) {
                    if (response) {
                      // In order to supplement the sanitizers with extra properties need to create new obj (see spread below and `reduce`)
                      response = {
                        ...response,

                  Function getActionBuilder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static getActionBuilder(
                      configOrBuilder: OrchestratedActionBuilder |
                        EntityRequestActionConfig<OrchestratedActionBuilder> |
                        PaginationRequestActionConfig<OrchestratedActionBuilder>,
                      actionKey: string,

                    Function newPortalProxy has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func newPortalProxy(pc interfaces.PortalConfig, dcp *sql.DB, ss HttpSessionStore, sessionStoreOptions *sessions.Options, env *env.VarSet) *portalProxy {
                        log.Debug("newPortalProxy")
                    
                        // Generate cookie name - avoids issues if the cookie domain is changed
                        cookieName := jetstreamSessionName
                    Severity: Minor
                    Found in src/jetstream/main.go - About 1 hr to fix

                      Method Analysis.checkStatus has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (c *Analysis) checkStatus() error {
                          log.Debug("Checking status....")
                          p := c.portalProxy
                          // Create a record in the reports datastore
                          dbStore, err := store.NewAnalysisDBStore(p.GetDatabaseConnection())
                      Severity: Minor
                      Found in src/jetstream/plugins/analysis/status.go - About 1 hr to fix

                        Method UserInvite.UAAUserInvite has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (invite *UserInvite) UAAUserInvite(c echo.Context, endpoint interfaces.CNSIRecord, uaaInviteReq *UserInviteReq) (*UserInviteResponse, error) {
                            log.Debug("Requesting invite links from UAA")
                        
                            // See if we can get a token for the invite user
                            token, ok := invite.portalProxy.GetCNSITokenRecord(endpoint.GUID, UserInviteUserID)
                        Severity: Minor
                        Found in src/jetstream/plugins/userinvite/invite.go - About 1 hr to fix

                          Method PgsqlTokenRepository.UpdateTokenAuth has 59 lines of code (exceeds 50 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

                            Function autoscalerTransformMapToArray has 34 lines of code (exceeds 25 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
                              };
                              Severity
                              Category
                              Status
                              Source
                              Language