vorteil/direktiv

View on GitHub
cmd/sidecar/api_v2_clients.go

Summary

Maintainability
B
5 hrs
Test Coverage

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

func getReferencedFile(ctx context.Context, flowToken, flowAddr, namespace string, path string) ([]byte, int, error) {
    addr := fmt.Sprintf("http://%v/api/v2/namespaces/%v/files/%v", flowAddr, namespace, path)
    var d []byte

    resp, err := doRequest(ctx, http.MethodGet, flowToken, addr, nil)
Severity: Major
Found in cmd/sidecar/api_v2_clients.go - About 55 mins to fix

    Function patchVarData has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func patchVarData(ctx context.Context, flowToken string, flowAddr string, namespace string, id string, body datastore.RuntimeVariablePatch) (int, error) {
    Severity: Minor
    Found in cmd/sidecar/api_v2_clients.go - About 45 mins to fix

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

      func getVariableMetaFromFlow(ctx context.Context, flowToken string, flowAddr string, ir *functionRequest, scope, key string) (variable, int, error) {
          var varResp *variablesResponse
          var err error
          var typ string
          statusCode := http.StatusOK
      Severity: Major
      Found in cmd/sidecar/api_v2_clients.go - About 40 mins to fix

        Function getVariableDataViaID has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func getVariableDataViaID(ctx context.Context, flowToken string, flowAddr string, namespace string, id string) (variable, error) {
        Severity: Minor
        Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

          Function getVariableMetaFromFlow has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func getVariableMetaFromFlow(ctx context.Context, flowToken string, flowAddr string, ir *functionRequest, scope, key string) (variable, int, error) {
          Severity: Minor
          Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

            Function postVarData has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func postVarData(ctx context.Context, flowToken string, flowAddr string, namespace string, body createVarRequest) (int, error) {
            Severity: Minor
            Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

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

              func getVariables(ctx context.Context, flowToken, addr string) (*variablesResponse, int, error) {
                  resp, err := doRequest(ctx, http.MethodGet, flowToken, addr, nil)
                  if err != nil {
                      return nil, resp.StatusCode, err
                  }
              Severity: Major
              Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

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

                func getVariableDataViaID(ctx context.Context, flowToken string, flowAddr string, namespace string, id string) (variable, error) {
                    addr := fmt.Sprintf("http://%v/api/v2/namespaces/%v/variables/%v", flowAddr, namespace, id)
                    client := &http.Client{}
                    req, err := http.NewRequestWithContext(ctx, http.MethodGet, addr, nil)
                    if err != nil {
                Severity: Major
                Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

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

                  func handleResponse(resp *http.Response, next func(resp *http.Response) (int, error)) (int, error) {
                      defer resp.Body.Close()
                  
                      if resp.StatusCode != http.StatusOK {
                          var apiErrorResp apiError
                  Severity: Major
                  Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status