synapsecns/sanguine

View on GitHub
contrib/screener-api/screener/screener.go

Summary

Maintainability
B
4 hrs
Test Coverage

Method screenerImpl.blacklistAddress has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (s *screenerImpl) blacklistAddress(c *gin.Context) {
    var err error
    ctx, span := s.metrics.Tracer().Start(c.Request.Context(), "blacklistAddress")
    defer metrics.EndSpanWithErr(span, err)

Severity: Minor
Found in contrib/screener-api/screener/screener.go - About 1 hr to fix

    Method screenerImpl.authMiddleware has 56 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (s *screenerImpl) authMiddleware(cfg config.Config) gin.HandlerFunc {
        return func(c *gin.Context) {
            _, span := s.metrics.Tracer().Start(c.Request.Context(), "authMiddleware")
            defer span.End()
    
    
    Severity: Minor
    Found in contrib/screener-api/screener/screener.go - About 1 hr to fix

      Method screenerImpl.blacklistAddress has 8 return statements (exceeds 4 allowed).
      Open

      func (s *screenerImpl) blacklistAddress(c *gin.Context) {
          var err error
          ctx, span := s.metrics.Tracer().Start(c.Request.Context(), "blacklistAddress")
          defer metrics.EndSpanWithErr(span, err)
      
      
      Severity: Major
      Found in contrib/screener-api/screener/screener.go - About 50 mins to fix

        Method screenerImpl.screenAddress has 8 return statements (exceeds 4 allowed).
        Open

        func (s *screenerImpl) screenAddress(c *gin.Context) {
            address := strings.ToLower(c.Param("address"))
            if address == "" {
                logger.Errorf("address is required")
                c.JSON(http.StatusBadRequest, gin.H{"error": "address is required"})
        Severity: Major
        Found in contrib/screener-api/screener/screener.go - About 50 mins to fix

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

          func NewScreener(ctx context.Context, cfg config.Config, metricHandler metrics.Handler) (_ Screener, err error) {
              screener := screenerImpl{
                  metrics:    metricHandler,
                  cfg:        cfg,
                  requestMux: mapmutex.NewStringMapMutex(),
          Severity: Major
          Found in contrib/screener-api/screener/screener.go - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status