cloudfoundry-incubator/stratos

View on GitHub

Showing 650 of 1,370 total issues

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

    export function mapMetricsData(ep: MetricsEndpointProvider): MetricsEndpointInfo[] {
      const data: MetricsEndpointInfo[] = [];
    
      // Add all of the known endpoints first
      ep.endpoints.forEach(endpoint => {
    Severity: Minor
    Found in src/frontend/packages/core/src/features/metrics/metrics.helpers.ts - About 1 hr to fix

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

                      map(endpoints => {
                        const newTypes: SourceType[] = [];
                
                        // Add all the base types... also update git types if the user has provided credentials for it
                        this.baseTypes.forEach(t => {

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

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

                      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

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

                      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

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

                      func (p *PostgresCNSIRepository) listBy(query string, match string, encryptionKey []byte) ([]*interfaces.CNSIRecord, error) {
                          rows, err := p.db.Query(query, match)
                          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

                      Function findFreePort has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
                      Open

                      function findFreePort(beg, ...rest){
                        const p = rest.slice(0, rest.length - 1), cb = rest[rest.length - 1];
                        let [end, ip, cnt] = Array.from(p);
                        if (!ip && end && !/^\d+$/.test(end)) { // deal with method 3
                          ip = end;
                      Severity: Minor
                      Found in electron/freeport.js - 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 get has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        get(summary: any, appInstances: AppStat[]): ApplicationStateData {
                          const appState: string = summary ? summary.state : 'UNKNOWN';
                          const pkgState = this.getPackageState(appState, summary);
                          const wildcard = this.stateMetadata['?'];
                      
                      
                        Severity
                        Category
                        Status
                        Source
                        Language