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