Showing 30 of 30 total issues
Function processSample
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
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 {
Function processSample
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
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
}
Function processSample
has 10 return statements (exceeds 4 allowed). Open
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
}
Function RunRange
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func RunRange(ctx context.Context, database *sqlx.DB, prom PromQuerier, queryName string, from time.Time, until time.Time, options ...Option) (int, error) {
Function Run
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func Run(ctx context.Context, tx *sqlx.Tx, prom PromQuerier, queryName string, from time.Time, options ...Option) error {
Method migrateCommand.execute
has 7 return statements (exceeds 4 allowed). Open
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 {
Function processSample
has 7 return statements (exceeds 4 allowed). Open
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 {
Function itemsForCategory
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func itemsForCategory(ctx context.Context, tx *sqlx.Tx, tenant db.Tenant, category db.Category, year int, month time.Month) ([]Item, error) {
Function runTenantMapping
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func runTenantMapping(ctx context.Context, rdb *sqlx.DB, promClient apiv1.API, begin time.Time, dryRun bool, o ...tenantmapping.Option) error {
Function runQuery
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func runQuery(ctx context.Context, tx *sqlx.Tx, prom PromQuerier, query db.Query, from time.Time, opts options) error {
Function getBySourceKeyAndTime
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func getBySourceKeyAndTime(ctx context.Context, q sqlx.QueryerContext, dest interface{}, table pgx.Identifier, keys []string, ts time.Time) error {
Method checkMissingCommand.execute
has 6 return statements (exceeds 4 allowed). Open
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)
Function Run
has 6 return statements (exceeds 4 allowed). Open
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) {
Function SelectNamedContext
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func SelectNamedContext(ctx context.Context, p sqlx.ExtContext, dest interface{}, query string, arg interface{}) error {
Function GetNamedContext
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func GetNamedContext(ctx context.Context, p NamedPreparerContext, dest interface{}, query string, arg interface{}) error {
Function processSample
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func processSample(ctx context.Context, tx *sqlx.Tx, ts time.Time, query db.Query, s *model.Sample) error {
Function upsertTenant
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func upsertTenant(ctx context.Context, tx *sqlx.Tx, dst *db.Tenant, src db.Tenant, ts time.Time) error {
Function invoiceForTenant
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func invoiceForTenant(ctx context.Context, tx *sqlx.Tx, tenant db.Tenant, year int, month time.Month) (Invoice, error) {
Function MapTenantTarget
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func MapTenantTarget(ctx context.Context, tx *sqlx.Tx, prom report.PromQuerier, at time.Time, options ...Option) error {
Function createQueries
has 5 return statements (exceeds 4 allowed). Open
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)