SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Method CFAppPush.deploy has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func (cfAppPush *CFAppPush) deploy(echoContext echo.Context) error {

    cnsiGUID := echoContext.Param("cnsiGuid")
    orgGUID := echoContext.Param("orgGuid")
    spaceGUID := echoContext.Param("spaceGuid")
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 KubeConfigFile.GetUserForCluster has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func (k *KubeConfigFile) GetUserForCluster(clusterEndpoint string) (*KubeConfigUser, error) {

    var cluster *KubeConfigCluster
    var err error

Severity: Minor
Found in src/jetstream/plugins/kubernetes/config/kube_config.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.deleteEndpoint has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func (a *Analyzer) deleteEndpoint(ec echo.Context) error {
    log.Debug("delete reports for endpoint")

    endpoint := ec.Param("endpoint")

Severity: Minor
Found in src/jetstream/plugins/analysis/container/routes.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 Analysis.OnEndpointNotification has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func (analysis *Analysis) OnEndpointNotification(action interfaces.EndpointAction, endpoint *interfaces.CNSIRecord) {
    if action == interfaces.EndpointUnregisterAction {
        // An endpoint was unregistered, so remove all reports
        dbStore, err := store.NewAnalysisDBStore(analysis.portalProxy.GetDatabaseConnection())
        if err == nil {
Severity: Minor
Found in src/jetstream/plugins/analysis/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 ApplyMigrations has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func ApplyMigrations(conf *goose.DBConf, db *sql.DB) error {
    current, err := goose.EnsureDBVersion(conf, db)
    if err != nil {
        return fmt.Errorf("Failed to get database version: %s", err.Error())
    }
Severity: Minor
Found in src/jetstream/datastore/datastore_migrator.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 portalProxy.RefreshOidcToken has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func (p *portalProxy) RefreshOidcToken(skipSSLValidation bool, cnsiGUID, userGUID, client, clientSecret, tokenEndpoint string) (t interfaces.TokenRecord, err error) {
    log.Debug("RefreshOidcToken")
    userToken, ok := p.GetCNSITokenRecordWithDisconnected(cnsiGUID, userGUID)
    if !ok {
        return t, fmt.Errorf("Info could not be found for user with GUID %s", userGUID)
Severity: Minor
Found in src/jetstream/oidc_requests.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 TokenStore.FindCNSIToken has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func (d *TokenStore) FindCNSIToken(cnsiGUID string, userGUID string, encryptionKey []byte) (interfaces.TokenRecord, error) {

    // Main method that we need to override to get the token for the given endpoint
    local, err := ListCloudFoundry()
    if err == nil {
Severity: Minor
Found in src/jetstream/plugins/desktop/tokens.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 ConsoleConfigRepository.GetConsoleConfig has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func (c *ConsoleConfigRepository) GetConsoleConfig() (*interfaces.ConsoleConfig, error) {
    log.Debug("Get ConsoleConfig")
    rows, err := c.db.Query(getConsoleConfig)
    if err != nil {
        return nil, fmt.Errorf("Unable to retrieve console config record: %v", err)
Severity: Minor
Found in src/jetstream/repository/console_config/psql_console_config.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 MigrateSetupData has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

func MigrateSetupData(portal interfaces.PortalProxy, configStore Repository) error {

    // Determine if we need to migrate data first
    _, ok, err := configStore.GetValue(systemGroupName, configSetupNeededMarker)
    if err != nil {
Severity: Minor
Found in src/jetstream/repository/console_config/env_lookup.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 paginate has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
Open

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

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

  private update() {
    this.initials = null;
    this.gravatar = null;
    const user = this.userInfo;

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

  ngOnInit() {
    this.endpointId = this.activatedRoute.snapshot.params && this.activatedRoute.snapshot.params.endpointId ?
      this.activatedRoute.snapshot.params.endpointId : null;
    if (!this.endpointIds$ && this.endpointId) {
      this.endpointIds$ = observableOf([this.endpointId]);

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 init has 64 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func init() {
    RegisterMigration(20170818120003, "InitialSchema", func(txn *sql.Tx, conf *goose.DBConf) error {
        binaryDataType := "BYTEA"
        if strings.Contains(conf.Driver.Name, "mysql") {
            binaryDataType = "BLOB"
Severity: Minor
Found in src/jetstream/datastore/20170818120003_InitialSchema.go - About 1 hr to fix

    Function testListMissingListRequired has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function testListMissingListRequired(done: () => void) {
        const getOrgAction = new GetOrganization(orgGuid, cfGuid, [createEntityRelationKey(organizationEntityType, spaceEntityType)], true);
    
        const childSpaceToOrgRelation = new EntityTreeRelation(cfEntityFactory(spaceEntityType), true, 'spaces', 'entity.spaces', []);
        const parentOrgToSpaceRelation = new EntityTreeRelation(getOrgAction.entity[0], true, null, '', [childSpaceToOrgRelation]);

      Function createCfOrSpaceMultipleFilterFn has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const createCfOrSpaceMultipleFilterFn = (
        store: Store<CFAppState>,
        action: PaginatedAction,
        setQParam: (setQ: QParam, qs: QParam[]) => boolean,
        preResetUpdate?: () => void

        Function configureForEditServiceInstanceMode has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private configureForEditServiceInstanceMode() {
            const { endpointId, serviceInstanceId } = this.activatedRoute.snapshot.params;
            if (this.serviceType === this.serviceTypes.USER_SERVICE) {
              this.serviceInstanceId = serviceInstanceId;
              this.title$ = observableOf('Edit User Provided Service Instance');

          Function initServiceObservables has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private initServiceObservables() {
              this.serviceEntityService = cfEntityCatalog.service.store.getEntityService(this.serviceGuid, this.cfGuid, {});
              this.service$ = this.serviceEntityService.waitForEntity$.pipe(
                filter(o => !!o && !!o.entity),
                map(o => o.entity),

            Function processObject has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function processObject(object: any, output?: any, nested?: boolean) {
              if (nested && output) {
                output = { properties: output };
              } else {
                output = output || {};

              Function succeedRequest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function succeedRequest(state: BaseRequestState, action: ISuccessRequestAction) {
                if (!isNullOrUndefined(action.apiAction.guid)) {
                  const apiAction = action.apiAction as BaseEntityRequestAction;
                  const successAction = action as WrapperRequestActionSuccess;
                  const requestSuccessState = getEntityRequestState(state, apiAction);

                Function setupObservables has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private setupObservables() {
                    this.metricsEndpoints$ = this.endpointsMonitor.currentPage$.pipe(
                      map((endpoints: any) => {
                        const result: MetricsEndpointProvider[] = [];
                        const metrics = endpoints.filter(e => e.cnsi_type === 'metrics');
                  Severity
                  Category
                  Status
                  Source
                  Language