cloudfoundry/stratos

View on GitHub

Showing 718 of 1,370 total issues

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

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

        private processSingleItemAction<T extends BasicKubeAPIResource>(
          action: KubeAction,
          url: string,
          body?: any) {
          const requestType: ApiRequestTypes = body ? 'create' : 'fetch';

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

          ngOnInit() {
            this.committedAction = this.metricsConfig.metricsAction;
            this.metricsMonitor = this.entityMonitorFactory.create<IMetrics>(
              this.metricsConfig.metricsAction.guid,
              this.committedAction

          Method HelmReleaseGraph.ParseManifest has 69 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (r *HelmReleaseGraph) ParseManifest(release *HelmRelease) {
              for _, item := range release.Resources {
                  node := ReleaseNode{
                      ID:    fmt.Sprintf("%s-%s", item.Kind, item.Metadata.Name),
                      Label: item.Metadata.Name,
          Severity: Minor
          Found in src/jetstream/plugins/kubernetes/helm/graph.go - About 1 hr to fix

            Method KubernetesSpecification.GetReleaseStatus has 69 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (c *KubernetesSpecification) GetReleaseStatus(ec echo.Context) error {
            
                // Need to get a config object for the target endpoint
                endpointGUID := ec.Param("endpoint")
                release := ec.Param("name")
            Severity: Minor
            Found in src/jetstream/plugins/kubernetes/get_release.go - About 1 hr to fix

              Function cleanUpServiceInstances has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                cleanUpServiceInstances(serviceInstanceNames: string[], userProvided = false): promise.Promise<any> {
                  // Sleeping because the service instance may not be listed in the `get services` request
                  browser.sleep(1000);
                  if (serviceInstanceNames.length === 0) {
                    return promise.fullyResolved(createEmptyCfResponse());
              Severity: Minor
              Found in src/test-e2e/marketplace/services-helper-e2e.ts - About 1 hr to fix

                Function generateCFAppStatsEntity has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function generateCFAppStatsEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
                  const definition: IStratosEntityDefinition<any, AppStat> = {
                    type: appStatsEntityType,
                    schema: cfEntityFactory(appStatsEntityType),
                    endpoint: endpointDefinition,
                Severity: Minor
                Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

                  Function default has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function (options: ThemeOptionsSchema): Rule {
                    return async (host: Tree, context: SchematicContext) => {
                      if (!options.name) {
                        throw new SchematicsException(`Invalid options, "name" is required.`);
                      }
                  Severity: Minor
                  Found in src/frontend/packages/devkit/src/schematics/theme/index.ts - About 1 hr to fix

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

                      constructor(
                        private store: Store<AppState>,
                        private activeRouteCfOrgSpace: ActiveRouteCfOrgSpace,
                        private cfUserService: CfUserService,
                        private cfRolesService: CfRolesService,

                      Function paginationMaxReached has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function paginationMaxReached(state: PaginationState, action: UpdatePaginationMaxedState): PaginationState {
                        const entityKey = entityCatalog.getEntityKey(action);
                        if (!state[entityKey] || !state[entityKey][action.paginationKey]) {
                          return state;
                        }

                        Function ngOnInit has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Confirmed

                          ngOnInit() {
                            const events$ = this.eventService.events$.pipe(
                              map(events => {
                                if (this.endpointOnly) {
                                  return events.filter(event => event.key.split('-')[0] === 'endpointError');

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

                            constructor(
                              store: Store<AppState>,
                              listConfig: IListConfig<EndpointModel>,
                              action: GetAllEndpoints,
                              dsEndpointType: string = null,

                            Method UaaUserInfo.uaa has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (userInfo *UaaUserInfo) uaa(target string, body []byte) (int, []byte, *http.Header, error) {
                                log.Debug("uaa request")
                            
                                // Check session
                                _, err := userInfo.portalProxy.GetSessionInt64Value(userInfo.echo, "exp")
                            Severity: Minor
                            Found in src/jetstream/plugins/userinfo/uaa_user.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.getRepoStatuses has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (m *Monocular) getRepoStatuses(c echo.Context) error {
                                log.Debug("getRepoStatuses")
                            
                                // Get the list of endpoints we are looking at
                                // Need to extract the parameters from the request body
                            Severity: Minor
                            Found in src/jetstream/plugins/monocular/repository.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.Connect has a Cognitive Complexity of 17 (exceeds 8 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: Minor
                            Found in src/jetstream/plugins/metrics/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.artifactHubGetPackageInfo has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (m *Monocular) artifactHubGetPackageInfo(endpointID, repo, name, version string) (*ahInfo, error) {
                                // Make sure we handle an empty version correctly
                                var cacheName string
                                var versionPart = ""
                                if len(version) > 0 {
                            Severity: Minor
                            Found in src/jetstream/plugins/monocular/artifacthub.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 mapContainerStatus has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func mapContainerStatus(status v1.PodStatus, name string) NodeStatus {
                                for _, cstat := range status.ContainerStatuses {
                                    if cstat.Name == name {
                                        if cstat.Ready {
                                            return NodeOK
                            Severity: Minor
                            Found in src/jetstream/plugins/kubernetes/helm/graph_status.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 ConsoleConfig.IsSetupComplete has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (consoleConfig *ConsoleConfig) IsSetupComplete() bool {
                            
                                // No auth, then setup is complete
                                if AuthEndpointTypes[consoleConfig.AuthEndpointType] == AuthNone {
                                    return true
                            Severity: Minor
                            Found in src/jetstream/repository/interfaces/structs.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 PostgresCNSIRepository.List has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
                            Open

                            func (p *PostgresCNSIRepository) List(encryptionKey []byte) ([]*interfaces.CNSIRecord, error) {
                                log.Debug("List")
                                rows, err := p.db.Query(listCNSIs)
                                if err != nil {
                                    return nil, fmt.Errorf("Unable to retrieve CNSI records: %v", err)
                            Severity: Minor
                            Found in src/jetstream/repository/cnsis/pgsql_cnsis.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

                            Severity
                            Category
                            Status
                            Source
                            Language