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)
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)
- Read upRead up
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)
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
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
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
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
}
- Read upRead up
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
- Read upRead up
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"