fabiocicerchia/go-proxy-cache

View on GitHub

Showing 10 of 21 total issues

File metrics.go has 533 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package metrics

import (
    "fmt"
    "net/http"
Severity: Minor
Found in telemetry/metrics/metrics.go - About 2 hrs to fix

    Function IncWholeResponse has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func IncWholeResponse(reqID string, req http.Request, statusCode int, size int, duration int64, scheme string, cached bool, stale bool) {
    Severity: Major
    Found in telemetry/metrics/metrics.go - About 1 hr to fix

      Method TelemetryContext.RegisterWholeResponse has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (tc TelemetryContext) RegisterWholeResponse(reqID string, req http.Request, statusCode int, contentLength int, requestStartTime time.Time, scheme string, cached bool, stale bool) {
      Severity: Major
      Found in telemetry/telemetry.go - About 1 hr to fix

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

        func StoreMetadata(ctx context.Context, domainID string, method string, url url.URL, meta []string, expiration time.Duration) (bool, error) {
        Severity: Minor
        Found in cache/cache.go - About 45 mins to fix

          Method TelemetryContext.RegisterLegitRequest has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (tc TelemetryContext) RegisterLegitRequest(hostMatch bool, legitPort bool, hostname string, listeningPort string, confHostname string, confPort string) {
          Severity: Minor
          Found in telemetry/telemetry.go - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                } else if code < 600 {
                    request5xx.With(labels).Inc()
                }
            Severity: Major
            Found in telemetry/metrics/metrics.go - About 45 mins to fix

              Method Object.RetrieveFullPage has 6 return statements (exceeds 4 allowed).
              Open

              func (c *Object) RetrieveFullPage() error {
                  obj := &URIObj{}
              
                  meta, err := FetchMetadata(c.DomainID, c.CurrentURIObject.Method, c.CurrentURIObject.URL)
                  if err != nil {
              Severity: Major
              Found in cache/cache.go - About 40 mins to fix

                Method Object.StoreFullPage has 6 return statements (exceeds 4 allowed).
                Open

                func (c Object) StoreFullPage(ctx context.Context, expiration time.Duration) (bool, error) {
                    if !c.IsStatusAllowed() || !c.IsMethodAllowed() || expiration < 1 {
                        logger.GetGlobal().WithFields(log.Fields{
                            "ReqID": c.ReqID,
                        }).Debugf(
                Severity: Major
                Found in cache/cache.go - About 40 mins to fix

                  Method TelemetryContext.RegisterRequestCall has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (tc TelemetryContext) RegisterRequestCall(reqID string, req http.Request, reqURL url.URL, scheme string, webSocket bool) {
                  Severity: Minor
                  Found in telemetry/telemetry.go - About 35 mins to fix

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

                    func LogRequest(req http.Request, statusCode int, lenContent int, reqID string, cacheLabel int) {
                    Severity: Minor
                    Found in logger/log.go - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language