cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

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

  ngOnInit() {
    this.spaceGuid = this.row.metadata.guid;
    this.entityConfig = new ComponentEntityMonitorConfig(this.spaceGuid, cfEntityFactory(spaceEntityType));
    this.orgGuid = this.cfOrgService.orgGuid;
    this.favorite = this.userFavoriteManager.getFavorite(this.row, spaceEntityType, CF_ENDPOINT_TYPE);

    Function getAllUsers has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private getAllUsers(endpointGuid: string): Observable<PaginationObservables<APIResource<CfUser>>> {
        if (!this.allUsers$) {
          this.allUsers$ = waitForCFPermissions(this.store, endpointGuid).pipe(
            switchMap(cf => {
              const isAdmin = cf.global.isAdmin;

      File steppers.component.ts has 260 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
        AfterContentInit,
        Component,
        ContentChildren,
        Input,

        Method MetricsSpecification.Connect has 80 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (m *MetricsSpecification) Connect(ec echo.Context, cnsiRecord interfaces.CNSIRecord, userId string) (*interfaces.TokenRecord, bool, error) {
            log.Debug("Metrics Connect...")
        
            params := new(interfaces.LoginToCNSIParams)
            err := interfaces.BindOnce(params, ec)
        Severity: Major
        Found in src/jetstream/plugins/metrics/main.go - About 2 hrs to fix

          Function getFolderSource has 80 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func getFolderSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage) (StratosProject, string, error) {
              // The msg data is JSON for the Folder info
              info := FolderSourceInfo{
                  WaitAfterUpload: false,
              }
          Severity: Major
          Found in src/jetstream/plugins/cfapppush/deploy.go - About 2 hrs to fix

            File autoscaler-transform-metric.ts has 258 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import moment from 'moment-timezone';
            
            import { PaginationResponse } from '../../../../cloud-foundry/src/store/types/cf-api.types';
            import {
              AppAutoscalerMetricBasicInfo,

              cfV2Actor has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type cfV2Actor struct {
                  wrapped         pushaction.V2Actor
                  sent            bool
                  msgSender       DeployAppMessageSender
                  clientWebsocket *websocket.Conn
              Severity: Minor
              Found in src/jetstream/plugins/cfapppush/push_actor.go - About 2 hrs to fix

                Method Analysis.doRunReport has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (c *Analysis) doRunReport(ec echo.Context, analyzer, endpointID, userID string, dbStore store.AnalysisStore, report *store.AnalysisRecord) error {
                
                    // Get Kube Config
                    k8s := c.portalProxy.GetPlugin("kubernetes")
                    if k8s == nil {
                Severity: Major
                Found in src/jetstream/plugins/analysis/run.go - About 2 hrs to fix

                  Function orgSpacePostProcess has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function orgSpacePostProcess(
                    store: Store<GeneralEntityAppState>,
                    action: GetOrganization | GetSpace,
                    apiResponse: APIResponse,
                    allEntities: GeneralRequestDataState): ValidateEntityResult {

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

                      constructor(
                        store: Store<AppState>,
                        listConfig?: IListConfig<APIResource>,
                        transformEntities?: any[],
                        paginationKey = CfAppsDataSource.paginationKey,

                      Function validate has 54 lines of code (exceeds 25 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);

                        Method PgsqlTokenRepository.SaveCNSIToken has 78 lines of code (exceeds 50 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: Major
                        Found in src/jetstream/repository/tokens/pgsql_tokens.go - About 2 hrs to fix

                          Function associateChildWithParent has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function associateChildWithParent(
                            store: Store<GeneralEntityAppState>,
                            action: EntityInlineChildAction,
                            apiResponse: APIResponse): Observable<boolean> {
                            let childValue;

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

                              constructor(
                                private store: Store<CFAppState>,
                                private cSIHelperServiceFactory: CreateServiceInstanceHelperServiceFactory,
                                private csiGuidsService: CsiGuidsService,
                                public modeService: CsiModeService,

                              Function createActionTableDate has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function createActionTableDate(orgTarget, spaceTarget, stateIcon = '') {
                                  const orgActions = [
                                    {
                                      user: userName,
                                      action: 'remove_circle\nRemove',
                              Severity: Major
                              Found in src/test-e2e/cloud-foundry/users-removal-e2e.helper.ts - About 2 hrs to fix

                                Function getObservables has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function getObservables<T = any>(
                                  store: Store<GeneralEntityAppState>,
                                  entityKey: string,
                                  paginationKey: string,
                                  paginationAction: PaginatedAction | PaginatedAction[],

                                  File local-list-controller.spec.ts has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { getCurrentPageStartIndex, splitCurrentPage } from './local-list-controller.helpers';
                                  
                                  describe('LocalListController', () => {
                                    const page = [
                                      [1,

                                    Method MetricsSpecification.UpdateMetadata has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
                                    Open

                                    func (m *MetricsSpecification) UpdateMetadata(info *interfaces.Info, userGUID string, echoContext echo.Context) {
                                    
                                        metricsProviders := make([]MetricsMetadata, 0)
                                        // Go through the metrics endpoints and get the corresponding services from the token metadata
                                        if metrics, ok := info.Endpoints[EndpointType]; ok {
                                    Severity: Minor
                                    Found in src/jetstream/plugins/metrics/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 portalProxy.registerRoutes has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
                                    Open

                                    func (p *portalProxy) registerRoutes(e *echo.Echo, needSetupMiddleware bool) {
                                        log.Debug("registerRoutes")
                                    
                                        e.GET("/swagger/*", echoSwagger.WrapHandler)
                                    
                                    
                                    Severity: Minor
                                    Found in src/jetstream/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 Monocular.artifactHubGetIcon has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
                                    Open

                                    func (m *Monocular) artifactHubGetIcon(c echo.Context) error {
                                        endpoint := c.Param("guid")
                                        repo := c.Param("repo")
                                        chartName := c.Param("name")
                                        version := c.Param("version")
                                    Severity: Minor
                                    Found in src/jetstream/plugins/monocular/artifacthub.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