Lint: Update linter config, remove no longer required exeptions

which might be a false-negative and re-added later

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-03-28 00:15:14 +01:00
parent 1d4cbd9a66
commit f684abc29f
Signed by: luzifer
SSH Key Fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E
16 changed files with 18 additions and 17 deletions

View File

@ -9,7 +9,9 @@ run:
modules-download-mode: readonly
output:
format: tab
formats:
- format: tab
path: stdout
issues:
# This disables the included exclude-list in golangci-lint as that

View File

@ -34,7 +34,7 @@ func Register(args plugins.RegistrationArguments) (err error) {
}
args.RegisterCopyDatabaseFunc("counter", func(src, target *gorm.DB) error {
return database.CopyObjects(src, target, &counter{}) //nolint:wrapcheck // internal helper
return database.CopyObjects(src, target, &counter{})
})
formatMessage = args.FormatMessage

View File

@ -40,7 +40,7 @@ func Register(args plugins.RegistrationArguments) error {
}
args.RegisterCopyDatabaseFunc("punish", func(src, target *gorm.DB) error {
return database.CopyObjects(src, target, &punishLevel{}) //nolint:wrapcheck // internal helper
return database.CopyObjects(src, target, &punishLevel{})
})
botTwitchClient = args.GetTwitchClient()

View File

@ -94,7 +94,7 @@ func getPunishment(db database.Connector, channel, user, uuid string) (*levelCon
err := helpers.Retry(func() error {
err := db.DB().First(&p, "key = ?", getDBKey(channel, user, uuid)).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return backoff.NewErrCannotRetry(err) //nolint:wrapcheck // we get our internal error
return backoff.NewErrCannotRetry(err)
}
return err
})

View File

@ -36,7 +36,7 @@ func Register(args plugins.RegistrationArguments) (err error) {
}
args.RegisterCopyDatabaseFunc("quote", func(src, target *gorm.DB) error {
return database.CopyObjects(src, target, &quote{}) //nolint:wrapcheck // internal helper
return database.CopyObjects(src, target, &quote{})
})
formatMessage = args.FormatMessage

View File

@ -33,7 +33,7 @@ func Register(args plugins.RegistrationArguments) (err error) {
}
args.RegisterCopyDatabaseFunc("variable", func(src, target *gorm.DB) error {
return database.CopyObjects(src, target, &variable{}) //nolint:wrapcheck // internal helper
return database.CopyObjects(src, target, &variable{})
})
formatMessage = args.FormatMessage

View File

@ -22,7 +22,7 @@ func getVariable(db database.Connector, key string) (string, error) {
err := helpers.Retry(func() error {
err := db.DB().First(&v, "name = ?", key).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return backoff.NewErrCannotRetry(err) //nolint:wrapcheck // we get our internal error
return backoff.NewErrCannotRetry(err)
}
return err
})

View File

@ -37,7 +37,7 @@ func Register(args plugins.RegistrationArguments) (err error) {
}
args.RegisterCopyDatabaseFunc("custom_event", func(src, target *gorm.DB) error {
return database.CopyObjects(src, target, &storedCustomEvent{}) //nolint:wrapcheck // internal helper
return database.CopyObjects(src, target, &storedCustomEvent{})
})
mc = &memoryCache{dbc: db}

View File

@ -75,7 +75,7 @@ func getEventByID(db database.Connector, eventID uint64) (socketMessage, error)
if err := helpers.Retry(func() (err error) {
err = db.DB().Where("id = ?", eventID).First(&evt).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return backoff.NewErrCannotRetry(err) //nolint:wrapcheck // we get our internal error
return backoff.NewErrCannotRetry(err)
}
return err
}); err != nil {

View File

@ -92,7 +92,7 @@ func Register(args plugins.RegistrationArguments) (err error) {
}
args.RegisterCopyDatabaseFunc("overlay_events", func(src, target *gorm.DB) error {
return database.CopyObjects(src, target, &overlaysEvent{}) //nolint:wrapcheck // internal helper
return database.CopyObjects(src, target, &overlaysEvent{})
})
validateToken = args.ValidateToken

View File

@ -29,7 +29,7 @@ func Register(args plugins.RegistrationArguments) (err error) {
}
args.RegisterCopyDatabaseFunc("raffle", func(src, target *gorm.DB) error {
return database.CopyObjects(src, target, &raffle{}, &raffleEntry{}) //nolint:wrapcheck // internal helper
return database.CopyObjects(src, target, &raffle{}, &raffleEntry{})
})
dbc = newDBClient(db)

View File

@ -23,6 +23,6 @@ func Retry(fn func() error) error {
// database and will be retried as if executed using Retry
func RetryTransaction(db *gorm.DB, fn func(tx *gorm.DB) error) error {
return Retry(func() error {
return db.Transaction(fn) //nolint:wrapcheck
return db.Transaction(fn)
})
}

View File

@ -172,7 +172,7 @@ func (s Service) GetTwitchClientForChannel(channel string, cfg ClientConfig) (*t
if err = helpers.Retry(func() error {
err = s.db.DB().First(&perm, "channel = ?", strings.TrimLeft(channel, "#")).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return backoff.NewErrCannotRetry(ErrChannelNotAuthorized) //nolint:wrapcheck // We get our own error
return backoff.NewErrCannotRetry(ErrChannelNotAuthorized)
}
return errors.Wrap(err, "getting twitch credential from database")
}); err != nil {
@ -251,7 +251,7 @@ func (s Service) HasTokensForChannel(channel string) (bool, error) {
if err = helpers.Retry(func() error {
err = s.db.DB().First(&perm, "channel = ?", strings.TrimLeft(channel, "#")).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return backoff.NewErrCannotRetry(ErrChannelNotAuthorized) //nolint:wrapcheck // We'll get our own error
return backoff.NewErrCannotRetry(ErrChannelNotAuthorized)
}
return errors.Wrap(err, "getting twitch credential from database")
}); err != nil {

View File

@ -103,7 +103,7 @@ func (s Service) HasTimer(id string) (bool, error) {
err := helpers.Retry(func() error {
err := s.db.DB().First(&t, "id = ? AND expires_at >= ?", id, time.Now().UTC()).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return backoff.NewErrCannotRetry(err) //nolint:wrapcheck // We'll get our own error
return backoff.NewErrCannotRetry(err)
}
return err
})

View File

@ -445,7 +445,7 @@ func (e *EventSubSocketClient) retryBackgroundSubscribe(st eventSubSocketSubscri
if err := e.runCtx.Err(); err != nil {
// Our run-context was cancelled, stop retrying to subscribe
// to topics as this client was closed
return backoff.NewErrCannotRetry(err) //nolint:wrapcheck // We get our internal error
return backoff.NewErrCannotRetry(err)
}
return e.subscribe(st)

View File

@ -189,7 +189,6 @@ func getRegistrationArguments() plugins.RegistrationArguments {
},
GetTwitchClientForChannel: func(channel string) (*twitch.Client, error) {
//nolint:wrapcheck // own package, no need to wrap
return accessService.GetTwitchClientForChannel(channel, access.ClientConfig{
TwitchClient: cfg.TwitchClient,
TwitchClientSecret: cfg.TwitchClientSecret,