cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

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

  ngOnInit() {

    // Listen for the graph
    this.graph = combineLatest(
      this.helper.fetchReleaseGraph(),

    Method CFAppPush.getGitSCMSource has 67 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage, userGUID string) (StratosProject, string, error) {
        var (
            err error
        )
    
    
    Severity: Minor
    Found in src/jetstream/plugins/cfapppush/deploy.go - About 1 hr to fix

      Method portalProxy.doRequest has 67 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (p *portalProxy) doRequest(cnsiRequest *interfaces.CNSIRequest, done chan<- *interfaces.CNSIRequest) {
          log.Debugf("doRequest for URL: %s", cnsiRequest.URL.String())
          var body io.Reader
          var res *http.Response
          var req *http.Request
      Severity: Minor
      Found in src/jetstream/passthrough.go - About 1 hr to fix

        Function login has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          login(username: string, password: string) {
            // If this is a different user to last time, then logout first
            if (SSOLoginPage.ssoLastUsername && SSOLoginPage.ssoLastUsername !== username) {
              browser.waitForAngularEnabled(false);
              this.logoutUAA();
        Severity: Minor
        Found in src/test-e2e/login/sso-login.po.ts - About 1 hr to fix

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

            ngOnInit() {
          
              const helmLastModifiedRegEx = /seconds:([0-9]*)/;
          
              this.sessionData$ = this.store.select(s => s.auth).pipe(

            Function goNext has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              goNext() {
                // Close previous error snackbar if there was one
                if (this.snackBarRef) {
                  this.snackBar.dismiss();
                }

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

                ngOnInit() {
                  this.isOrgRole = !this.spaceGuid;
                  const users$ = this.store.select(selectCfUsersRolesPicked);
                  // If setting an org role user must be admin or org manager.
                  // If setting a space role user must be admin, org manager or space manager

                Function constructor has 41 lines of code (exceeds 25 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 1 hr to fix

                  Function createLocalPageObservable has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private createLocalPageObservable(
                      pagination$: Observable<PaginationEntityState>,
                      schema: normalizrSchema.Entity,
                      fetching$: Observable<boolean>
                    ) {
                  Severity: Minor
                  Found in src/frontend/packages/store/src/monitors/pagination-monitor.ts - About 1 hr to fix

                    Function hasUpgrade has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public hasUpgrade(returnLatest = false): Observable<InternalHelmUpgrade> {
                        const updates = combineLatest(this.getCharts(), this.release$);
                        return updates.pipe(
                          map(([charts, release]) => {
                            let score = -1;

                      Method MetricsSpecification.getMetricsEndpoints has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (m *MetricsSpecification) getMetricsEndpoints(userGUID string, cnsiList []string) (map[string]EndpointMetricsRelation, error) {
                      
                          metricsProviders := make([]MetricsMetadata, 0)
                          endpointsMap := make(map[string]*interfaces.ConnectedEndpoint)
                          results := make(map[string]EndpointMetricsRelation)
                      Severity: Minor
                      Found in src/jetstream/plugins/metrics/main.go - About 1 hr to fix

                        Function processSingleItemDeleteAction has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private processSingleItemDeleteAction<T extends BasicKubeAPIResource>(action: KubeAction, url: string) {
                            this.store.dispatch(new StartRequestAction(action, 'delete'));
                            const headers = new HttpHeaders({
                              'x-cap-cnsi-list': action.kubeGuid,
                              'x-cap-passthrough': 'true'

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

                            constructor(
                              private store: Store<AppState>,
                              paginationMonitorFactory: PaginationMonitorFactory,
                              entityMonitorFactory: EntityMonitorFactory,
                              internalEventMonitorFactory: InternalEventMonitorFactory,

                            Method TokenStore.FindCNSIToken has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (d *TokenStore) FindCNSIToken(cnsiGUID string, userGUID string, encryptionKey []byte) (interfaces.TokenRecord, error) {
                            
                                // Main method that we need to override to get the token for the given endpoint
                                local, err := ListCloudFoundry()
                                if err == nil {
                            Severity: Minor
                            Found in src/jetstream/plugins/desktop/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 Analysis.OnEndpointNotification has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (analysis *Analysis) OnEndpointNotification(action interfaces.EndpointAction, endpoint *interfaces.CNSIRecord) {
                                if action == interfaces.EndpointUnregisterAction {
                                    // An endpoint was unregistered, so remove all reports
                                    dbStore, err := store.NewAnalysisDBStore(analysis.portalProxy.GetDatabaseConnection())
                                    if err == nil {
                            Severity: Minor
                            Found in src/jetstream/plugins/analysis/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 CFAppPush.deploy has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (cfAppPush *CFAppPush) deploy(echoContext echo.Context) error {
                            
                                cnsiGUID := echoContext.Param("cnsiGuid")
                                orgGUID := echoContext.Param("orgGuid")
                                spaceGUID := echoContext.Param("spaceGuid")
                            Severity: Minor
                            Found in src/jetstream/plugins/cfapppush/deploy.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 Analyzer.deleteEndpoint has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (a *Analyzer) deleteEndpoint(ec echo.Context) error {
                                log.Debug("delete reports for endpoint")
                            
                                endpoint := ec.Param("endpoint")
                            
                            
                            Severity: Minor
                            Found in src/jetstream/plugins/analysis/container/routes.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 a Cognitive Complexity of 16 (exceeds 8 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

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

                            func (k *KubeConfigFile) GetUserForCluster(clusterEndpoint string) (*KubeConfigUser, error) {
                            
                                var cluster *KubeConfigCluster
                                var err error
                            
                            
                            Severity: Minor
                            Found in src/jetstream/plugins/kubernetes/config/kube_config.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 ApplyMigrations has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func ApplyMigrations(conf *goose.DBConf, db *sql.DB) error {
                                current, err := goose.EnsureDBVersion(conf, db)
                                if err != nil {
                                    return fmt.Errorf("Failed to get database version: %s", err.Error())
                                }
                            Severity: Minor
                            Found in src/jetstream/datastore/datastore_migrator.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

                            Severity
                            Category
                            Status
                            Source
                            Language