horizoncd/horizon

View on GitHub
core/http/api/v2/member/apis.go

Summary

Maintainability
D
1 day
Test Coverage

Showing 8 of 8 total issues

Method API.UpdateMember has 5 return statements (exceeds 4 allowed).
Open

func (a *API) UpdateMember(c *gin.Context) {
memberIDStr := c.Param(_paramMemberID)
uintID, err := strconv.ParseUint(memberIDStr, 10, 0)
if err != nil {
response.AbortWithRequestError(c, common.InvalidRequestParam,
Severity: Major
Found in core/http/api/v2/member/apis.go - About 35 mins to fix

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

    func (a *API) CreateApplicationClusterMember(c *gin.Context) {
    resourceIDStr := c.Param(_paramApplicationClusterID)
    uintID, err := strconv.ParseUint(resourceIDStr, 10, 0)
    if err != nil {
    response.AbortWithRequestError(c, common.InvalidRequestParam,
    Severity: Major
    Found in core/http/api/v2/member/apis.go and 2 other locations - About 3 hrs to fix
    core/http/api/v2/member/apis.go on lines 58..90
    core/http/api/v2/member/apis.go on lines 92..124

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

    func (a *API) CreateApplicationMember(c *gin.Context) {
    resourceIDStr := c.Param(_paramApplicationID)
    uintID, err := strconv.ParseUint(resourceIDStr, 10, 0)
    if err != nil {
    response.AbortWithRequestError(c, common.InvalidRequestParam,
    Severity: Major
    Found in core/http/api/v2/member/apis.go and 2 other locations - About 3 hrs to fix
    core/http/api/v2/member/apis.go on lines 58..90
    core/http/api/v2/member/apis.go on lines 126..158

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

    func (a *API) CreateGroupMember(c *gin.Context) {
    resourceIDStr := c.Param(_paramGroupID)
    uintID, err := strconv.ParseUint(resourceIDStr, 10, 0)
    if err != nil {
    response.AbortWithRequestError(c, common.InvalidRequestParam,
    Severity: Major
    Found in core/http/api/v2/member/apis.go and 2 other locations - About 3 hrs to fix
    core/http/api/v2/member/apis.go on lines 92..124
    core/http/api/v2/member/apis.go on lines 126..158

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

    func (a *API) ListGroupMember(c *gin.Context) {
    resourceIDStr := c.Param(_paramGroupID)
     
    resourceID, err := strconv.ParseUint(resourceIDStr, 10, 0)
    if err != nil {
    Severity: Major
    Found in core/http/api/v2/member/apis.go and 3 other locations - About 45 mins to fix
    core/http/api/v2/member/apis.go on lines 261..271
    core/http/api/v2/member/apis.go on lines 273..283
    core/http/api/v2/member/apis.go on lines 285..295

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

    func (a *API) ListApplicationClusterMember(c *gin.Context) {
    resourceIDStr := c.Param(_paramApplicationClusterID)
     
    resourceID, err := strconv.ParseUint(resourceIDStr, 10, 0)
    if err != nil {
    Severity: Major
    Found in core/http/api/v2/member/apis.go and 3 other locations - About 45 mins to fix
    core/http/api/v2/member/apis.go on lines 249..259
    core/http/api/v2/member/apis.go on lines 261..271
    core/http/api/v2/member/apis.go on lines 285..295

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

    func (a *API) ListApplicationMember(c *gin.Context) {
    resourceIDStr := c.Param(_paramApplicationID)
     
    resourceID, err := strconv.ParseUint(resourceIDStr, 10, 0)
    if err != nil {
    Severity: Major
    Found in core/http/api/v2/member/apis.go and 3 other locations - About 45 mins to fix
    core/http/api/v2/member/apis.go on lines 249..259
    core/http/api/v2/member/apis.go on lines 273..283
    core/http/api/v2/member/apis.go on lines 285..295

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

    func (a *API) ListTemplateMember(c *gin.Context) {
    resourceIDStr := c.Param(_paramTemplateID)
     
    resourceID, err := strconv.ParseUint(resourceIDStr, 10, 0)
    if err != nil {
    Severity: Major
    Found in core/http/api/v2/member/apis.go and 3 other locations - About 45 mins to fix
    core/http/api/v2/member/apis.go on lines 249..259
    core/http/api/v2/member/apis.go on lines 261..271
    core/http/api/v2/member/apis.go on lines 273..283

    There are no issues that match your filters.

    Category
    Status