portainer/portainer

View on GitHub
api/http/handler/endpoints/endpoint_dockerhub_status.go

Summary

Maintainability
A
2 hrs
Test Coverage

Method Handler.endpointDockerhubStatus has 11 return statements (exceeds 4 allowed).
Open

func (handler *Handler) endpointDockerhubStatus(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/endpoints/endpoint_dockerhub_status.go - About 1 hr to fix

    Function getDockerHubLimits has 6 return statements (exceeds 4 allowed).
    Open

    func getDockerHubLimits(httpClient *client.HTTPClient, token string) (*dockerhubStatusResponse, error) {
        requestURL := "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest"
    
        req, err := http.NewRequest(http.MethodHead, requestURL, nil)
        if err != nil {
    Severity: Major
    Found in api/http/handler/endpoints/endpoint_dockerhub_status.go - About 40 mins to fix

      Function getDockerHubToken has 5 return statements (exceeds 4 allowed).
      Open

      func getDockerHubToken(httpClient *client.HTTPClient, registry *portainer.Registry) (string, error) {
          type dockerhubTokenResponse struct {
              Token string `json:"token"`
          }
      
      
      Severity: Major
      Found in api/http/handler/endpoints/endpoint_dockerhub_status.go - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status