cloudfoundry-incubator/stratos

View on GitHub

Showing 1,111 of 1,370 total issues

Function handleSpaceRoleChange has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function handleSpaceRoleChange(
  state: IAllCfRolesState,
  endpointGuid: string,
  cf: ICfRolesState,
  orgGuid: string,

    Function generateEventEntity has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function generateCFUserProvidedServiceInstanceEntity has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function generateCFUserProvidedServiceInstanceEntity(endpointDefinition: StratosEndpointExtensionDefinition) {
        const definition: IStratosEntityDefinition = {
          type: userProvidedServiceInstanceEntityType,
          schema: cfEntityFactory(userProvidedServiceInstanceEntityType),
          label: 'User Provided Service Instance',
      Severity: Minor
      Found in src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts - About 1 hr to fix

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

          ngOnInit() {
            if (this.placeholderMode) {
              this.canRefresh = false;
              this.hasEntities$ = of(false);
              return;

          Function createProvider has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private createProvider(catalogEntity: any) {
              this.isNamespacedView = !this.isWorkloadView && !!catalogEntity.definition.apiNamespaced;
              let action;
              if (this.isWorkloadView) {
                action = catalogEntity.actions.getInWorkload(this.kubeId, this.workloadNamespace, this.workloadTitle);

            Function recentlyVisitedReducer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function recentlyVisitedReducer(
              state: IRecentlyVisitedState = getDefaultRecentState(),
              action: Action
            ): IRecentlyVisitedState {
              switch (action.type) {

              Function transformEntities has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    (entities: KubernetesNode[], paginationState: PaginationEntityState) => {
                      if (!paginationState.clientPagination.filter.string) {
                        return entities;
                      }
              
              

                Function storeToLocalStorageSyncReducer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public static storeToLocalStorageSyncReducer(reducer: ActionReducer<any>): ActionReducer<any> {
                    // This is done to ensure we don't accidentally apply state from session storage from another user.
                    let globalUserId = null;
                    return localStorageSync({
                      // Decide the key to store each section by
                Severity: Minor
                Found in src/frontend/packages/store/src/helpers/local-storage-service.ts - About 1 hr to fix

                  Function paginationSuccess has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function paginationSuccess(state: PaginationEntityState, action): PaginationEntityState {
                    const { apiAction, response, result } = action;
                    let { totalResults, totalPages } = action;
                    totalResults = totalResults || (response ? response.result.length : state.totalResults);
                    totalPages = totalPages || (response ? response.totalPages : state.pageCount);

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

                      constructor(
                        public endpointsService: EndpointsService,
                        public store: Store<EndpointOnlyAppState>,
                        private ngZone: NgZone,
                        private resolver: ComponentFactoryResolver,

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

                        constructor(
                          types$: Observable<StratosCatalogEndpointEntity[]>,
                          store: Store<GeneralEntityAppState>
                        ) {
                          this.store = store;

                        Function transform has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          transform(value: string, args?: string): string {
                            if (!value) {
                              return '';
                            }
                        
                        

                          Function map has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            public map() {
                              if (!this.report.report) {
                                return;
                              }
                          
                          

                            Function EndpointRowStateSetUpManager has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function EndpointRowStateSetUpManager(
                              paginationMonitor: PaginationMonitor<EndpointModel>,
                              entityMonitorFactory: EntityMonitorFactory,
                              rowStateManager: TableRowStateManager
                            ) {

                              Function getNodeStatusCount has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                getNodeStatusCount(
                                  nodes$: Observable<KubernetesNode[]>,
                                  conditionType: string,
                                  valueLabels: object = {},
                                  countStatus = 'True'

                                Method Monocular.getChartURL has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
                                Open

                                func (m *Monocular) getChartURL(repoURL, name, version string) (string, error) {
                                    httpClient := m.portalProxy.GetHttpClient(true)
                                
                                    helmIndexURL := joinURL(repoURL, "index.yaml")
                                    resp, err := httpClient.Get(helmIndexURL)
                                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

                                Method KubernetesSpecification.Info has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
                                Open

                                func (c *KubernetesSpecification) Info(apiEndpoint string, skipSSLValidation bool) (interfaces.CNSIRecord, interface{}, error) {
                                
                                    log.Debug("Kubernetes Info")
                                    var v2InfoResponse interfaces.V2Info
                                    var newCNSI interfaces.CNSIRecord
                                Severity: Minor
                                Found in src/jetstream/plugins/kubernetes/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 fetchManifest has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
                                Open

                                func fetchManifest(repoPath string, stratosProject StratosProject, clientWebSocket *websocket.Conn) (Applications, string, error) {
                                
                                    var manifest Applications
                                
                                    // Can be either manifest.yml or manifest.yaml
                                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

                                Method Analyzer.doStatus has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
                                Open

                                func (a *Analyzer) doStatus(ec echo.Context) error {
                                    log.Debug("Status")
                                    req := ec.Request()
                                
                                    // Body contains an array of IDs that the client thinks are running
                                Severity: Minor
                                Found in src/jetstream/plugins/analysis/container/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 HelmRelease.UpdateResources has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
                                Open

                                func (r *HelmRelease) UpdateResources(jetstream interfaces.PortalProxy) {
                                    // This will be an array of resources
                                    runner := NewKubeAPIJob(jetstream, r.Jobs)
                                    res := runner.Run()
                                    for _, j := range res {
                                Severity: Minor
                                Found in src/jetstream/plugins/kubernetes/helm/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

                                Severity
                                Category
                                Status
                                Source
                                Language