cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

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

function generateCFServiceInstanceEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
  const definition: IStratosEntityDefinition = {
    type: serviceInstancesEntityType,
    schema: {
      default: cfEntityFactory(serviceInstancesEntityType),
Severity: Minor
Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

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

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

            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

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

                  function setup(orgName: string, appNames: string[], orderImportant: boolean) {
                    defaultCf = e2e.secrets.getDefaultCFEndpoint();
                    endpointGuid = e2e.helper.getEndpointGuid(e2e.info, defaultCf.name);
                
                    return browser.wait(
                Severity: Minor
                Found in src/test-e2e/applications/application-wall-e2e.spec.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language