mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-22 01:44:24 +01:00
Remove most path-based golangci exclusions (#24214)
They are non-obvious and do not survive refactor. Will replace with `//nolint` comments after CI results are in.
This commit is contained in:
parent
594efb9b66
commit
938b591994
|
@ -111,67 +111,16 @@ issues:
|
|||
- linters:
|
||||
- gocritic
|
||||
text: "`ID' should not be capitalized"
|
||||
- path: modules/templates/helper.go
|
||||
linters:
|
||||
- gocritic
|
||||
- linters:
|
||||
- unused
|
||||
- deadcode
|
||||
text: "swagger"
|
||||
- path: contrib/pr/checkout.go
|
||||
linters:
|
||||
- errcheck
|
||||
- path: models/issue.go
|
||||
linters:
|
||||
- errcheck
|
||||
- path: models/migrations/
|
||||
linters:
|
||||
- errcheck
|
||||
- path: modules/log/
|
||||
linters:
|
||||
- errcheck
|
||||
- path: routers/api/v1/repo/issue_subscription.go
|
||||
linters:
|
||||
- dupl
|
||||
- path: routers/repo/view.go
|
||||
linters:
|
||||
- dupl
|
||||
- path: models/migrations/
|
||||
linters:
|
||||
- unused
|
||||
- linters:
|
||||
- staticcheck
|
||||
text: "argument x is overwritten before first use"
|
||||
- path: modules/httplib/httplib.go
|
||||
linters:
|
||||
- staticcheck
|
||||
# Enabling this would require refactoring the methods and how they are called.
|
||||
- path: models/issue_comment_list.go
|
||||
linters:
|
||||
- dupl
|
||||
- path: models/update.go
|
||||
linters:
|
||||
- unused
|
||||
- path: cmd/dump.go
|
||||
linters:
|
||||
- dupl
|
||||
- path: services/webhook/webhook.go
|
||||
linters:
|
||||
- structcheck
|
||||
- text: "commentFormatting: put a space between `//` and comment text"
|
||||
linters:
|
||||
- gocritic
|
||||
- text: "exitAfterDefer:"
|
||||
linters:
|
||||
- gocritic
|
||||
- path: modules/graceful/manager_windows.go
|
||||
linters:
|
||||
- staticcheck
|
||||
text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
|
||||
- path: models/user/openid.go
|
||||
linters:
|
||||
- golint
|
||||
- path: models/user/badge.go
|
||||
linters:
|
||||
- revive
|
||||
text: "exported: type name will be used as user.UserBadge by other packages, and that stutters; consider calling this Badge"
|
||||
|
|
|
@ -22,10 +22,10 @@ func FixLanguageStatsToSaveSize(x *xorm.Engine) error {
|
|||
type RepoIndexerType int
|
||||
|
||||
const (
|
||||
// RepoIndexerTypeCode code indexer
|
||||
RepoIndexerTypeCode RepoIndexerType = iota // 0
|
||||
// RepoIndexerTypeStats repository stats indexer
|
||||
RepoIndexerTypeStats // 1
|
||||
// RepoIndexerTypeCode code indexer - 0
|
||||
RepoIndexerTypeCode RepoIndexerType = iota //nolint:unused
|
||||
// RepoIndexerTypeStats repository stats indexer - 1
|
||||
RepoIndexerTypeStats
|
||||
)
|
||||
|
||||
// RepoIndexerStatus see models/repo_indexer.go
|
||||
|
|
|
@ -8,13 +8,13 @@ import (
|
|||
)
|
||||
|
||||
func FixRepoTopics(x *xorm.Engine) error {
|
||||
type Topic struct {
|
||||
type Topic struct { //nolint:unused
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
Name string `xorm:"UNIQUE VARCHAR(25)"`
|
||||
RepoCount int
|
||||
}
|
||||
|
||||
type RepoTopic struct {
|
||||
type RepoTopic struct { //nolint:unused
|
||||
RepoID int64 `xorm:"pk"`
|
||||
TopicID int64 `xorm:"pk"`
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ func ConvertHookTaskTypeToVarcharAndTrim(x *xorm.Engine) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type HookTask struct {
|
||||
type HookTask struct { //nolint:unused
|
||||
Typ string `xorm:"VARCHAR(16) index"`
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ func ConvertHookTaskTypeToVarcharAndTrim(x *xorm.Engine) error {
|
|||
return err
|
||||
}
|
||||
|
||||
type Webhook struct {
|
||||
type Webhook struct { //nolint:unused
|
||||
Type string `xorm:"VARCHAR(16) index"`
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ type Badge struct {
|
|||
}
|
||||
|
||||
// UserBadge represents a user badge
|
||||
type UserBadge struct {
|
||||
type UserBadge struct { //nolint:revive
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
BadgeID int64
|
||||
UserID int64 `xorm:"INDEX"`
|
||||
|
|
|
@ -96,7 +96,7 @@ func (g *Manager) start() {
|
|||
run := svc.Run
|
||||
|
||||
//lint:ignore SA1019 We use IsAnInteractiveSession because IsWindowsService has a different permissions profile
|
||||
isAnInteractiveSession, err := svc.IsAnInteractiveSession()
|
||||
isAnInteractiveSession, err := svc.IsAnInteractiveSession() //nolint:staticcheck
|
||||
if err != nil {
|
||||
log.Error("Unable to ascertain if running as an Windows Service: %v", err)
|
||||
return
|
||||
|
|
|
@ -82,7 +82,7 @@ func (l *ChannelledLog) Start() {
|
|||
l.closeLogger()
|
||||
return
|
||||
}
|
||||
l.loggerProvider.LogEvent(event)
|
||||
l.loggerProvider.LogEvent(event) //nolint:errcheck
|
||||
case _, ok := <-l.flush:
|
||||
if !ok {
|
||||
l.closeLogger()
|
||||
|
@ -119,7 +119,7 @@ func (l *ChannelledLog) emptyQueue() bool {
|
|||
if !ok {
|
||||
return false
|
||||
}
|
||||
l.loggerProvider.LogEvent(event)
|
||||
l.loggerProvider.LogEvent(event) //nolint:errcheck
|
||||
default:
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ func (log *FileLogger) DoRotate() error {
|
|||
}
|
||||
|
||||
if log.Compress {
|
||||
go compressOldLogFile(fname, log.CompressionLevel)
|
||||
go compressOldLogFile(fname, log.CompressionLevel) //nolint:errcheck
|
||||
}
|
||||
|
||||
// re-start logger
|
||||
|
@ -216,7 +216,7 @@ func compressOldLogFile(fname string, compressionLevel int) error {
|
|||
if err != nil {
|
||||
zw.Close()
|
||||
fw.Close()
|
||||
util.Remove(fname + ".gz")
|
||||
util.Remove(fname + ".gz") //nolint:errcheck
|
||||
return err
|
||||
}
|
||||
reader.Close()
|
||||
|
|
|
@ -245,7 +245,7 @@ func Close() {
|
|||
func Log(skip int, level Level, format string, v ...interface{}) {
|
||||
l, ok := NamedLoggers.Load(DEFAULT)
|
||||
if ok {
|
||||
l.Log(skip+1, level, format, v...)
|
||||
l.Log(skip+1, level, format, v...) //nolint:errcheck
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ func (l *LoggerAsWriter) Write(p []byte) (int, error) {
|
|||
for _, logger := range l.ourLoggers {
|
||||
// Skip = 3 because this presumes that we have been called by log.Println()
|
||||
// If the caller has used log.Output or the like this will be wrong
|
||||
logger.Log(3, l.level, string(p))
|
||||
logger.Log(3, l.level, string(p)) //nolint:errcheck
|
||||
}
|
||||
return len(p), nil
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ type LevelLoggerLogger struct {
|
|||
|
||||
// Trace records trace log
|
||||
func (l *LevelLoggerLogger) Trace(format string, v ...interface{}) {
|
||||
l.Log(1, TRACE, format, v...)
|
||||
l.Log(1, TRACE, format, v...) //nolint:errcheck
|
||||
}
|
||||
|
||||
// IsTrace returns true if the logger is TRACE
|
||||
|
@ -63,7 +63,7 @@ func (l *LevelLoggerLogger) IsTrace() bool {
|
|||
|
||||
// Debug records debug log
|
||||
func (l *LevelLoggerLogger) Debug(format string, v ...interface{}) {
|
||||
l.Log(1, DEBUG, format, v...)
|
||||
l.Log(1, DEBUG, format, v...) //nolint:errcheck
|
||||
}
|
||||
|
||||
// IsDebug returns true if the logger is DEBUG
|
||||
|
@ -73,7 +73,7 @@ func (l *LevelLoggerLogger) IsDebug() bool {
|
|||
|
||||
// Info records information log
|
||||
func (l *LevelLoggerLogger) Info(format string, v ...interface{}) {
|
||||
l.Log(1, INFO, format, v...)
|
||||
l.Log(1, INFO, format, v...) //nolint:errcheck
|
||||
}
|
||||
|
||||
// IsInfo returns true if the logger is INFO
|
||||
|
@ -83,7 +83,7 @@ func (l *LevelLoggerLogger) IsInfo() bool {
|
|||
|
||||
// Warn records warning log
|
||||
func (l *LevelLoggerLogger) Warn(format string, v ...interface{}) {
|
||||
l.Log(1, WARN, format, v...)
|
||||
l.Log(1, WARN, format, v...) //nolint:errcheck
|
||||
}
|
||||
|
||||
// IsWarn returns true if the logger is WARN
|
||||
|
@ -93,12 +93,12 @@ func (l *LevelLoggerLogger) IsWarn() bool {
|
|||
|
||||
// Error records error log
|
||||
func (l *LevelLoggerLogger) Error(format string, v ...interface{}) {
|
||||
l.Log(1, ERROR, format, v...)
|
||||
l.Log(1, ERROR, format, v...) //nolint:errcheck
|
||||
}
|
||||
|
||||
// ErrorWithSkip records error log from "skip" calls back from this function
|
||||
func (l *LevelLoggerLogger) ErrorWithSkip(skip int, format string, v ...interface{}) {
|
||||
l.Log(skip+1, ERROR, format, v...)
|
||||
l.Log(skip+1, ERROR, format, v...) //nolint:errcheck
|
||||
}
|
||||
|
||||
// IsError returns true if the logger is ERROR
|
||||
|
@ -108,12 +108,12 @@ func (l *LevelLoggerLogger) IsError() bool {
|
|||
|
||||
// Critical records critical log
|
||||
func (l *LevelLoggerLogger) Critical(format string, v ...interface{}) {
|
||||
l.Log(1, CRITICAL, format, v...)
|
||||
l.Log(1, CRITICAL, format, v...) //nolint:errcheck
|
||||
}
|
||||
|
||||
// CriticalWithSkip records critical log from "skip" calls back from this function
|
||||
func (l *LevelLoggerLogger) CriticalWithSkip(skip int, format string, v ...interface{}) {
|
||||
l.Log(skip+1, CRITICAL, format, v...)
|
||||
l.Log(skip+1, CRITICAL, format, v...) //nolint:errcheck
|
||||
}
|
||||
|
||||
// IsCritical returns true if the logger is CRITICAL
|
||||
|
@ -123,14 +123,14 @@ func (l *LevelLoggerLogger) IsCritical() bool {
|
|||
|
||||
// Fatal records fatal log and exit the process
|
||||
func (l *LevelLoggerLogger) Fatal(format string, v ...interface{}) {
|
||||
l.Log(1, FATAL, format, v...)
|
||||
l.Log(1, FATAL, format, v...) //nolint:errcheck
|
||||
l.Close()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// FatalWithSkip records fatal log from "skip" calls back from this function and exits the process
|
||||
func (l *LevelLoggerLogger) FatalWithSkip(skip int, format string, v ...interface{}) {
|
||||
l.Log(skip+1, FATAL, format, v...)
|
||||
l.Log(skip+1, FATAL, format, v...) //nolint:errcheck
|
||||
l.Close()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
@ -99,6 +99,6 @@ func (l *MultiChannelledLogger) SendLog(level Level, caller, filename string, li
|
|||
time: time.Now(),
|
||||
stacktrace: stack,
|
||||
}
|
||||
l.LogEvent(event)
|
||||
l.LogEvent(event) //nolint:errcheck
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ func (logger *WriterLogger) createMsg(buf *[]byte, event *Event) {
|
|||
(&protectedANSIWriter{
|
||||
w: &baw,
|
||||
mode: pawMode,
|
||||
}).Write(msg)
|
||||
}).Write(msg) //nolint:errcheck
|
||||
*buf = baw
|
||||
|
||||
if event.stacktrace != "" && logger.StacktraceLevel <= event.level {
|
||||
|
@ -249,7 +249,7 @@ func (logger *WriterLogger) Match(event *Event) bool {
|
|||
(&protectedANSIWriter{
|
||||
w: &baw,
|
||||
mode: removeColor,
|
||||
}).Write([]byte(event.msg))
|
||||
}).Write([]byte(event.msg)) //nolint:errcheck
|
||||
msg = baw
|
||||
return logger.regexp.Match(msg)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue