cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

Function getColumns has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private getColumns(definition: KubeResourceEntityDefinition): ITableColumn<KubeAPIResource>[] {
    const component = this.uiConfigService.previewComponent.get(definition.type);
    let columns: Array<ITableColumn<KubeAPIResource>> = [
      // Name
      {

    Method PgsqlTokenRepository.FindAllCNSITokenBackup has 75 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (p *PgsqlTokenRepository) FindAllCNSITokenBackup(cnsiGUID string, encryptionKey []byte) ([]interfaces.BackupTokenRecord, error) {
        log.Debug("FindAllCNSITokenBackup")
        if cnsiGUID == "" {
            msg := "Unable to find 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

      Function createCredential has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        createCredential() {
          this.creating.next(true);
          let action: UpdateAppAutoscalerCredentialAction;
          if (this.editCredentialForm.controls.actype.value) {
            action = new UpdateAppAutoscalerCredentialAction(this.applicationService.appGuid, this.applicationService.cfGuid);

        Function parse has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public parse(config: string): Observable<string> {
            let doc: KubeConfigFile;
        
            const clusters: { [name: string]: KubeConfigFileCluster, } = {};
        
        

          Method CFPushApp.Init has 74 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (c *CFPushApp) Init(appDir string, manifestPath string, overrides CFPushAppOverrides) error {
          
              // App name
              if len(overrides.Name) > 0 {
                  c.pushCommand.OptionalArgs = flag.OptionalAppName{
          Severity: Minor
          Found in src/jetstream/plugins/cfapppush/pushapp.go - About 1 hr to fix

            Function scan has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public scan(packageJson: any) {
                this.pkgReadMap = new Map<string, PackageInfo>();
            
                if (packageJson.peerDependencies) {
                  Object.keys(packageJson.peerDependencies).forEach(dep => {
            Severity: Minor
            Found in src/frontend/packages/devkit/src/lib/packages.ts - About 1 hr to fix

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

                constructor(
                  public sessionService: SessionService,
                  public currentUserPermissionsService: CurrentUserPermissionsService,
                  public userProfileService: UserProfileService
                ) {

                Function KubeDashboardProxy has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
                Open

                func KubeDashboardProxy(c echo.Context, p interfaces.PortalProxy, config *rest.Config) error {
                    log.Debugf("KubeDashboardProxy request for: %s", c.Request().RequestURI)
                
                    cnsiGUID := c.Param("guid")
                    prefix := "/pp/v1/apps/kubedash/ui/" + cnsiGUID + "/"
                Severity: Minor
                Found in src/jetstream/plugins/kubernetes/dashboard/proxy.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.getGitSCMSource has a Cognitive Complexity of 18 (exceeds 8 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

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

                func ConfigInit(envLookup *env.VarSet, jetstreamConfig *interfaces.PortalConfig) {
                
                    // Check we are deployed in Cloud Foundry
                    if !envLookup.IsSet(VCapApplication) {
                        return
                Severity: Minor
                Found in src/jetstream/plugins/cloudfoundryhosting/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 onRunComplete has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    this.onRunComplete = (browser, result) => {
                
                      if (fs.existsSync(this.file)) {
                        fs.unlinkSync(this.file);
                      }
                Severity: Minor
                Found in build/karma.test.reporter.js - About 1 hr to fix

                  Function doCreateWindow has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function doCreateWindow(url) {
                  
                    let mainWindowState = windowStateKeeper({
                      defaultWidth: 1024,
                      defaultHeight: 768
                  Severity: Minor
                  Found in electron/index.js - About 1 hr to fix

                    Function createPaginationAction has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public createPaginationAction(isAdmin: boolean, cfGuid: string, orgGuid?: string, spaceGuid?: string): Observable<PaginatedAction> {
                        if (isAdmin) {
                          const allCfUsersAction = this.createCfGetAllUsersAction(cfGuid);
                    
                          if (!orgGuid) {

                      Function doEndpointAction has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private doEndpointAction(
                          apiAction: EntityRequestAction | PaginatedAction,
                          url: string,
                          params: HttpParams,
                          apiActionType: ApiRequestTypes = 'update',
                      Severity: Minor
                      Found in src/frontend/packages/store/src/effects/endpoint.effects.ts - About 1 hr to fix

                        Function parseKeyValue has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private parseKeyValue(key: any, value: any): Segment {
                            const segment: Segment = {
                              key,
                              value,
                              type: undefined,

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

                            ngOnInit() {
                              this.hasFavEntities = this.userFavoriteManager.endpointHasEntitiesThatCanFavorite(this.endpoint.cnsi_type);
                              // Favorites for this endpoint
                              this.favorites$ = this.userFavoriteManager.getFavoritesForEndpoint(this.endpoint.guid);
                              this.entity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_type);

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

                              ngOnInit() {
                                const chartConfigBuilder = getMetricsChartConfigBuilder<IMetricApplication>(
                                  result => {
                                    const metric = result.metric;
                                    if (!!metric.pod && !!metric.namespace) {

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

                                constructor(
                                  public cfEndpointService: CloudFoundryEndpointService,
                                  private currentUserPermissionsService: CurrentUserPermissionsService,
                                  endpointsService: EndpointsService,
                                  userFavoriteManager: UserFavoriteManager

                                Function resource$ has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      map((item: (KubeAPIResource | KubeStatus)) => {
                                        const resource: KubernetesResourceViewerResource = {} as KubernetesResourceViewerResource;
                                        const newItem = {} as any;
                                
                                        resource.raw = item;

                                  Function paginate has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function paginate(action, state: PaginationState = {}, updatePagination) {
                                    if (action.type === ApiActionTypes.API_REQUEST_START) {
                                      return state;
                                    }
                                  
                                  
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language