portainer/portainer

View on GitHub
api/http/handler/hostmanagement/openamt/amtrpc.go

Summary

Maintainability
B
4 hrs
Test Coverage

Function runContainer has 103 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func runContainer(ctx context.Context, docker *client.Client, imageName, containerName string, cmdLine []string) (output string, err error) {
    opts := container.ListOptions{All: true}
    opts.Filters = filters.NewArgs()
    opts.Filters.Add("name", containerName)
    existingContainers, err := docker.ContainerList(ctx, opts)
Severity: Major
Found in api/http/handler/hostmanagement/openamt/amtrpc.go - About 3 hrs to fix

    Function runContainer has 9 return statements (exceeds 4 allowed).
    Open

    func runContainer(ctx context.Context, docker *client.Client, imageName, containerName string, cmdLine []string) (output string, err error) {
        opts := container.ListOptions{All: true}
        opts.Filters = filters.NewArgs()
        opts.Filters.Add("name", containerName)
        existingContainers, err := docker.ContainerList(ctx, opts)
    Severity: Major
    Found in api/http/handler/hostmanagement/openamt/amtrpc.go - About 55 mins to fix

      Method Handler.openAMTHostInfo has 5 return statements (exceeds 4 allowed).
      Open

      func (handler *Handler) openAMTHostInfo(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
          endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
          if err != nil {
              return httperror.BadRequest("Invalid environment identifier route variable", err)
          }
      Severity: Major
      Found in api/http/handler/hostmanagement/openamt/amtrpc.go - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status