mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 11:51:17 +00:00
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:
parent
1d4cbd9a66
commit
f684abc29f
16 changed files with 18 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
|
|
@ -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, "e{}) //nolint:wrapcheck // internal helper
|
||||
return database.CopyObjects(src, target, "e{})
|
||||
})
|
||||
|
||||
formatMessage = args.FormatMessage
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue