cloudfoundry-incubator/stratos

View on GitHub
src/jetstream/plugins/userinvite/invite.go

Summary

Maintainability
A
0 mins
Test Coverage

Method UserInvite.UAAUserInvite has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Wontfix

func (invite *UserInvite) UAAUserInvite(c echo.Context, endpoint interfaces.CNSIRecord, uaaInviteReq *UserInviteReq) (*UserInviteResponse, error) {
    log.Debug("Requesting invite links from UAA")

    // See if we can get a token for the invite user
    token, ok := invite.portalProxy.GetCNSITokenRecord(endpoint.GUID, UserInviteUserID)
Severity: Minor
Found in src/jetstream/plugins/userinvite/invite.go - About 1 hr to fix

    Method UserInvite.UAAUserInvite has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
    Wontfix

    func (invite *UserInvite) UAAUserInvite(c echo.Context, endpoint interfaces.CNSIRecord, uaaInviteReq *UserInviteReq) (*UserInviteResponse, error) {
        log.Debug("Requesting invite links from UAA")
    
        // See if we can get a token for the invite user
        token, ok := invite.portalProxy.GetCNSITokenRecord(endpoint.GUID, UserInviteUserID)
    Severity: Minor
    Found in src/jetstream/plugins/userinvite/invite.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 UserInvite.UAAUserInvite has 10 return statements (exceeds 4 allowed).
    Wontfix

    func (invite *UserInvite) UAAUserInvite(c echo.Context, endpoint interfaces.CNSIRecord, uaaInviteReq *UserInviteReq) (*UserInviteResponse, error) {
        log.Debug("Requesting invite links from UAA")
    
        // See if we can get a token for the invite user
        token, ok := invite.portalProxy.GetCNSITokenRecord(endpoint.GUID, UserInviteUserID)
    Severity: Major
    Found in src/jetstream/plugins/userinvite/invite.go - About 1 hr to fix

      Method UserInvite.invite has 10 return statements (exceeds 4 allowed).
      Wontfix

      func (invite *UserInvite) invite(c echo.Context) error {
          log.Debug("Invite User")
          cfGUID := c.Param("id")
      
          // Check that there is an endpoint with the specified ID and that it is a Cloud Foundry endpoint
      Severity: Major
      Found in src/jetstream/plugins/userinvite/invite.go - About 1 hr to fix

        Method UserInvite.checkPermissions has 7 return statements (exceeds 4 allowed).
        Wontfix

        func (invite *UserInvite) checkPermissions(c echo.Context, endpoint interfaces.CNSIRecord, userInviteRequest *UserInviteReq) error {
            cfGUID := c.Param("id")
            userGUID := c.Get("user_id").(string)
        
            // Get the User information for the endpoint connection
        Severity: Major
        Found in src/jetstream/plugins/userinvite/invite.go - About 45 mins to fix

          Method UserInvite.processUserInvite has 5 return statements (exceeds 4 allowed).
          Wontfix

          func (invite *UserInvite) processUserInvite(cfGUID, userGUID string, userInviteRequest *UserInviteReq, user UserInviteUser, endpoint interfaces.CNSIRecord) (UserInviteUser, bool) {
              log.Debugf("Creating CF User for: %s", user.Email)
              // Create the user in Cloud Foundry
              if cfError, err := invite.CreateCloudFoundryUser(cfGUID, userGUID, user.UserID); err != nil {
                  return updateUserInviteRecordForError(user, "Failed to create user in Cloud Foundry", cfError), true
          Severity: Major
          Found in src/jetstream/plugins/userinvite/invite.go - About 35 mins to fix

            Method UserInvite.AssociateSpaceRoles has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
            Wontfix

            func (invite *UserInvite) AssociateSpaceRoles(cnsiGUID, userID, newUserGUID string, inviteRequest *UserInviteReq) (*CFError, error) {
                if inviteRequest.SpaceRoles.Auditor {
                    if cfError, err := invite.AssociateSpaceRoleForUser(cnsiGUID, userID, newUserGUID, inviteRequest.Space, "auditors"); err != nil {
                        return cfError, err
                    }
            Severity: Minor
            Found in src/jetstream/plugins/userinvite/invite.go - About 25 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 UserInvite.invite has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
            Wontfix

            func (invite *UserInvite) invite(c echo.Context) error {
                log.Debug("Invite User")
                cfGUID := c.Param("id")
            
                // Check that there is an endpoint with the specified ID and that it is a Cloud Foundry endpoint
            Severity: Minor
            Found in src/jetstream/plugins/userinvite/invite.go - About 25 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

            There are no issues that match your filters.

            Category
            Status