synapsecns/sanguine

View on GitHub
services/scribe/api/server.go

Summary

Maintainability
A
3 hrs
Test Coverage

Function Start has 57 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func Start(ctx context.Context, cfg Config, handler metrics.Handler) error {
    logger.Warnf("starting api server")
    router := ginhelper.New(logger)
    // wrap gin with metrics
    router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
Severity: Minor
Found in services/scribe/api/server.go - About 1 hr to fix

    Function Start has 12 return statements (exceeds 4 allowed).
    Open

    func Start(ctx context.Context, cfg Config, handler metrics.Handler) error {
        logger.Warnf("starting api server")
        router := ginhelper.New(logger)
        // wrap gin with metrics
        router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
    Severity: Major
    Found in services/scribe/api/server.go - About 1 hr to fix

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

      func InitDB(ctx context.Context, databaseType string, path string, metrics metrics.Handler, skipMigrations bool) (db.EventDB, error) {
          logger.Warnf("Starting database connection from api")
      
          switch {
          case databaseType == "sqlite":
      Severity: Major
      Found in services/scribe/api/server.go - About 40 mins to fix

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

        func InitDB(ctx context.Context, databaseType string, path string, metrics metrics.Handler, skipMigrations bool) (db.EventDB, error) {
        Severity: Minor
        Found in services/scribe/api/server.go - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status