SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

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

      ngOnInit() {
        this.subscriptions.push(this.addTCPRoute.valueChanges.subscribe(val => {
          const useRandomPort = val.useRandomPort;
          if (useRandomPort !== this.useRandomPort) {
            this.useRandomPort = useRandomPort;

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

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

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

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

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

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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language