appuio/appuio-cloud-reporting

View on GitHub

Showing 30 of 30 total issues

Function processSample has 54 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func processSample(ctx context.Context, tx *sqlx.Tx, ts time.Time, s *model.Sample) error {
    log := logr.FromContextOrDiscard(ctx).WithValues("at", ts)

    organization, err := getMetricLabel(s.Metric, "organization")
    if err != nil {
Severity: Minor
Found in pkg/tenantmapping/mapping.go - About 1 hr to fix

    Function processSample has 51 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func processSample(ctx context.Context, tx *sqlx.Tx, ts time.Time, query db.Query, s *model.Sample) error {
        category, err := getMetricLabel(s.Metric, "category")
        if err != nil {
            return err
        }
    Severity: Minor
    Found in pkg/report/report.go - About 1 hr to fix

      Function processSample has 10 return statements (exceeds 4 allowed).
      Open

      func processSample(ctx context.Context, tx *sqlx.Tx, ts time.Time, query db.Query, s *model.Sample) error {
          category, err := getMetricLabel(s.Metric, "category")
          if err != nil {
              return err
          }
      Severity: Major
      Found in pkg/report/report.go - About 1 hr to fix

        Function RunRange has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func RunRange(ctx context.Context, database *sqlx.DB, prom PromQuerier, queryName string, from time.Time, until time.Time, options ...Option) (int, error) {
        Severity: Major
        Found in pkg/report/report.go - About 50 mins to fix

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

          func Run(ctx context.Context, tx *sqlx.Tx, prom PromQuerier, queryName string, from time.Time, options ...Option) error {
          Severity: Minor
          Found in pkg/report/report.go - About 45 mins to fix

            Method migrateCommand.execute has 7 return statements (exceeds 4 allowed).
            Open

            func (cmd *migrateCommand) execute(context *cli.Context) error {
                log := AppLogger(context.Context).WithName(migrateCommandName)
                log.V(1).Info("Opening database connection", "url", cmd.DatabaseURL)
                rdb, err := db.Open(cmd.DatabaseURL)
                if err != nil {
            Severity: Major
            Found in migrate_command.go - About 45 mins to fix

              Function processSample has 7 return statements (exceeds 4 allowed).
              Open

              func processSample(ctx context.Context, tx *sqlx.Tx, ts time.Time, s *model.Sample) error {
                  log := logr.FromContextOrDiscard(ctx).WithValues("at", ts)
              
                  organization, err := getMetricLabel(s.Metric, "organization")
                  if err != nil {
              Severity: Major
              Found in pkg/tenantmapping/mapping.go - About 45 mins to fix

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

                func itemsForCategory(ctx context.Context, tx *sqlx.Tx, tenant db.Tenant, category db.Category, year int, month time.Month) ([]Item, error) {
                Severity: Minor
                Found in pkg/invoice/invoice.go - About 45 mins to fix

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

                  func runTenantMapping(ctx context.Context, rdb *sqlx.DB, promClient apiv1.API, begin time.Time, dryRun bool, o ...tenantmapping.Option) error {
                  Severity: Minor
                  Found in tenantmapping_command.go - About 45 mins to fix

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

                    func runQuery(ctx context.Context, tx *sqlx.Tx, prom PromQuerier, query db.Query, from time.Time, opts options) error {
                    Severity: Minor
                    Found in pkg/report/report.go - About 45 mins to fix

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

                      func getBySourceKeyAndTime(ctx context.Context, q sqlx.QueryerContext, dest interface{}, table pgx.Identifier, keys []string, ts time.Time) error {
                      Severity: Minor
                      Found in pkg/report/report.go - About 45 mins to fix

                        Method checkMissingCommand.execute has 6 return statements (exceeds 4 allowed).
                        Open

                        func (cmd *checkMissingCommand) execute(cliCtx *cli.Context) error {
                            ctx := cliCtx.Context
                            log := AppLogger(ctx).WithName(migrateCommandName)
                        
                            log.V(1).Info("Opening database connection", "url", cmd.DatabaseURL)
                        Severity: Major
                        Found in check_command.go - About 40 mins to fix

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

                          func Run(ctx context.Context, tx *sqlx.Tx, prom PromQuerier, queryName string, from time.Time, options ...Option) error {
                              opts := buildOptions(options)
                          
                              from = from.In(time.UTC)
                              if !from.Truncate(time.Hour).Equal(from) {
                          Severity: Major
                          Found in pkg/report/report.go - About 40 mins to fix

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

                            func SelectNamedContext(ctx context.Context, p sqlx.ExtContext, dest interface{}, query string, arg interface{}) error {
                            Severity: Minor
                            Found in pkg/db/util.go - About 35 mins to fix

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

                              func GetNamedContext(ctx context.Context, p NamedPreparerContext, dest interface{}, query string, arg interface{}) error {
                              Severity: Minor
                              Found in pkg/db/util.go - About 35 mins to fix

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

                                func processSample(ctx context.Context, tx *sqlx.Tx, ts time.Time, query db.Query, s *model.Sample) error {
                                Severity: Minor
                                Found in pkg/report/report.go - About 35 mins to fix

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

                                  func upsertTenant(ctx context.Context, tx *sqlx.Tx, dst *db.Tenant, src db.Tenant, ts time.Time) error {
                                  Severity: Minor
                                  Found in pkg/report/report.go - About 35 mins to fix

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

                                    func invoiceForTenant(ctx context.Context, tx *sqlx.Tx, tenant db.Tenant, year int, month time.Month) (Invoice, error) {
                                    Severity: Minor
                                    Found in pkg/invoice/invoice.go - About 35 mins to fix

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

                                      func MapTenantTarget(ctx context.Context, tx *sqlx.Tx, prom report.PromQuerier, at time.Time, options ...Option) error {
                                      Severity: Minor
                                      Found in pkg/tenantmapping/mapping.go - About 35 mins to fix

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

                                        func createQueries(tx *sqlx.Tx, queries []Query) error {
                                            for _, q := range queries {
                                                exists, err := queryExistsByName(tx, q.Name)
                                                if err != nil {
                                                    return fmt.Errorf("error checking if query exists: %w", err)
                                        Severity: Major
                                        Found in pkg/db/seeds.go - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language