Skip to content

Commit

Permalink
Fix code smell issues
Browse files Browse the repository at this point in the history
1. Remove unused empty function WorkloadHandler#List
2. Reduce Cognitive Complexity of ProviderHandler#ListContent

Signed-off-by: Arik Hadas <[email protected]>
  • Loading branch information
ahadas committed Jul 23, 2023
1 parent 88c167f commit 3f2bcd5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
6 changes: 0 additions & 6 deletions pkg/controller/provider/web/ova/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,11 @@ type WorkloadHandler struct {
}

// Add routes to the `gin` router.
// no-op
func (h *WorkloadHandler) AddRoutes(e *gin.Engine) {
e.GET(WorkloadRoot, h.Get)
}

// List resources in a REST collection.
func (h WorkloadHandler) List(ctx *gin.Context) {
}

// Get a specific REST resource.
// no-op
func (h WorkloadHandler) Get(ctx *gin.Context) {
status, err := h.Prepare(ctx)
if status != http.StatusOK {
Expand Down
5 changes: 1 addition & 4 deletions pkg/controller/provider/web/ovirt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ func (h *ProviderHandler) ListContent(ctx *gin.Context) (content []interface{},
ns := q.Get(base.NsParam)
for _, collector := range list {
if p, cast := collector.Owner().(*api.Provider); cast {
if p.Type() != api.OVirt {
continue
}
if ns != "" && ns != p.Namespace {
if p.Type() != api.OVirt || (ns != "" && ns != p.Namespace) {
continue
}
if collector, found := h.Container.Get(p); found {
Expand Down

0 comments on commit 3f2bcd5

Please sign in to comment.