SUSE/stratos

View on GitHub

Showing 1,395 of 1,395 total issues

Method GeneratedEndpointPlugin.fetchUsername has 5 return statements (exceeds 4 allowed).
Open

func (gep GeneratedEndpointPlugin) fetchUsername(config pluginConfig, cnsiRecord *interfaces.CNSIRecord, tr *interfaces.TokenRecord) string {
    if len(config.UserInfoAPI) == 0 || len(config.UserInfoPath) == 0 {
        // Not configured
        return defaultTokenUsername
    }
Severity: Major
Found in src/jetstream/plugins/yamlgenerated/main.go - About 35 mins to fix

    Method PostgresCNSIRepository.UpdateMetadata has 5 return statements (exceeds 4 allowed).
    Open

    func (p *PostgresCNSIRepository) UpdateMetadata(guid string, metadata string) error {
        log.Debug("UpdateMetadata")
    
        if guid == "" {
            msg := "Unable to update Endpoint without a valid guid."
    Severity: Major
    Found in src/jetstream/repository/cnsis/pgsql_cnsis.go - About 35 mins to fix

      Function MakePluginsFromConfig has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
      Open

      func MakePluginsFromConfig() {
          log.Debug("MakePluginsFromConfig")
      
          var config []pluginConfig
      
      
      Severity: Minor
      Found in src/jetstream/plugins/yamlgenerated/main.go - About 35 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 readKubeConfigFile has 5 return statements (exceeds 4 allowed).
      Open

      func readKubeConfigFile() (*clientcmdapi.Config, error) {
      
          // Use the KUBECONFIG env var if set, otherwise use default
          kcFile := os.Getenv("KUBECONFIG")
          if len(kcFile) == 0 {
      Severity: Major
      Found in src/jetstream/plugins/desktop/kubernetes/kubeconfig.go - About 35 mins to fix

        Method uaaAuth.VerifySession has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
        Open

        func (a *uaaAuth) VerifySession(c echo.Context, sessionUser string, sessionExpireTime int64) error {
        
            tr, err := a.p.GetUAATokenRecord(sessionUser)
        
            if err != nil {
        Severity: Minor
        Found in src/jetstream/authuaa.go - About 35 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 parseConsoleConfigFromForm has 5 return statements (exceeds 4 allowed).
        Open

        func parseConsoleConfigFromForm(c echo.Context) (*interfaces.ConsoleConfig, error) {
            consoleConfig := new(interfaces.ConsoleConfig)
        
            // Local admin user configuration?
            password := c.FormValue("local_admin_password")
        Severity: Major
        Found in src/jetstream/setup_console.go - About 35 mins to fix

          Method portalProxy.DoRegisterEndpoint has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
          Open

          func (p *portalProxy) DoRegisterEndpoint(cnsiName string, apiEndpoint string, skipSSLValidation bool, clientId string, clientSecret string, ssoAllowed bool, subType string, fetchInfo interfaces.InfoFunc) (interfaces.CNSIRecord, error) {
          
              if len(cnsiName) == 0 || len(apiEndpoint) == 0 {
                  return interfaces.CNSIRecord{}, interfaces.NewHTTPShadowError(
                      http.StatusBadRequest,
          Severity: Minor
          Found in src/jetstream/cnsi.go - About 35 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

          Method portalProxy.RefreshOidcToken has 5 return statements (exceeds 4 allowed).
          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: Major
          Found in src/jetstream/oidc_requests.go - About 35 mins to fix

            Method PgsqlTokenRepository.FindAuthToken has 5 return statements (exceeds 4 allowed).
            Open

            func (p *PgsqlTokenRepository) FindAuthToken(userGUID string, encryptionKey []byte) (interfaces.TokenRecord, error) {
                log.Debug("FindAuthToken")
                if userGUID == "" {
                    msg := "Unable to find UAA Token without a valid User GUID."
                    log.Debug(msg)
            Severity: Major
            Found in src/jetstream/repository/tokens/pgsql_tokens.go - About 35 mins to fix

              Function setupAutoSelectors has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
              Open

                private setupAutoSelectors(initialCf: string, initialOrg: string) {
                  // Clear or automatically select org + space given cf
                  let cfTapped = false;
                  const orgResetSub = this.cf.select.asObservable().pipe(
                    startWith(initialCf),

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

                @Input('row')
                set row(row: APIResource<IServiceInstance>) {
                  super.row = row;
                  if (row) {
                    this.serviceInstanceEntity = row;

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

                addFile(file) {
                  // Make the folder for the file
                  const fileParts = file.webkitRelativePath.split('/');
                  let context = this.root;
                  let fullPath = '';

              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 10 (exceeds 8 allowed). Consider refactoring.
              Open

                constructor(
                  private store: Store<any>,
                  private route: ActivatedRoute,
                  router: Router,
                  kubeId: BaseKubeGuid,

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

              export function jetstreamErrorHandler(
                error: any,
                action: EntityRequestAction,
                catalogEntity: StratosBaseCatalogEntity,
                requestType: ApiRequestTypes,

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

                canGoto(index: number): boolean {
                  if (index < 0 && this.basePreviousRedirect) {
                    return true;
                  }
                  const step = this.steps[this.currentIndex];

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

                private applyRoutesFromExtensions(router: Router) {
                  const routeConfig = [...router.config];
              
                  // Find the route that has the 'about' page as a child - this is the dashboard base
                  const dashboardRoute = routeConfig.find(r => {
              Severity: Minor
              Found in src/frontend/packages/core/src/core/extension/extension-service.ts - About 35 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 constructor has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
              Open

                constructor(
                  public endpointsService: EndpointsService,
                  private store: Store<AppState>,
                  public userFavoriteManager: UserFavoriteManager,
                  private scrollDispatcher: ScrollDispatcher,
              Severity: Minor
              Found in src/frontend/packages/core/src/features/home/home/home-page.component.ts - About 35 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 arraysEqual has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
              Open

              export const arraysEqual = (a: any[], b: any[]): boolean => {
                // Both falsy
                if (!a && !b) {
                  return true;
                }
              Severity: Minor
              Found in src/frontend/packages/core/src/core/utils.service.ts - About 35 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 ngOnInit has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
              Open

                ngOnInit() {
              
                  const helmLastModifiedRegEx = /seconds:([0-9]*)/;
              
                  this.sessionData$ = this.store.select(s => s.auth).pipe(

              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 10 (exceeds 8 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');

              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