SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Avoid deeply nested control flow statements.
Open

        if (itemFormat) {
          arrayItem.format = itemFormat;
        }

    Function editModeChanged has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
    Open

      editModeChanged(mode) {
        this.mode = mode.value;
    
        if (this.mode === EditorMode.CodeEditor) {
          // Form -> Editor

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

      constructor(
        public activatedRoute: ActivatedRoute,
        public kubeEndpointService: KubernetesEndpointService
      ) {
        this.podName = activatedRoute.snapshot.params.podName;

    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

    Avoid deeply nested control flow statements.
    Open

                    if (!resources[entityType]) {
                      resources[entityType] = [];
                    }

      Function dashboardReducer has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
      Open

      export function dashboardReducer(state: DashboardState = defaultDashboardState, action): DashboardState {
        switch (action.type) {
          case OPEN_SIDE_NAV:
            if (state.isMobile) {
              return { ...state, isMobileNavOpen: true };
      Severity: Minor
      Found in src/frontend/packages/store/src/reducers/dashboard-reducer.ts - About 45 mins 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 getObservables has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        store: Store<GeneralEntityAppState>,
        entityKey: string,
        paginationKey: string,
        paginationAction: PaginatedAction | PaginatedAction[],
        paginationMonitor: PaginationMonitor,

        Function successEntityHandler has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
        Open

        export function successEntityHandler(
          actionDispatcher: (actionToDispatch: Action) => void,
          catalogEntity: StratosBaseCatalogEntity,
          requestType: ApiRequestTypes,
          action: EntityRequestAction,

        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 succeedRequest has a Cognitive Complexity of 11 (exceeds 8 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);

        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 successEntityHandler has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          actionDispatcher: (actionToDispatch: Action) => void,
          catalogEntity: StratosBaseCatalogEntity,
          requestType: ApiRequestTypes,
          action: EntityRequestAction,
          result: PipelineResult,

          Function failedEntityHandler has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            actionDispatcher: ActionDispatcher,
            catalogEntity: StratosBaseCatalogEntity,
            requestType: ApiRequestTypes,
            action: EntityRequestAction,
            response: PipelineResult,

            Function constructor has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
            Open

              constructor(private store: Store<AppState>, private activatedRoute: ActivatedRoute) {
                // Determine the starting state of the filter by repo section
                stratosEntityCatalog.endpoint.store.getAll.getPaginationService().entities$.pipe(
                  filter(entities => !!entities),
                  first()

            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 jetstreamErrorHandler has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              error: any,
              action: EntityRequestAction,
              catalogEntity: StratosBaseCatalogEntity,
              requestType: ApiRequestTypes,
              actionDispatcher: ActionDispatcher,

              Function failApiRequest has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                store: Store<T>,
                apiAction: EntityRequestAction,
                error,
                catalogEntity: StratosBaseCatalogEntity,
                requestType: ApiRequestTypes = 'fetch',

                Function deleteEntity has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                Open

                function deleteEntity(state, entityKey, guid) {
                  const newState = {} as Record<string, any>;
                  for (const entityTypeKey in state) {
                    if (entityTypeKey === entityKey) {
                      newState[entityTypeKey] = {};

                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

                Avoid deeply nested control flow statements.
                Open

                              if (this.allSteps[index].onEnter) {
                                this.allSteps[index].onEnter(this.enterData);
                              }

                  Function setErrorMessage has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                  Open

                    private setErrorMessage(auth: AuthState) {
                      // Default error message
                      this.message = `Couldn't log in, please try again.`;
                      if (auth.error && auth.errorResponse) {
                        if (auth.errorResponse === 'Invalid session') {

                  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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func (br *BackupRestore) backupEndpoints(c echo.Context) error {
                      log.Debug("backupEndpoints")
                  
                      userID, err := br.portalProxy.GetSessionStringValue(c, "user_id")
                      if err != nil {
                  Severity: Minor
                  Found in src/jetstream/plugins/backup/main.go and 1 other location - About 45 mins to fix
                  src/jetstream/plugins/backup/main.go on lines 90..112

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 214.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  func (br *BackupRestore) restoreEndpoints(c echo.Context) error {
                      log.Debug("restoreEndpoints")
                  
                      userID, err := br.portalProxy.GetSessionStringValue(c, "user_id")
                      if err != nil {
                  Severity: Minor
                  Found in src/jetstream/plugins/backup/main.go and 1 other location - About 45 mins to fix
                  src/jetstream/plugins/backup/main.go on lines 66..88

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 214.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Method UserInfo.updateUserPassword has 6 return statements (exceeds 4 allowed).
                  Open

                  func (userInfo *UserInfo) updateUserPassword(c echo.Context) error {
                      id, err := userInfo.preFlightChecks(c)
                      if err != nil {
                          return err
                      }
                  Severity: Major
                  Found in src/jetstream/plugins/userinfo/main.go - About 40 mins to fix

                    Method UserInfo.updateUserInfo has 6 return statements (exceeds 4 allowed).
                    Open

                    func (userInfo *UserInfo) updateUserInfo(c echo.Context) error {
                        _, err := userInfo.preFlightChecks(c)
                        if err != nil {
                            return err
                        }
                    Severity: Major
                    Found in src/jetstream/plugins/userinfo/main.go - About 40 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language