cloudfoundry-incubator/stratos

View on GitHub

Showing 1,111 of 1,370 total issues

Function parseAuth has 61 lines of code (exceeds 25 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 || '';

    Function authReducer has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function authReducer(state: AuthState = defaultState, action): AuthState {
      switch (action.type) {
        case LOGIN:
          return { ...state, loggingIn: true, loggedIn: false, error: false };
        case LOGIN_SUCCESS:
    Severity: Major
    Found in src/frontend/packages/store/src/reducers/auth.reducer.ts - About 2 hrs to fix

      Function extractArchiveFiles has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring.
      Open

      func extractArchiveFiles(archivePath, chartName, downloadFolder string, filenames []string) error {
          // Map the filenames array into a map of path to destination file
          requiredFiles := make(map[string]string)
          requiredCount := len(filenames)
          for _, name := range filenames {
      Severity: Minor
      Found in src/jetstream/plugins/monocular/cache.go - About 2 hrs 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 CloudFoundrySpecification.cfLoginHook has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring.
      Open

      func (c *CloudFoundrySpecification) cfLoginHook(context echo.Context) error {
      
          cfAPI, cfCnsi, err := c.fetchAutoRegisterEndpoint()
          // CF auto reg url missing, continue as normal
          if cfAPI == "" {
      Severity: Minor
      Found in src/jetstream/plugins/cloudfoundry/main.go - About 2 hrs 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.SaveCNSIToken has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring.
      Open

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

        private validate(endpoints: EndpointModel[], cluster: KubeConfigFileCluster, clusters: KubeConfigFileCluster[]) {
          cluster._invalid = false;
          let reset = true;
      
          const found = endpoints.find(item => item.name === cluster.name);

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

        setActive(index: number) {
          if (this.basePreviousRedirect && index < 0) {
            this.dispatchRedirect(this.basePreviousRedirect);
          }
          if (!this.canGoto(index)) {

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

          function setupSpaceLevelTest(
            selectAddRemove: (rb: RadioGroup) => void,
            checkInitialState: () => void,
            checkFinishingState: () => void) {
            it('Check initial state and get to stepper', () => {

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

          ngOnInit() {
            if (this.setUsernames) {
              this.blocked.next(false);
            } else {
              this.cfRolesService.loading$.subscribe(loading => this.blocked.next(loading));

          Method CFHosting.Init has 84 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (ch *CFHosting) Init() error {
          
              // Determine if we are running CF by presence of env var "VCAP_APPLICATION" and configure appropriately
              if ch.portalProxy.Env().IsSet(VCapApplication) {
                  log.Info("Detected that Console is deployed as a Cloud Foundry Application")
          Severity: Major
          Found in src/jetstream/plugins/cloudfoundryhosting/main.go - About 2 hrs to fix

            Method PgsqlTokenRepository.findCNSIToken has 84 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (p *PgsqlTokenRepository) findCNSIToken(cnsiGUID string, userGUID string, encryptionKey []byte, includeDisconnected bool) (interfaces.TokenRecord, error) {
                log.Debug("findCNSIToken")
                if cnsiGUID == "" {
                    msg := "Unable to find CNSI Token without a valid CNSI GUID."
                    log.Debug(msg)
            Severity: Major
            Found in src/jetstream/repository/tokens/pgsql_tokens.go - About 2 hrs to fix

              AutoscalerEffects has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              @Injectable()
              export class AutoscalerEffects {
                constructor(
                  private http: HttpClient,
                  private actions$: Actions,
              Severity: Minor
              Found in src/frontend/packages/cf-autoscaler/src/store/autoscaler.effects.ts - About 2 hrs to fix

                Method portalProxy.getInfo has 83 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (p *portalProxy) getInfo(c echo.Context) (*interfaces.Info, error) {
                    // get the version
                    versions, err := p.getVersionsData()
                    if err != nil {
                        return nil, errors.New("Could not find database version")
                Severity: Major
                Found in src/jetstream/info.go - About 2 hrs to fix

                  Method Analyzer.doRun has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (a *Analyzer) doRun(ec echo.Context) error {
                  
                      log.Debug("Run analyzer!")
                  
                      engine := ec.Param("analyzer")
                  Severity: Major
                  Found in src/jetstream/plugins/analysis/container/run.go - About 2 hrs to fix

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

                      constructor(
                        public endpointsService: EndpointsService,
                        private store: Store<AppState>,
                        public userFavoriteManager: UserFavoriteManager,
                        private scrollDispatcher: ScrollDispatcher,

                      Method cnsiTokenBackup.createBackup has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring.
                      Open

                      func (ctb *cnsiTokenBackup) createBackup(data *BackupRequest) (*BackupContent, error) {
                          log.Debug("createBackup")
                          allEndpoints, err := ctb.p.ListEndpoints()
                          if err != nil {
                              return nil, interfaces.NewHTTPShadowError(http.StatusBadGateway, "Failed to fetch endpoints", "Failed to fetch endpoints: %+v", err)
                      Severity: Minor
                      Found in src/jetstream/plugins/backup/backup_restore.go - About 2 hrs 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 Monocular.procesChartVersions has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring.
                      Open

                      func (m *Monocular) procesChartVersions(endpoint, repoURL, repoName, name string, chartVersions []IndexFileMetadata) syncResult {
                      
                          result := syncResult{}
                      
                          // Find the newest version
                      Severity: Minor
                      Found in src/jetstream/plugins/monocular/sync_worker.go - About 2 hrs 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 HelmRelease.processJsonResource has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring.
                      Open

                      func (r *HelmRelease) processJsonResource(obj interface{}) {
                          data, err := json.Marshal(obj)
                          if err == nil {
                              var t KubeResource
                              if err := json.Unmarshal(data, &t); err == nil {
                      Severity: Minor
                      Found in src/jetstream/plugins/kubernetes/helm/release.go - About 2 hrs 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.SetupMiddleware has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring.
                      Open

                      func (p *portalProxy) SetupMiddleware() echo.MiddlewareFunc {
                      
                          return func(h echo.HandlerFunc) echo.HandlerFunc {
                      
                              if !setupComplete {
                      Severity: Minor
                      Found in src/jetstream/setup_console.go - About 2 hrs 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.doRequest has a Cognitive Complexity of 20 (exceeds 8 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 2 hrs 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