mirror of
https://github.com/kopia/kopia.git
synced 2025-12-22 10:07:06 +00:00
refactor(ci): enable wsl_v5:return linter (#4975)
Also, disable redundant nakedret linter
This commit is contained in:
@@ -86,7 +86,6 @@ linters:
|
||||
- assign
|
||||
- err
|
||||
- expr
|
||||
- return
|
||||
|
||||
default: all
|
||||
disable:
|
||||
@@ -99,8 +98,9 @@ linters:
|
||||
- importas
|
||||
- ireturn # this one may be interesting to control allocations
|
||||
- musttag
|
||||
- nakedret # already enforced by gofumpt in a stricter manner
|
||||
- nilnil
|
||||
- nlreturn
|
||||
- nlreturn # already enforced by wsl_v5
|
||||
- noctx
|
||||
- noinlineerr # inline error handling is a common Go idiom used in this codebase
|
||||
- nonamedreturns
|
||||
|
||||
@@ -261,6 +261,7 @@ func (c *App) setup(app *kingpin.Application) {
|
||||
_ = app.Flag("help-full", "Show help for all commands, including hidden").Action(func(pc *kingpin.ParseContext) error {
|
||||
_ = app.UsageForContextWithTemplate(pc, 0, kingpin.DefaultUsageTemplate)
|
||||
c.exitWithError(nil)
|
||||
|
||||
return nil
|
||||
}).Bool()
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ func TestRetry(t *testing.T) {
|
||||
if cnt < 2 {
|
||||
return 0, errRetriable
|
||||
}
|
||||
|
||||
return 4, nil
|
||||
}, 4, nil},
|
||||
{"retriable-never-succeeds", func() (int, error) { return 0, errRetriable }, 0, errors.New("unable to complete retriable-never-succeeds despite 3 retries")},
|
||||
|
||||
@@ -93,6 +93,7 @@ func functions(opt Options) template.FuncMap {
|
||||
sort.Slice(res, func(i, j int) bool {
|
||||
return res[i].Manifest.Source.String() < res[j].Manifest.Source.String()
|
||||
})
|
||||
|
||||
return res
|
||||
},
|
||||
"formatTime": func(t time.Time) string {
|
||||
|
||||
@@ -22,6 +22,7 @@ func newGZipCompressor(id HeaderID, level int) Compressor {
|
||||
New: func() any {
|
||||
w, err := gzip.NewWriterLevel(io.Discard, level)
|
||||
mustSucceed(err)
|
||||
|
||||
return w
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -23,6 +23,7 @@ func newpgzipCompressor(id HeaderID, level int) Compressor {
|
||||
New: func() any {
|
||||
w, err := pgzip.NewWriterLevel(bytes.NewBuffer(nil), level)
|
||||
mustSucceed(err)
|
||||
|
||||
return w
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -23,6 +23,7 @@ func newZstdCompressor(id HeaderID, level zstd.EncoderLevel) Compressor {
|
||||
New: func() any {
|
||||
w, err := zstd.NewWriter(io.Discard, zstd.WithEncoderLevel(level))
|
||||
mustSucceed(err)
|
||||
|
||||
return w
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -438,6 +438,7 @@ func runTaskDropDeletedContentsFull(ctx context.Context, runParams RunParameters
|
||||
if safeDropTime.IsZero() {
|
||||
contentlog.Log(ctx, log,
|
||||
"Not forgetting deleted contents yet since not enough time has passed since previous successful Snapshot GC. Will try again next time.")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -209,6 +209,7 @@ func TestManifestInitCorruptedBlock(t *testing.T) {
|
||||
{"GetRaw", func() error {
|
||||
var raw json.RawMessage
|
||||
_, err := mgr.Get(ctx, "anything", &raw)
|
||||
|
||||
return err
|
||||
}},
|
||||
{"GetMetadata", func() error { _, err := mgr.GetMetadata(ctx, "anything"); return err }},
|
||||
|
||||
@@ -611,6 +611,7 @@ func TestWriteSessionFlushOnSuccess(t *testing.T) {
|
||||
afterFlushCount.Add(1)
|
||||
return nil
|
||||
})
|
||||
|
||||
return nil
|
||||
})
|
||||
},
|
||||
@@ -672,6 +673,7 @@ func TestWriteSessionFlushOnSuccessClient(t *testing.T) {
|
||||
afterFlushCount.Add(1)
|
||||
return nil
|
||||
})
|
||||
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
||||
@@ -194,6 +194,7 @@ func TestWalkChecker_GatherCompare(t *testing.T) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
},
|
||||
@@ -345,6 +346,7 @@ func TestWalkChecker_filterReportDiffs(t *testing.T) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user