mirror of
https://github.com/restic/restic.git
synced 2025-12-10 21:21:48 +00:00
extra linters
This commit is contained in:
@@ -3,8 +3,10 @@ linters:
|
||||
# only enable the linters listed below
|
||||
default: none
|
||||
enable:
|
||||
- asciicheck
|
||||
# ensure that http response bodies are closed
|
||||
- bodyclose
|
||||
- copyloopvar
|
||||
# make sure all errors returned by functions are handled
|
||||
- errcheck
|
||||
# examine code and report suspicious constructs, such as Printf calls whose
|
||||
@@ -14,6 +16,7 @@ linters:
|
||||
- importas
|
||||
# detect when assignments to existing variables are not used
|
||||
- ineffassign
|
||||
- nolintlint
|
||||
# make sure names and comments are used according to the conventions
|
||||
- revive
|
||||
# run static analysis and find errors
|
||||
|
||||
@@ -461,7 +461,6 @@ func TestIncrementalBackup(t *testing.T) {
|
||||
t.Logf("repository grown by %d bytes", stat3.size-stat2.size)
|
||||
}
|
||||
|
||||
// nolint: staticcheck // false positive nil pointer dereference check
|
||||
func TestBackupTags(t *testing.T) {
|
||||
env, cleanup := withTestEnvironment(t)
|
||||
defer cleanup()
|
||||
@@ -497,7 +496,6 @@ func TestBackupTags(t *testing.T) {
|
||||
"expected parent to be %v, got %v", parent.ID, newest.Parent)
|
||||
}
|
||||
|
||||
// nolint: staticcheck // false positive nil pointer dereference check
|
||||
func TestBackupProgramVersion(t *testing.T) {
|
||||
env, cleanup := withTestEnvironment(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -12,7 +12,6 @@ func testRunTag(t testing.TB, opts TagOptions, gopts GlobalOptions) {
|
||||
rtest.OK(t, runTag(context.TODO(), opts, gopts, nil, []string{}))
|
||||
}
|
||||
|
||||
// nolint: staticcheck // false positive nil pointer dereference check
|
||||
func TestTag(t *testing.T) {
|
||||
env, cleanup := withTestEnvironment(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -118,7 +118,7 @@ func TestRoundTripperReader(t *testing.T) {
|
||||
test.Assert(t, bytes.Equal(data, out.Bytes()), "data ping-pong failed")
|
||||
}
|
||||
|
||||
// nolint:bodyclose // the http response is just a mock
|
||||
//nolint:bodyclose // the http response is just a mock
|
||||
func TestRoundTripperCornerCases(t *testing.T) {
|
||||
limiter := NewStaticLimiter(Limits{42 * 1024, 42 * 1024})
|
||||
|
||||
|
||||
@@ -176,7 +176,6 @@ func (r *SFTP) mkdirAllDataSubdirs(ctx context.Context, nconn uint) error {
|
||||
g.SetLimit(int(nconn))
|
||||
|
||||
for _, d := range r.Paths() {
|
||||
d := d
|
||||
g.Go(func() error {
|
||||
// First try Mkdir. For most directories in Paths, this takes one
|
||||
// round trip, not counting duplicate parent creations causes by
|
||||
|
||||
@@ -669,7 +669,6 @@ func benchmarkSnapshotScaling(t *testing.B, newSnapshots int) {
|
||||
func BenchmarkCheckerSnapshotScaling(b *testing.B) {
|
||||
counts := []int{50, 100, 200}
|
||||
for _, count := range counts {
|
||||
count := count
|
||||
b.Run(strconv.Itoa(count), func(b *testing.B) {
|
||||
benchmarkSnapshotScaling(b, count)
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ type ExtendedFileInfo struct {
|
||||
ModTime time.Time // last (content) modification time stamp
|
||||
ChangeTime time.Time // last status change time stamp
|
||||
|
||||
// nolint:unused // only used on Windows
|
||||
//nolint:unused // only used on Windows
|
||||
sys any // Value returned by os.FileInfo.Sys()
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,6 @@ func handleUnknownGenericAttributeFound(genericAttributeType GenericAttributeTyp
|
||||
|
||||
// HandleAllUnknownGenericAttributesFound performs validations for all generic attributes of a node.
|
||||
// This is not used on windows currently because windows has handling for generic attributes.
|
||||
// nolint:unused
|
||||
func HandleAllUnknownGenericAttributesFound(attributes map[GenericAttributeType]json.RawMessage, warn func(msg string)) error {
|
||||
for name := range attributes {
|
||||
handleUnknownGenericAttributeFound(name, warn)
|
||||
|
||||
Reference in New Issue
Block a user