cloudfoundry-incubator/stratos

View on GitHub

Showing 1,111 of 1,370 total issues

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

  public static generate<
    B = any,
    C extends OrchestratedActionBuilderConfig = OrchestratedActionBuilders
  >(
    endpointDefinition: StratosEndpointExtensionDefinition,

    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 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

      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 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

        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

        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 portalProxy.DoRegisterEndpoint has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (p *portalProxy) DoRegisterEndpoint(cnsiName string, apiEndpoint string, skipSSLValidation bool, clientId string, clientSecret string, userId string, ssoAllowed bool, subType string, createSystemEndpoint bool, fetchInfo interfaces.InfoFunc) (interfaces.CNSIRecord, error) {
        Severity: Major
        Found in src/jetstream/cnsi.go - About 1 hr to fix

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

                public apply(src: string): string {
              
                  // Patch different page title if there is one
                  const title = this.config.stratosConfig.title || 'Stratos';
                  src = src.replace(/@@TITLE@@/g, title);
              Severity: Minor
              Found in src/frontend/packages/devkit/src/build/index.transform.ts - About 1 hr to fix

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

                  unconfigure(cfGUID: string) {
                    const confirmation = new ConfirmationDialogConfig(
                      'Disable User Invitations',
                      `Are you sure you want to disable user invitation support?`,
                      'Disable'
                  Severity
                  Category
                  Status
                  Source
                  Language