Strider report
Strider corpus: restic
Showing 1000 of 5843 detailed findings. The summary includes all 5843 findings.
build.go1
251:27add-constant
build.go:251:27
func ParseGoVersion(s string) (v GoVersion) { if !strings.HasPrefix(s, "go") { returninternal/ui/backup/text.go1
68:17append-to-sized-slice
internal/ui/backup/text.go:68:17
for filename := range currentFiles { lines = append(lines, filename) }internal/global/global_debug.go1
9:2blank-imports
internal/global/global_debug.go:9:2
"net/http" _ "net/http/pprof"internal/fs/stat_darwin_test.go1
31:18boolean-literal-comparison
internal/fs/stat_darwin_test.go:31:18
rtest.Assert(t, err == nil, "err should be nil", err) rtest.Assert(t, recall == false, "RecallOnDataAccess should be false")}cmd/restic/cmd_prune.go1
243:2call-to-gc
cmd/restic/cmd_prune.go:243:2
// Trigger GC to reset garbage collection threshold runtime.GC()build.go1
250:6cognitive-complexity
build.go:250:6
// ParseGoVersion parses the Go version s. If s cannot be parsed, the returned GoVersion is null.func ParseGoVersion(s string) (v GoVersion) { if !strings.HasPrefix(s, "go") {cmd/restic/cmd_backup_integration_test.go1
60:6confusing-naming
cmd/restic/cmd_backup_integration_test.go:60:6
func testBackup(t *testing.T, useFsSnapshot bool) { env, cleanup := withTestEnvironment(t)cmd/restic/cmd_check_integration_test.go1
28:88confusing-results
cmd/restic/cmd_check_integration_test.go:28:88
func testRunCheckOutput(t testing.TB, gopts global.Options, checkUnused bool) (string, string, error) { stdout, stderr, err := withCaptureStdoutStderr(t, gopts, func(ctx context.Context, gopts global.Options) error {internal/backend/limiter/static_limiter.go1
25:6constructor-interface-return
internal/backend/limiter/static_limiter.go:25:6
// download rate capfunc NewStaticLimiter(l Limits) Limiter { var (internal/data/testing.go1
113:38context-as-argument
internal/data/testing.go:113:38
//nolint:revive // as this is a test helper, t should go firstfunc TestSaveNodes(t testing.TB, ctx context.Context, uploader restic.BlobSaver, nodes []*Node) restic.ID { slices.SortFunc(nodes, func(a, b *Node) int {internal/backend/readerat.go1
12:2context-stored-in-struct
internal/backend/readerat.go:12:2
type backendReaderAt struct { ctx context.Context be Backendinternal/fuse/dir.go1
53:16copy-lock-value
internal/fuse/dir.go:53:16
parentInode: parentInode, cache: *newTreeCache(), }, nilbuild.go2
323:6cyclomatic-complexity
build.go:323:6
func main() { if !goVersion.AtLeast(config.MinVersion) {87:2deep-exit
build.go:87:2
fmt.Fprintf(os.Stderr, message, args...) os.Exit(1)}internal/repository/crypto/crypto.go1
12:2deprecated-api-usage
internal/repository/crypto/crypto.go:12:2
"golang.org/x/crypto/poly1305")cmd/restic/cleanup.go1
32:10discarded-error-result
cmd/restic/cleanup.go:32:10
if val, _ := os.LookupEnv("RESTIC_DEBUG_STACKTRACE_SIGINT"); val != "" { _, _ = stderr.Write([]byte("\n--- STACKTRACE START ---\n\n")) _, _ = stderr.Write([]byte(debug.DumpStacktrace()))cmd/restic/cmd_backup.go1
176:1doc-comment-period
cmd/restic/cmd_backup.go:176:1
// ErrInvalidSourceData is used to report an incomplete backupvar ErrInvalidSourceData = errors.New("at least one source file could not be read")internal/restorer/restorer_windows_test.go1
22:2duplicated-imports
internal/restorer/restorer_windows_test.go:22:2
"github.com/restic/restic/internal/test" rtest "github.com/restic/restic/internal/test" "golang.org/x/sys/windows"cmd/restic/cmd_backup.go1
522:3early-return
cmd/restic/cmd_backup.go:522:3
if err != nil { if errors.Is(err, ErrInvalidSourceData) { success = falsecmd/restic/cmd_check_test.go1
216:15error-strings
cmd/restic/cmd_check_test.go:216:15
if !found { t.Errorf("Expected temporary directory to exist, but it does not") }internal/repository/checker.go1
26:6error-type-naming
internal/repository/checker.go:26:6
// ErrIncompletePackEntry is returned when indexes contain different data for a pack.type ErrIncompletePackEntry struct { PackID restic.IDinternal/archiver/archiver_test.go1
2402:4excessive-blank-identifiers
internal/archiver/archiver_test.go:2402:4
_, _, _, err := arch.Snapshot(ctx, []string{"."}, SnapshotOptions{Time: time.Now()}) if !errors.Is(err, testErr) {build.go1
229:6exported-declaration-comment
build.go:229:6
// the given value via compiler flags.type Constants map[string]stringcmd/restic/cmd_backup.go1
1:1file-length-limit
cmd/restic/cmd_backup.go:1:1
package maincmd/restic/cmd_check.go1
441:2flag-parameter
cmd/restic/cmd_check.go:441:2
func buildPacksFilter(opts CheckOptions, printer restic.Printer, filteredStatus bool) (func(packs map[restic.ID]int64) map[restic.ID]int64, error) { typeData := ""build.go2
1:1format
build.go:1:1
// Description//- Fix (safe): run `strider fmt build.go`
323:6function-length
build.go:323:6
func main() { if !goVersion.AtLeast(config.MinVersion) {cmd/restic/cmd_diff_integration_test.go1
81:6function-result-limit
cmd/restic/cmd_diff_integration_test.go:81:6
func setupDiffRepo(t *testing.T) (*testEnvironment, func(), string, string) { env, cleanup := withTestEnvironment(t)internal/backend/sema/semaphore.go1
25:20get-function-return-value
internal/backend/sema/semaphore.go:25:20
// GetToken blocks until a Token is available.func (s semaphore) GetToken() { s.ch <- struct{}{}cmd/restic/main.go1
226:2identical-switch-branches
cmd/restic/main.go:226:2
exitCode = 3 case errors.Is(err, ErrFailedToRemoveOneOrMoreSnapshots): exitCode = 3cmd/restic/cmd_mount.go1
29:2import-alias-naming
cmd/restic/cmd_mount.go:29:2
systemFuse "github.com/anacrolix/fuse" fusefs "github.com/anacrolix/fuse/fs"cmd/restic/cmd_backup.go1
174:27import-shadowing
cmd/restic/cmd_backup.go:174:27
var backupFSTestHook func(fs fs.FS) fs.FScmd/restic/cmd_find.go1
435:6inefficient-map-lookup
cmd/restic/cmd_find.go:435:6
// Replace the short ID with the long one f.blobIDs[idStr] = struct{}{} delete(f.blobIDs, id.Str())internal/backend/cache/cache.go1
128:65inefficient-sprintf
internal/backend/cache/cache.go:128:65
if v < cacheVersion { err = os.WriteFile(filepath.Join(cachedir, "version"), []byte(fmt.Sprintf("%d", cacheVersion)), fileMode) if err != nil {internal/backend/rclone/backend.go1
232:21insecure-url-scheme
internal/backend/rclone/backend.go:232:21
// rclone is able to accept HTTP requests. url := fmt.Sprintf("http://localhost/file-%d", rand.Uint64())internal/backend/backend.go1
19:14interface-method-limit
internal/backend/backend.go:19:14
// separately by the retrying logic.type Backend interface { // Properties returns information about the backendinternal/data/node.go1
187:7marshal-receiver
internal/data/node.go:187:7
func (node *Node) UnmarshalJSON(data []byte) error { type nodeJSON Nodecmd/restic/cmd_migrate.go1
93:7max-control-nesting
cmd/restic/cmd_migrate.go:93:7
if !opts.Force { if reason == "" { reason = "check failed"cmd/restic/cmd_rewrite.go1
193:6max-parameters
cmd/restic/cmd_rewrite.go:193:6
func filterAndReplaceSnapshot(ctx context.Context, repo restic.Repository, sn *data.Snapshot, filter rewriteFilterFunc, dryRun bool, forget bool, newMetadata *snapshotMetadata, addTag string, printer restic.Printer,internal/archiver/archiver.go1
830:6max-public-structs
internal/archiver/archiver.go:830:6
// SnapshotOptions collect attributes for a new snapshot.type SnapshotOptions struct { Tags data.TagListbuild.go1
158:2modifies-parameter
build.go:158:2
func test(cwd string, env map[string]string, args ...string) error { args = append([]string{"test", "-count", "1"}, args...) cmd := exec.Command("go", args...)internal/archiver/archiver.go1
162:3modifies-value-receiver
internal/archiver/archiver.go:162:3
// https://github.com/borgbackup/borg/issues/3500 o.ReadConcurrency = 2 }cmd/restic/cmd_backup_integration_test.go1
392:31nested-structs
cmd/restic/cmd_backup_integration_test.go:392:31
snapshots := make(map[string]struct{})cmd/restic/cmd_backup.go2
167:4nil-error-return
cmd/restic/cmd_backup.go:167:4
debug.Log("os.Hostname() returned err: %v", err) return nil }472:3nil-value-with-nil-error
cmd/restic/cmd_backup.go:472:3
if opts.Force { return nil, nil }internal/data/tree_test.go1
45:3no-defer-in-loop
internal/data/tree_test.go:45:3
f, err := os.Create(file) defer func() { rtest.OK(t, f.Close())cmd/restic/cmd_backup.go1
201:4no-else-after-return
cmd/restic/cmd_backup.go:201:4
return nil, ErrNoSourceData } else if len(result) < len(items) { return result, ErrInvalidSourceDatacmd/restic/main.go1
26:6no-init
cmd/restic/main.go:26:6
func init() { // don't import `go.uber.org/automaxprocs` to disable the log outputbuild.go3
252:3no-naked-return
build.go:252:3
if !strings.HasPrefix(s, "go") { return }54:5no-package-var
build.go:54:5
// config contains the configuration for the program to build.var config = Config{ Name: "restic", // name of the program executable and directory40:9package-comments
build.go:40:9
package maincmd/restic/cmd_forget_test.go1
87:30range-value-address
cmd/restic/cmd_forget_test.go:87:30
for _, testCase := range testCases { err := verifyForgetOptions(&testCase.input) if testCase.errorMsg != "" {cmd/restic/integration_helpers_test.go1
362:24redefines-builtin-id
cmd/restic/integration_helpers_test.go:362:24
func lastSnapshot(old, new map[string]struct{}) (map[string]struct{}, string) { for k := range new {cmd/restic/cmd_check.go1
474:15redundant-conversion
cmd/restic/cmd_check.go:474:15
repoSize := int64(0) return func(packs map[restic.ID]int64) map[restic.ID]int64 {internal/data/find.go1
34:4single-case-switch
internal/data/find.go:34:4
lock.Lock() switch item.Node.Type { case NodeTypeFile:cmd/restic/cmd_backup_test.go1
27:6slice-preallocation
cmd/restic/cmd_backup_test.go:27:6
var expect []string for _, filename := range []string{internal/backend/rest/rest.go1
225:46standard-http-method-constant
internal/backend/rest/rest.go:225:46
func (b *Backend) openReader(ctx context.Context, h backend.Handle, length int, offset int64) (io.ReadCloser, error) { req, err := http.NewRequestWithContext(ctx, "GET", b.Filename(h), nil) if err != nil {cmd/restic/lock.go1
35:2task-comment
cmd/restic/lock.go:35:2
func openWithReadLock(ctx context.Context, gopts global.Options, noLock bool, printer restic.Printer) (context.Context, *repository.Repository, func(), error) { // TODO enforce read-only operations once the locking code has moved to the repository // As in-depth hardening, put the repository into read-only mode if noLock is trueinternal/fs/node_unix_test.go1
69:5time-value-equality
internal/fs/node_unix_test.go:69:5
s := ExtendedStat(fi) if node.ModTime != s.ModTime { t.Errorf("ModTime does not match, want %v, got %v", s.ModTime, node.ModTime)build.go1
75:1top-level-declaration-order
build.go:75:1
var ( verbose boolcmd/restic/cmd_mount.go1
250:46unchecked-type-assertion
cmd/restic/cmd_mount.go:250:46
if loc.Scheme == "local" { if err := checkMountpointOverlap(loc.Config.(*local.Config).Path, mountpoint); err != nil { return errinternal/backend/httpuseragent_roundtripper_test.go1
36:2unclosed-http-response-body
internal/backend/httpuseragent_roundtripper_test.go:36:2
// Make a request to the test server resp, err := client.Get(server.URL) if err != nil {internal/fs/ea_windows.go1
144:6unexported-naming
internal/fs/ea_windows.go:144:6
func getFileEA(handle windows.Handle, iosb *ioStatusBlock, buf *uint8, bufLen uint32, returnSingleEntry bool, eaList uintptr, eaListLen uint32, eaIndex *uint32, restartScan bool) (status ntStatus) { var _p0 uint32 if returnSingleEntry {internal/archiver/buffer.go1
45:31unexported-return
internal/archiver/buffer.go:45:31
// Get returns a new buffer, either from the pool or newly allocated.func (pool *bufferPool) Get() *buffer { return pool.pool.Get().(*buffer)cmd/restic/cmd_self_update.go1
62:87unused-parameter
cmd/restic/cmd_self_update.go:62:87
func runSelfUpdate(ctx context.Context, opts SelfUpdateOptions, gopts global.Options, args []string, term ui.Terminal) error { if opts.Output == "" {cmd/restic/cmd_forget.go1
97:7unused-receiver
cmd/restic/cmd_forget.go:97:7
func (c *ForgetPolicyCount) Type() string { return "n"build.go1
85:34use-any
build.go:85:34
// code.func die(message string, args ...interface{}) { fmt.Fprintf(os.Stderr, message, args...)cmd/restic/cmd_debug.go1
165:10use-errors-new
cmd/restic/cmd_debug.go:165:10
if opts.ExtractPack && gopts.NoLock { return fmt.Errorf("--extract-pack and --no-lock are mutually exclusive") }internal/ui/table/table.go1
105:10use-fmt-print
internal/ui/table/table.go:105:10
err := print(w, strings.TrimRight(s, " ")) if err != nil {cmd/restic/cmd_cache.go1
134:2use-slices-sort
cmd/restic/cmd_cache.go:134:2
sort.Slice(dirs, func(i, j int) bool { return dirs[i].ModTime().Before(dirs[j].ModTime())internal/fs/vss_windows.go1
646:21var-declaration
internal/fs/vss_windows.go:646:21
func (vssAsync *IVSSAsync) QueryStatus() (HRESULT, uint32) { var state uint32 = 0 result, _, _ := syscall.Syscall(vssAsync.getVTable().queryStatus, 3,internal/fs/const.go1
8:2var-naming
internal/fs/const.go:8:2
const ( O_RDONLY int = syscall.O_RDONLY // open the file read-only. O_WRONLY int = syscall.O_WRONLY // open the file write-only.internal/backend/azure/azure.go1
223:9weak-cryptography
internal/backend/azure/azure.go:223:9
func (be *Backend) Hasher() hash.Hash { return md5.New()}build.go1
405:10add-constant
build.go:405:10
outputFilename = config.Name if env["GOOS"] == "windows" { outputFilename += ".exe"internal/fs/stat_darwin_test.go1
79:18boolean-literal-comparison
internal/fs/stat_darwin_test.go:79:18
rtest.Assert(t, err == nil, "err should be nil", err) rtest.Assert(t, recall == false, "RecallOnDataAccess should be false")}internal/repository/index/master_index.go1
402:2call-to-gc
internal/repository/index/master_index.go:402:2
mi.clear() runtime.GC()build.go1
323:6cognitive-complexity
build.go:323:6
func main() { if !goVersion.AtLeast(config.MinVersion) {cmd/restic/cmd_list_integration_test.go1
84:6confusing-naming
cmd/restic/cmd_list_integration_test.go:84:6
func TestListBlobs(t *testing.T) {cmd/restic/cmd_diff_integration_test.go1
81:69confusing-results
cmd/restic/cmd_diff_integration_test.go:81:69
func setupDiffRepo(t *testing.T) (*testEnvironment, func(), string, string) { env, cleanup := withTestEnvironment(t)internal/backend/location/registry.go1
68:6constructor-interface-return
internal/backend/location/registry.go:68:6
func NewHTTPBackendFactory[C any, T backend.Backend]( scheme string,internal/fuse/dir.go1
99:10copy-lock-value
internal/fuse/dir.go:99:10
inode: inode, cache: *newTreeCache(), }, nilcmd/restic/cmd_backup.go1
300:27cyclomatic-complexity
cmd/restic/cmd_backup.go:300:27
// Check returns an error when an invalid combination of options was set.func (opts BackupOptions) Check(gopts global.Options, args []string) error { if gopts.Password == "" && !gopts.InsecureNoPassword {cmd/restic/cleanup.go1
43:2deep-exit
cmd/restic/cleanup.go:43:2
debug.Log("exiting with status code %d", code) os.Exit(code)}internal/selfupdate/verify.go1
7:2deprecated-api-usage
internal/selfupdate/verify.go:7:2
"golang.org/x/crypto/openpgp")cmd/restic/cleanup.go1
33:10discarded-error-result
cmd/restic/cleanup.go:33:10
_, _ = stderr.Write([]byte("\n--- STACKTRACE START ---\n\n")) _, _ = stderr.Write([]byte(debug.DumpStacktrace())) _, _ = stderr.Write([]byte("\n--- STACKTRACE END ---\n"))cmd/restic/cmd_backup.go1
179:1doc-comment-period
cmd/restic/cmd_backup.go:179:1
// ErrNoSourceData is used to report that no source data was foundvar ErrNoSourceData = errors.Fatal("all source directories/files do not exist")cmd/restic/cmd_forget.go1
244:4early-return
cmd/restic/cmd_forget.go:244:4
if policy.Empty() { if opts.UnsafeAllowRemoveAll { if opts.SnapshotFilter.Empty() {cmd/restic/cmd_copy.go1
302:22error-strings
cmd/restic/cmd_copy.go:302:22
if err != nil { return fmt.Errorf("LoadTree(%v) returned error %v", treeID.Str(), err) }internal/repository/checker.go1
36:6error-type-naming
internal/repository/checker.go:36:6
// ErrDuplicatePacks is returned when a pack is found in more than one index.type ErrDuplicatePacks struct { PackID restic.IDinternal/checker/checker_test.go1
498:3excessive-blank-identifiers
internal/checker/checker_test.go:498:3
var err error _, _, _, err = uploader.SaveBlob(ctx, restic.DataBlob, buf, id, false) return errcmd/restic/cmd_backup_integration_test.go2
768:8exported-declaration-comment
cmd/restic/cmd_backup_integration_test.go:768:8
type MessageType struct { MessageType string `json:"message_type"` // any1:1file-length-limit
cmd/restic/cmd_backup_integration_test.go:1:1
package maincmd/restic/cmd_key_add.go1
98:88flag-parameter
cmd/restic/cmd_key_add.go:98:88
func getNewPassword(ctx context.Context, gopts global.Options, newPasswordFile string, insecureNoPassword bool) (string, error) { if testKeyNewPassword != "" {cmd/restic/cmd_backup.go2
1:1format
cmd/restic/cmd_backup.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_backup.go`
498:6function-length
cmd/restic/cmd_backup.go:498:6
func runBackup(ctx context.Context, opts BackupOptions, gopts global.Options, term ui.Terminal, args []string) error { var vsscfg fs.VSSConfigcmd/restic/lock.go1
11:6function-result-limit
cmd/restic/lock.go:11:6
func internalOpenWithLocked(ctx context.Context, gopts global.Options, dryRun bool, exclusive bool, printer restic.Printer) (context.Context, *repository.Repository, func(), error) { repo, err := global.OpenRepository(ctx, gopts, printer)internal/archiver/archiver.go1
639:2identical-switch-branches
internal/archiver/archiver.go:639:2
return true case node.Type != data.NodeTypeFile: // We're only called for regular files, so this is a type change.cmd/restic/cmd_mount_integration_test.go1
15:2import-alias-naming
cmd/restic/cmd_mount_integration_test.go:15:2
systemFuse "github.com/anacrolix/fuse" "github.com/restic/restic/internal/data"cmd/restic/cmd_backup.go1
220:3import-shadowing
cmd/restic/cmd_backup.go:220:3
var ( data []byte err errorcmd/restic/cmd_find.go1
482:4inefficient-map-lookup
cmd/restic/cmd_find.go:482:4
delete(packIDs, id.Str()) packIDs[idStr] = struct{}{} }internal/backend/rest/rest_int_test.go1
101:41inefficient-sprintf
internal/backend/rest/rest_int_test.go:101:41
res.Header().Set("Content-Length", fmt.Sprintf("%d", length)) res.WriteHeader(http.StatusOK)internal/backend/rclone/backend.go1
279:24insecure-url-scheme
internal/backend/rclone/backend.go:279:24
url, err := url.Parse("http://localhost/") if err != nil {internal/backend/backend.go1
126:20interface-method-limit
internal/backend/backend.go:126:20
type FreezeBackend interface { Backendinternal/restic/blob.go1
80:7marshal-receiver
internal/restic/blob.go:80:7
// UnmarshalJSON decodes the BlobType from JSON.func (t *BlobType) UnmarshalJSON(buf []byte) error { switch string(buf) {cmd/restic/cmd_stats.go1
284:8max-control-nesting
cmd/restic/cmd_stats.go:284:8
blobSize, found := repo.LookupBlobSize(restic.BlobHandle{Type: restic.DataBlob, ID: blobID}) if !found { return fmt.Errorf("blob %s not found for tree %s", blobID, parentTreeID)internal/archiver/file_saver.go1
160:21max-parameters
internal/archiver/file_saver.go:160:21
// saveFile stores the file f in the repo, then closes it.func (s *fileSaver) saveFile(ctx context.Context, chnker restic.Chunker, chunkState *fileChunkState, snPath string, target string, f fs.File, start func(), finishReading func(), finish func(res futureNodeResult)) { start()internal/fs/vss_windows.go1
700:6max-public-structs
internal/fs/vss_windows.go:700:6
// IVSSAdmin VSS api interface.type IVSSAdmin struct { ole.IUnknownbuild.go1
255:2modifies-parameter
build.go:255:2
s = s[2:] data := strings.Split(s, ".")internal/archiver/archiver.go1
171:3modifies-value-receiver
internal/archiver/archiver.go:171:3
// more files to read. o.SaveTreeConcurrency = uint(runtime.GOMAXPROCS(0)) + o.ReadConcurrency }cmd/restic/cmd_cat_test.go1
11:25nested-structs
cmd/restic/cmd_cat_test.go:11:25
func TestCatArgsValidation(t *testing.T) { for _, test := range []struct { args []stringcmd/restic/cmd_check.go1
468:4nil-error-return
cmd/restic/cmd_check.go:468:4
} return func(packs map[restic.ID]int64) map[restic.ID]int64 { printer.P("read %.1f%% of %spackfiles", percentage, typeData)cmd/restic/cmd_init.go1
130:2nil-value-with-nil-error
cmd/restic/cmd_init.go:130:2
} return nil, nil}internal/fs/node_windows_test.go1
478:3no-defer-in-loop
internal/fs/node_windows_test.go:478:3
test.OK(t, errors.Wrapf(err, "Error opening file/directory for: %s", testPath)) defer func() { err := windows.Close(handle)cmd/restic/cmd_check.go1
463:5no-else-after-return
cmd/restic/cmd_check.go:463:5
}, nil } else if strings.HasSuffix(opts.ReadDataSubset, "%") { percentage, err := parsePercentage(opts.ReadDataSubset)helpers/build-release-binaries/main.go1
30:6no-init
helpers/build-release-binaries/main.go:30:6
func init() { pflag.BoolVarP(&opts.Verbose, "verbose", "v", false, "be verbose")build.go2
290:2no-naked-return
build.go:290:2
return}76:2no-package-var
build.go:76:2
var ( verbose bool runTests boolcmd/restic/cleanup.go1
1:9package-comments
cmd/restic/cleanup.go:1:9
package maincmd/restic/cmd_snapshots_integration_test.go1
32:13range-value-address
cmd/restic/cmd_snapshots_integration_test.go:32:13
if newest == nil || sn.Time.After(newest.Time) { newest = &sn }internal/backend/cache/cache.go1
206:32redefines-builtin-id
internal/backend/cache/cache.go:206:32
// OlderThan returns the list of cache directories older than max.func OlderThan(basedir string, max time.Duration) ([]os.FileInfo, error) { entries, err := listCacheDirs(basedir)cmd/restic/cmd_check_test.go1
87:11redundant-conversion
cmd/restic/cmd_check_test.go:87:11
for i := uint(1); i <= 5; i++ { selectedPacks = selectPacksByBucket(testPacks, i, 5)cmd/restic/cmd_check.go1
522:6slice-preallocation
cmd/restic/cmd_check.go:522:6
var keys []restic.ID for k := range allPacks {internal/backend/rest/rest.go1
290:46standard-http-method-constant
internal/backend/rest/rest.go:290:46
func (b *Backend) Remove(ctx context.Context, h backend.Handle) error { req, err := http.NewRequestWithContext(ctx, "DELETE", b.Filename(h), nil) if err != nil {cmd/restic/lock.go1
42:2task-comment
cmd/restic/lock.go:42:2
func openWithAppendLock(ctx context.Context, gopts global.Options, dryRun bool, printer restic.Printer) (context.Context, *repository.Repository, func(), error) { // TODO enforce non-exclusive operations once the locking code has moved to the repository return internalOpenWithLocked(ctx, gopts, dryRun, false, printer)internal/fs/node_unix_test.go1
72:5time-value-equality
internal/fs/node_unix_test.go:72:5
} if node.ChangeTime != s.ChangeTime { t.Errorf("ChangeTime does not match, want %v, got %v", s.ChangeTime, node.ChangeTime)cmd/restic/cmd_backup.go1
70:1top-level-declaration-order
cmd/restic/cmd_backup.go:70:1
// BackupOptions bundles all options for the backup command.type BackupOptions struct { filter.ExcludePatternOptionsinternal/archiver/archiver_test.go1
2578:91unchecked-type-assertion
internal/archiver/archiver_test.go:2578:91
// make sure the content matches TestEnsureFileContent(context.Background(), t, repo, "testfile", node3, files["testfile"].(TestFile))internal/backend/limiter/static_limiter.go1
80:2unclosed-http-response-body
internal/backend/limiter/static_limiter.go:80:2
res, err := rt.RoundTrip(req)internal/fs/ea_windows.go1
148:6unexported-naming
internal/fs/ea_windows.go:148:6
} var _p1 uint32 if restartScan {internal/archiver/file_saver.go1
69:156unexported-return
internal/archiver/file_saver.go:69:156
// this will always happen before calling complete. The callbacks must not block.func (s *fileSaver) Save(ctx context.Context, snPath string, target string, file fs.File, start func(), completeReading func(), complete fileCompleteFunc) futureNode { fn, ch := newFutureNode()cmd/restic/integration_helpers_test.go1
426:30unused-parameter
cmd/restic/integration_helpers_test.go:426:30
func withCaptureStdoutStderr(t testing.TB, gopts global.Options, callback func(ctx context.Context, gopts global.Options) error) (*bytes.Buffer, *bytes.Buffer, error) { bufStdout := bytes.NewBuffer(nil)cmd/restic/cmd_ls.go1
188:7unused-receiver
cmd/restic/cmd_ls.go:188:7
func (p *jsonLsPrinter) LeaveDir(_ string) error { return nil }func (p *jsonLsPrinter) Close() error { return nil }build.go1
105:44use-any
build.go:105:44
func verbosePrintf(message string, args ...interface{}) { if !verbose {cmd/restic/cmd_dump.go1
208:32use-errors-new
cmd/restic/cmd_dump.go:208:32
if term.OutputIsTerminal() { return func() error { return fmt.Errorf("stdout is the terminal, please redirect output") } }cmd/restic/cmd_find.go1
689:2use-slices-sort
cmd/restic/cmd_find.go:689:2
sort.Slice(filteredSnapshots, func(i, j int) bool { if opts.Reverse {internal/restorer/restorer_windows_test.go1
324:32var-declaration
internal/restorer/restorer_windows_test.go:324:32
var attr *FileAttributes = nil if mainNodeName == stream.name {internal/fs/const.go1
9:2var-naming
internal/fs/const.go:9:2
O_RDONLY int = syscall.O_RDONLY // open the file read-only. O_WRONLY int = syscall.O_WRONLY // open the file write-only. O_RDWR int = syscall.O_RDWR // open the file read-write.internal/backend/azure/azure.go1
309:8weak-cryptography
internal/backend/azure/azure.go:309:8
// upload it as a new "block", use the base64 hash for the ID h := md5.Sum(buf) id := base64.StdEncoding.EncodeToString(h[:])build.go1
444:36add-constant
build.go:444:36
buildArgs = append(buildArgs, "-tags", strings.Join(buildTags, " "), "-ldflags", ldflags,internal/fs/stat_darwin_test.go1
90:18boolean-literal-comparison
internal/fs/stat_darwin_test.go:90:18
rtest.Assert(t, err.Error() == "could not determine file attributes: test-file-name", "err message not correct", err) rtest.Assert(t, recall == false, "RecallOnDataAccess should be false")}internal/repository/index/master_index_test.go1
406:3call-to-gc
internal/repository/index/master_index_test.go:406:3
for b.Loop() { runtime.GC() }cmd/restic/cmd_backup.go1
184:6cognitive-complexity
cmd/restic/cmd_backup.go:184:6
// ErrNoSourceData if none remain, or ErrInvalidSourceData if some were skipped.func filterExisting(items []string, warnf func(msg string, args ...interface{})) (result []string, err error) { for _, item := range items {cmd/restic/cmd_prune_integration_test.go1
112:6confusing-naming
cmd/restic/cmd_prune_integration_test.go:112:6
func testPrune(t *testing.T, pruneOpts PruneOptions, checkOpts CheckOptions) { env, cleanup := withTestEnvironment(t)cmd/restic/cmd_repair_packs_integration_test.go1
17:85confusing-results
cmd/restic/cmd_repair_packs_integration_test.go:17:85
// testRunRepairPacks runs `restic repair packs` with capturing stdout and stderrfunc testRunRepairPacks(t testing.TB, gopts global.Options, args []string) (string, string, error) { bufStdout, bufStderr, err := withCaptureStdoutStderr(t, gopts, func(ctx context.Context, gopts global.Options) error {internal/backend/location/registry.go1
88:6constructor-interface-return
internal/backend/location/registry.go:88:6
func NewLimitedBackendFactory[C any, T backend.Backend]( scheme string,internal/fuse/snapshots_dir.go1
44:16copy-lock-value
internal/fuse/snapshots_dir.go:44:16
prefix: prefix, cache: *newTreeCache(), }cmd/restic/cmd_backup.go1
359:6cyclomatic-complexity
cmd/restic/cmd_backup.go:359:6
// from being saved in a snapshot based on path and file infofunc collectRejectFuncs(opts BackupOptions, targets []string, fs fs.FS, warnf func(msg string, args ...interface{})) (funcs []archiver.RejectFunc, err error) { // allowed deviceshelpers/build-release-binaries/main.go1
48:2deep-exit
helpers/build-release-binaries/main.go:48:2
fmt.Fprintf(os.Stderr, f, args...) os.Exit(1)}cmd/restic/cleanup.go1
34:10discarded-error-result
cmd/restic/cleanup.go:34:10
_, _ = stderr.Write([]byte(debug.DumpStacktrace())) _, _ = stderr.Write([]byte("\n--- STACKTRACE END ---\n")) }cmd/restic/cmd_find_integration_test.go1
150:1doc-comment-period
cmd/restic/cmd_find_integration_test.go:150:1
// JsonOutput is the struct `restic find --json` producestype JSONOutput struct {cmd/restic/cmd_init.go1
89:2early-return
cmd/restic/cmd_init.go:89:2
if !gopts.JSON { printer.P("created restic repository %v at %s", s.Config().ID[:10], location.StripPassword(gopts.Backends, gopts.Repo))cmd/restic/cmd_mount_integration_test.go1
126:13error-strings
cmd/restic/cmd_mount_integration_test.go:126:13
if !ok { t.Errorf("Symlink latest isn't present in fuse dir") } else {internal/repository/checker.go1
46:6error-type-naming
internal/repository/checker.go:46:6
// ErrMixedPack is returned when a pack is found that contains both tree and data blobs.type ErrMixedPack struct { PackID restic.IDinternal/fs/vss_windows.go1
546:2excessive-blank-identifiers
internal/fs/vss_windows.go:546:2
// this function always succeeds and returns no value _, _, _ = proc.Call(uintptr(unsafe.Pointer(properties))) return nilcmd/restic/cmd_debug.go1
82:6exported-declaration-comment
cmd/restic/cmd_debug.go:82:6
type DebugExamineOptions struct { TryRepair boolcmd/restic/cmd_check.go1
1:1file-length-limit
cmd/restic/cmd_check.go:1:1
package maincmd/restic/cmd_ls.go1
181:52flag-parameter
cmd/restic/cmd_ls.go:181:52
func (p *jsonLsPrinter) NodeOutput(n lsNodeOutput, isPrefixDirectory bool) error { if isPrefixDirectory {cmd/restic/cmd_backup_integration_test.go1
1:1format
cmd/restic/cmd_backup_integration_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_backup_integration_test.go`
cmd/restic/cmd_cache.go1
60:6function-length
cmd/restic/cmd_cache.go:60:6
func runCache(opts CacheOptions, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)cmd/restic/lock.go1
34:6function-result-limit
cmd/restic/lock.go:34:6
func openWithReadLock(ctx context.Context, gopts global.Options, noLock bool, printer restic.Printer) (context.Context, *repository.Repository, func(), error) { // TODO enforce read-only operations once the locking code has moved to the repositoryinternal/archiver/archiver.go1
642:2identical-switch-branches
internal/archiver/archiver.go:642:2
return true case uint64(fi.Size) != node.Size: return trueinternal/backend/azure/azure.go1
29:2import-alias-naming
internal/backend/azure/azure.go:29:2
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob" azContainer "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container")cmd/restic/cmd_backup.go1
335:126import-shadowing
cmd/restic/cmd_backup.go:335:126
// from being saved in a snapshot based on path onlyfunc collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository, warnf func(msg string, args ...interface{})) (fs []archiver.RejectByNameFunc, err error) { // exclude restic cachecmd/restic/cmd_stats.go1
262:5inefficient-map-lookup
cmd/restic/cmd_stats.go:262:5
// mark the file as visited stats.uniqueFiles[fid] = struct{}{}internal/backend/watchdog_roundtriper_test.go1
49:9inefficient-sprintf
internal/backend/watchdog_roundtriper_test.go:49:9
for _, delay := range []int{0, 1, 10, 20} { t.Run(fmt.Sprintf("%v", delay), func(t *testing.T) { msg := []byte("ping-pong-data")internal/backend/rclone/backend.go1
308:24insecure-url-scheme
internal/backend/rclone/backend.go:308:24
url, err := url.Parse("http://localhost/") if err != nil {internal/checker/checker.go1
37:24interface-method-limit
internal/checker/checker.go:37:24
type checkerRepository interface { restic.Repositoryinternal/restic/id.go1
80:7marshal-receiver
internal/restic/id.go:80:7
// UnmarshalJSON parses the JSON-encoded data and stores the result in id.func (id *ID) UnmarshalJSON(b []byte) error { // check string lengthcmd/restic/integration_helpers_test.go1
128:11max-control-nesting
cmd/restic/integration_helpers_test.go:128:11
continue } else if a.path > b.path { fmt.Fprintf(&out, "+%v\n", b.path)internal/fs/ea_windows.go1
143:6max-parameters
internal/fs/ea_windows.go:143:6
func getFileEA(handle windows.Handle, iosb *ioStatusBlock, buf *uint8, bufLen uint32, returnSingleEntry bool, eaList uintptr, eaListLen uint32, eaIndex *uint32, restartScan bool) (status ntStatus) { var _p0 uint32internal/fs/vss_windows.go1
706:6max-public-structs
internal/fs/vss_windows.go:706:6
// nolint:structchecktype IVSSAdminVTable struct { ole.IUnknownVtblbuild.go1
271:29modifies-parameter
build.go:271:29
// "rc2" or so) for s := data[1]; s != ""; s = s[:len(s)-1] { v.Minor, err = strconv.Atoi(s)internal/archiver/archiver_test.go1
1845:3modifies-value-receiver
internal/archiver/archiver_test.go:1845:3
f.fs.m.Lock() f.fs.bytesRead[f.filename] += n f.fs.m.Unlock()cmd/restic/cmd_check_integration_test.go1
50:17nested-structs
cmd/restic/cmd_check_integration_test.go:50:17
func TestCheckWithSnaphotFilter(t *testing.T) { testCases := []struct { opts CheckOptionscmd/restic/cmd_copy.go1
89:5nil-error-return
cmd/restic/cmd_copy.go:89:5
} return nil }cmd/restic/cmd_rewrite.go1
90:3nil-value-with-nil-error
cmd/restic/cmd_rewrite.go:90:3
if sma.empty() { return nil, nil }internal/terminal/terminal_windows_test.go1
25:3no-defer-in-loop
internal/terminal/terminal_windows_test.go:25:3
rtest.OK(t, err) defer windows.CloseHandle(handle)cmd/restic/cmd_mount.go1
231:4no-else-after-return
cmd/restic/cmd_mount.go:231:4
return errors.Fatal(fmt.Sprintf("mountpoint %s does not exist", mountpoint)) } else if err != nil { return errors.Fatal(fmt.Sprintf("mountpoint %s is inaccessible: %v", mountpoint, err))helpers/prepare-release/main.go1
33:6no-init
helpers/prepare-release/main.go:33:6
func init() { pflag.BoolVar(&opts.IgnoreBranchName, "ignore-branch-name", false, "allow releasing from other branches than 'master'")cmd/restic/cmd_generate.go1
84:4no-naked-return
cmd/restic/cmd_generate.go:84:4
if err != nil { return }build.go1
77:2no-package-var
build.go:77:2
verbose bool runTests bool enableCGO boolcmd/restic/cmd_backup.go1
1:9package-comments
cmd/restic/cmd_backup.go:1:9
package maincmd/restic/format_test.go1
58:27range-value-address
cmd/restic/format_test.go:58:27
} { r := formatNode(c.path, &c.Node, c.long, c.human) rtest.Equals(t, c.expect, r)internal/backend/test/tests.go1
768:73redefines-builtin-id
internal/backend/test/tests.go:768:73
func delayedList(t testing.TB, b backend.Backend, tpe backend.FileType, max int, maxwait time.Duration) restic.IDs { list := restic.NewIDSet()cmd/restic/cmd_copy.go1
223:16redundant-conversion
cmd/restic/cmd_copy.go:223:16
var batch []*data.Snapshot batchSize := uint64(0) startTime := time.Now()cmd/restic/cmd_forget.go1
373:6slice-preallocation
cmd/restic/cmd_forget.go:373:6
func asJSONSnapshots(list data.Snapshots) []Snapshot { var resultList []Snapshot for _, sn := range list {internal/backend/watchdog_roundtriper_test.go1
71:59standard-http-method-constant
internal/backend/watchdog_roundtriper_test.go:71:59
rt := newWatchdogRoundtripper(http.DefaultTransport, 100*time.Millisecond, 2) req, err := http.NewRequestWithContext(context.TODO(), "GET", srv.URL, io.NopCloser(newSlowReader(bytes.NewReader(msg), time.Duration(delay)*time.Millisecond))) rtest.OK(t, err)internal/backend/retry/backend_retry.go1
139:4task-comment
internal/backend/retry/backend_retry.go:139:4
// don't retry permanent errors as those very likely cannot be fixed by retrying // TODO remove IsNotExist(err) special cases when removing the feature flag if feature.Flag.Enabled(feature.BackendErrorRedesign) && !errors.Is(err, &backoff.PermanentError{}) && be.Backend.IsPermanentError(err) {internal/fs/node_unix_test.go1
75:5time-value-equality
internal/fs/node_unix_test.go:75:5
} if node.AccessTime != s.AccessTime { t.Errorf("AccessTime does not match, want %v, got %v", s.AccessTime, node.AccessTime)cmd/restic/cmd_backup_integration_test.go1
145:1top-level-declaration-order
cmd/restic/cmd_backup_integration_test.go:145:1
type vssDeleteOriginalFS struct { fs.FSinternal/archiver/buffer.go1
46:24unchecked-type-assertion
internal/archiver/buffer.go:46:24
func (pool *bufferPool) Get() *buffer { return pool.pool.Get().(*buffer)}internal/backend/limiter/static_limiter_test.go1
129:2unclosed-http-response-body
internal/backend/limiter/static_limiter_test.go:129:2
res, err := rt.RoundTrip(&http.Request{}) test.OK(t, err)internal/archiver/tree_saver.go1
46:141unexported-return
internal/archiver/tree_saver.go:46:141
// Save stores the dir d and returns the data once it has been completed.func (s *treeSaver) Save(ctx context.Context, snPath string, target string, node *data.Node, nodes []futureNode, complete fileCompleteFunc) futureNode { fn, ch := newFutureNode()internal/archiver/tree_saver_test.go1
22:85unused-parameter
internal/archiver/tree_saver_test.go:22:85
func (m *mockSaver) SaveBlobAsync(_ context.Context, _ restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool, cb func(newID restic.ID, known bool, sizeInRepo int, err error)) { // Fake async operationcmd/restic/cmd_ls.go1
189:7unused-receiver
cmd/restic/cmd_ls.go:189:7
func (p *jsonLsPrinter) LeaveDir(_ string) error { return nil }func (p *jsonLsPrinter) Close() error { return nil }cmd/restic/cmd_backup.go1
184:68use-any
cmd/restic/cmd_backup.go:184:68
// ErrNoSourceData if none remain, or ErrInvalidSourceData if some were skipped.func filterExisting(items []string, warnf func(msg string, args ...interface{})) (result []string, err error) { for _, item := range items {cmd/restic/cmd_key_add.go1
61:10use-errors-new
cmd/restic/cmd_key_add.go:61:10
if len(args) > 0 { return fmt.Errorf("the key add command expects no arguments, only options - please see `restic help key add` for usage and flags") }cmd/restic/cmd_snapshots.go1
174:2use-slices-sort
cmd/restic/cmd_snapshots.go:174:2
// Sort the snapshots so that the newer ones are listed first sort.SliceStable(list, func(i, j int) bool { return list[i].Time.After(list[j].Time)internal/fs/const.go1
10:2var-naming
internal/fs/const.go:10:2
O_WRONLY int = syscall.O_WRONLY // open the file write-only. O_RDWR int = syscall.O_RDWR // open the file read-write. O_APPEND int = syscall.O_APPEND // append data to the file when writing.internal/backend/gs/gs.go1
187:9weak-cryptography
internal/backend/gs/gs.go:187:9
func (be *gs) Hasher() hash.Hash { return md5.New()}cmd/restic/cmd_backup.go1
128:62add-constant
cmd/restic/cmd_backup.go:128:62
f.StringArrayVar(&opts.FilesFromVerbatim, "files-from-verbatim", nil, "read the files to backup from `file` (can be combined with file args; can be specified multiple times)") f.StringArrayVar(&opts.FilesFromRaw, "files-from-raw", nil, "read the files to backup from `file` (can be combined with file args; can be specified multiple times)") f.StringVar(&opts.TimeStamp, "time", "", "`time` of the backup (ex. '2012-11-01 22:08:41') (default: now)")internal/fs/stat_windows_test.go1
31:18boolean-literal-comparison
internal/fs/stat_windows_test.go:31:18
rtest.Assert(t, err == nil, "err should be nil", err) rtest.Assert(t, recall == false, "RecallOnDataAccess should be false")}internal/repository/repository.go1
733:2call-to-gc
internal/repository/repository.go:733:2
// Trigger GC to reset garbage collection threshold runtime.GC()cmd/restic/cmd_backup.go1
273:6cognitive-complexity
cmd/restic/cmd_backup.go:273:6
func readFilenamesRaw(r io.Reader) (names []string, err error) { br := bufio.NewReader(r)cmd/restic/cmd_repair_index_integration_test.go1
61:6confusing-naming
cmd/restic/cmd_repair_index_integration_test.go:61:6
func TestRebuildIndex(t *testing.T) { testRebuildIndex(t, nil)cmd/restic/integration_helpers_test.go1
426:146confusing-results
cmd/restic/integration_helpers_test.go:426:146
func withCaptureStdoutStderr(t testing.TB, gopts global.Options, callback func(ctx context.Context, gopts global.Options) error) (*bytes.Buffer, *bytes.Buffer, error) { bufStdout := bytes.NewBuffer(nil)internal/fs/fs_local.go1
21:6constructor-interface-return
internal/fs/fs_local.go:21:6
// NewLocal returns an FS for the local file system. Most methods are just passed on to the stdlib.func NewLocal() FS { return local{}cmd/restic/cmd_backup.go1
407:6cyclomatic-complexity
cmd/restic/cmd_backup.go:407:6
// collectTargets returns a list of target files/dirs from several sources.func collectTargets(opts BackupOptions, args []string, warnf func(msg string, args ...interface{}), stdin io.ReadCloser) (targets []string, err error) { if opts.Stdin || opts.StdinCommand {helpers/prepare-release/main.go1
52:2deep-exit
helpers/prepare-release/main.go:52:2
fmt.Fprintf(os.Stderr, f, args...) os.Exit(1)}cmd/restic/cmd_backup.go1
146:24discarded-error-result
cmd/restic/cmd_backup.go:146:24
// parse read inode and ctime from env, on error the default value will be used opts.IgnoreInode, _ = strconv.ParseBool(os.Getenv("RESTIC_IGNORE_INODE")) opts.IgnoreCtime, _ = strconv.ParseBool(os.Getenv("RESTIC_IGNORE_CTIME"))cmd/restic/cmd_ls.go1
198:1doc-comment-period
cmd/restic/cmd_ls.go:198:1
// It opens the JSON list. Nodes are added with lsNodeNcdu and the list is closed by lsCloseNcdu.// Format documentation: https://dev.yorhel.nl/ncdu/jsonfmtfunc (p *ncduLsPrinter) Snapshot(sn *data.Snapshot) error {internal/archiver/file_saver.go1
148:3early-return
internal/archiver/file_saver.go:148:3
split := chnker.NextSplitPoint(s.readBuf[s.bpos:s.bmax]) if split == -1 { data = append(data, s.readBuf[s.bpos:s.bmax]...)cmd/restic/cmd_mount_integration_test.go1
147:14error-strings
cmd/restic/cmd_mount_integration_test.go:147:14
if !ok { t.Errorf("Snapshot %v (%q) isn't present in fuse dir", id.Str(), ts) }internal/repository/checker.go1
56:6error-type-naming
internal/repository/checker.go:56:6
// Errors of the actual pack data are returned as ErrPackData.type ErrPackMetadata struct { ID restic.IDinternal/repository/debug.go1
356:5excessive-blank-identifiers
internal/repository/debug.go:356:5
if opts.ReuploadBlobs { _, _, _, err := uploader.SaveBlob(ctx, blob.Type, plaintext, id, true) if err != nil {cmd/restic/cmd_diff.go1
90:6exported-declaration-comment
cmd/restic/cmd_diff.go:90:6
type Change struct { MessageType string `json:"message_type"` // "change"cmd/restic/cmd_find.go1
1:1file-length-limit
cmd/restic/cmd_find.go:1:1
package maincmd/restic/cmd_ls.go1
302:55flag-parameter
cmd/restic/cmd_ls.go:302:55
}func (p *textLsPrinter) NodeOutput(node lsNodeOutput, isPrefixDirectory bool) error { if !isPrefixDirectory {cmd/restic/cmd_backup_test.go1
1:1format
cmd/restic/cmd_backup_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_backup_test.go`
cmd/restic/cmd_cat.go1
70:6function-length
cmd/restic/cmd_cat.go:70:6
func runCat(ctx context.Context, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(gopts.JSON, gopts.Verbosity, term)cmd/restic/lock.go1
41:6function-result-limit
cmd/restic/lock.go:41:6
func openWithAppendLock(ctx context.Context, gopts global.Options, dryRun bool, printer restic.Printer) (context.Context, *repository.Repository, func(), error) { // TODO enforce non-exclusive operations once the locking code has moved to the repositoryinternal/archiver/archiver.go1
644:2identical-switch-branches
internal/archiver/archiver.go:644:2
return true case !fi.ModTime.Equal(node.ModTime): return truecmd/restic/cmd_backup.go1
359:63import-shadowing
cmd/restic/cmd_backup.go:359:63
// from being saved in a snapshot based on path and file infofunc collectRejectFuncs(opts BackupOptions, targets []string, fs fs.FS, warnf func(msg string, args ...interface{})) (funcs []archiver.RejectFunc, err error) { // allowed devicescmd/restic/cmd_stats.go1
278:8inefficient-map-lookup
cmd/restic/cmd_stats.go:278:8
if _, ok := stats.fileBlobs[nodePath]; !ok { stats.fileBlobs[nodePath] = restic.NewIDSet() stats.TotalFileCount++internal/backend/rest/config_test.go1
23:26insecure-url-scheme
internal/backend/rest/config_test.go:23:26
Cfg: Config{ URL: parseURL("http://localhost:1234/"), Connections: 5,internal/restic/repository.go1
15:17interface-method-limit
internal/restic/repository.go:15:17
// transparently encrypts/decrypts data.type Repository interface { // Connections returns the maximum number of concurrent backend operationsinternal/data/snapshot_find.go1
170:12max-control-nesting
internal/data/snapshot_find.go:170:12
err = ErrInvalidSnapshotSyntax } else if err == nil { if ids.Has(*sn.ID()) {internal/global/global.go1
561:6max-parameters
internal/global/global.go:561:6
// createOrOpenBackend creates or opens a backend using the appropriate factory method.func createOrOpenBackend(ctx context.Context, scheme string, cfg interface{}, rt http.RoundTripper, lim limiter.Limiter, gopts Options, s string, create bool, printer restic.Printer) (backend.Backend, error) { factory := gopts.Backends.Lookup(scheme)internal/fs/vss_windows.go1
730:6max-public-structs
internal/fs/vss_windows.go:730:6
// IVssEnumObject VSS api interface.type IVssEnumObject struct { ole.IUnknowncmd/restic/cmd_backup.go1
391:3modifies-parameter
cmd/restic/cmd_backup.go:391:3
if opts.ExcludeCaches { opts.ExcludeIfPresent = append(opts.ExcludeIfPresent, "CACHEDIR.TAG:Signature: 8a477f597d28d172789f06886806bc55") }internal/archiver/archiver_test.go1
2479:3modifies-value-receiver
internal/archiver/archiver_test.go:2479:3
if f.ofs.resetFIOnRead { f.ofs.overrideFI = nil }cmd/restic/cmd_check_test.go1
18:17nested-structs
cmd/restic/cmd_check_test.go:18:17
func TestParsePercentage(t *testing.T) { testCases := []struct { input stringcmd/restic/cmd_find.go1
488:4nil-error-return
cmd/restic/cmd_find.go:488:4
// ignore error to allow fallback to index return nil }internal/data/tree.go1
172:3nil-value-with-nil-error
internal/data/tree.go:172:3
if t.next == nil { return nil, nil }cmd/restic/cmd_mount.go1
233:4no-else-after-return
cmd/restic/cmd_mount.go:233:4
return errors.Fatal(fmt.Sprintf("mountpoint %s is inaccessible: %v", mountpoint, err)) } else if !stat.IsDir() { return errors.Fatal(fmt.Sprintf("mountpoint %s is not a directory", mountpoint))internal/backend/azure/config.go1
36:6no-init
internal/backend/azure/config.go:36:6
func init() { options.Register("azure", Config{})cmd/restic/cmd_generate.go1
93:2no-naked-return
cmd/restic/cmd_generate.go:93:2
err = generate(outWriter) return}build.go1
78:2no-package-var
build.go:78:2
runTests bool enableCGO bool enablePIE boolcmd/restic/cmd_cache.go1
1:9package-comments
cmd/restic/cmd_cache.go:1:9
package maininternal/archiver/archiver_test.go1
2387:16range-value-address
internal/archiver/archiver_test.go:2387:16
testErr := context.Canceled testRepo := &failSaveRepo{ archiverRepo: repo,internal/backend/watchdog_roundtriper.go1
80:74redefines-builtin-id
internal/backend/watchdog_roundtriper.go:80:74
func newWatchdogReadCloser(rc io.ReadCloser, chunkSize int, kick func(), close func(), isTimeout func(err error) bool) *watchdogReadCloser { return &watchdogReadCloser{cmd/restic/cmd_copy.go1
337:15redundant-conversion
cmd/restic/cmd_copy.go:337:15
countBlobs := 0 sizeBlobs := uint64(0) for blob := range copyBlobs.Keys() {cmd/restic/cmd_forget.go1
392:6slice-preallocation
cmd/restic/cmd_forget.go:392:6
func asJSONKeeps(list []data.KeepReason) []KeepReason { var resultList []KeepReason for _, keep := range list {internal/backend/watchdog_roundtriper_test.go1
91:46standard-http-method-constant
internal/backend/watchdog_roundtriper_test.go:91:46
cancel() req, err := http.NewRequestWithContext(ctx, "GET", "http://some.random.url.dfdgsfg", nil) rtest.OK(t, err)internal/dump/tar.go1
109:3task-comment
internal/dump/tar.go:109:3
// // TODO support ACLs from other operating systems. // FreeBSD ACLs have names "posix1e.acl_(access|default)",cmd/restic/cmd_cache.go1
48:1top-level-declaration-order
cmd/restic/cmd_cache.go:48:1
// CacheOptions bundles all options for the snapshots command.type CacheOptions struct { Cleanup boolinternal/archiver/testing_test.go1
334:38unchecked-type-assertion
internal/archiver/testing_test.go:334:38
if test.expectFailure && !subtestT.(*MockT).HasFailed { t.Fatal("expected failure of TestEnsureFiles not found")internal/backend/rest/rest.go1
103:2unclosed-http-response-body
internal/backend/rest/rest.go:103:2
resp, err := be.client.Post(url.String(), "binary/octet-stream", strings.NewReader("")) if err != nil {internal/repository/index/indexmap.go1
278:36unexported-return
internal/repository/index/indexmap.go:278:36
func (h *hashedArrayTree) Alloc() (*indexEntry, uint) { h.grow()internal/archiver/tree_saver_test.go1
22:99unused-parameter
internal/archiver/tree_saver_test.go:22:99
func (m *mockSaver) SaveBlobAsync(_ context.Context, _ restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool, cb func(newID restic.ID, known bool, sizeInRepo int, err error)) { // Fake async operationcmd/restic/cmd_ls.go1
309:7unused-receiver
cmd/restic/cmd_ls.go:309:7
func (p *textLsPrinter) LeaveDir(_ string) error { return nilcmd/restic/cmd_backup.go1
335:111use-any
cmd/restic/cmd_backup.go:335:111
// from being saved in a snapshot based on path onlyfunc collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository, warnf func(msg string, args ...interface{})) (fs []archiver.RejectByNameFunc, err error) { // exclude restic cachecmd/restic/cmd_key_add.go1
105:15use-errors-new
cmd/restic/cmd_key_add.go:105:15
if newPasswordFile != "" { return "", fmt.Errorf("only either --new-password-file or --new-insecure-no-password may be specified") }cmd/restic/cmd_snapshots.go1
195:2use-slices-sort
cmd/restic/cmd_snapshots.go:195:2
// Sort the snapshots so that the newer ones are listed first sort.SliceStable(list, func(i, j int) bool { return list[i].Time.After(list[j].Time)internal/fs/const.go1
11:2var-naming
internal/fs/const.go:11:2
O_RDWR int = syscall.O_RDWR // open the file read-write. O_APPEND int = syscall.O_APPEND // append data to the file when writing. O_CREATE int = syscall.O_CREAT // create a new file if none exists.internal/backend/rewind_reader_test.go1
19:42weak-cryptography
internal/backend/rewind_reader_test.go:19:42
buf := []byte("foobar") for _, hasher := range []hash.Hash{nil, md5.New()} { fn := func() RewindReader {cmd/restic/cmd_backup.go1
308:19add-constant
cmd/restic/cmd_backup.go:308:19
for _, filename := range filesFrom { if filename == "-" { return errors.Fatal("unable to read password from stdin when data is to be read from stdin, use --password-file or $RESTIC_PASSWORD")internal/fs/stat_windows_test.go1
79:18boolean-literal-comparison
internal/fs/stat_windows_test.go:79:18
rtest.Assert(t, err == nil, "err should be nil", err) rtest.Assert(t, recall == false, "RecallOnDataAccess should be false")}cmd/restic/cmd_backup.go1
300:27cognitive-complexity
cmd/restic/cmd_backup.go:300:27
// Check returns an error when an invalid combination of options was set.func (opts BackupOptions) Check(gopts global.Options, args []string) error { if gopts.Password == "" && !gopts.InsecureNoPassword {cmd/restic/cmd_rewrite_integration_test.go1
182:6confusing-naming
cmd/restic/cmd_rewrite_integration_test.go:182:6
func TestRewriteMetadata(t *testing.T) { newHost := "new host"internal/archiver/archiver_unix_test.go1
14:81confusing-results
internal/archiver/archiver_unix_test.go:14:81
func statAndSnapshot(t *testing.T, repo archiverRepo, name string) (*data.Node, *data.Node) { want := nodeFromFile(t, fs.NewLocal(), name)internal/fs/fs_reader.go1
45:6constructor-interface-return
internal/fs/fs_reader.go:45:6
// the provided FileInfo is returned.func NewReader(name string, r io.ReadCloser, opts ReaderOptions) (FS, error) { items := make(map[string]readerItem)cmd/restic/cmd_backup.go1
498:6cyclomatic-complexity
cmd/restic/cmd_backup.go:498:6
func runBackup(ctx context.Context, opts BackupOptions, gopts global.Options, term ui.Terminal, args []string) error { var vsscfg fs.VSSConfiginternal/debug/debug.go1
50:3deep-exit
internal/debug/debug.go:50:3
fmt.Fprintf(os.Stderr, "unable to open debug log file: %v\n", err) os.Exit(2) }cmd/restic/cmd_backup.go1
147:24discarded-error-result
cmd/restic/cmd_backup.go:147:24
opts.IgnoreInode, _ = strconv.ParseBool(os.Getenv("RESTIC_IGNORE_INODE")) opts.IgnoreCtime, _ = strconv.ParseBool(os.Getenv("RESTIC_IGNORE_CTIME"))cmd/restic/cmd_ls.go1
579:1doc-comment-period
cmd/restic/cmd_ls.go:579:1
// SortMode defines the allowed sorting modestype SortMode uintinternal/backend/backend.go1
115:3early-return
internal/backend/backend.go:115:3
if be, ok := b.(Unwrapper); ok { b = be.Unwrap()cmd/restic/cmd_mount_integration_test.go1
154:15error-strings
cmd/restic/cmd_mount_integration_test.go:154:15
if !ok { t.Errorf("Snapshot %v (%q) isn't present in fuse dir", id.Str(), ts) }internal/repository/checker.go1
69:6error-type-naming
internal/repository/checker.go:69:6
// ErrPackData is returned if errors are discovered while verifying a packfiletype ErrPackData struct { PackID restic.IDinternal/repository/fuzz_test.go1
24:4excessive-blank-identifiers
internal/repository/fuzz_test.go:24:4
rtest.OK(t, repo.WithBlobUploader(context.TODO(), func(ctx context.Context, uploader restic.BlobSaverWithAsync) error { _, _, _, err := uploader.SaveBlob(ctx, restic.DataBlob, blob, id, false) return errcmd/restic/cmd_diff.go1
150:6exported-declaration-comment
cmd/restic/cmd_diff.go:150:6
type DiffStatsContainer struct { MessageType string `json:"message_type"` // "statistics"cmd/restic/cmd_ls.go2
1:1file-length-limit
cmd/restic/cmd_ls.go:1:1
package main507:55flag-parameter
cmd/restic/cmd_ls.go:507:55
}func (p *sortedPrinter) NodeOutput(node lsNodeOutput, isPrefixDirectory bool) error { if !isPrefixDirectory {cmd/restic/cmd_cache.go1
1:1format
cmd/restic/cmd_cache.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_cache.go`
cmd/restic/cmd_check.go1
229:6function-length
cmd/restic/cmd_check.go:229:6
func runCheck(ctx context.Context, opts CheckOptions, gopts global.Options, args []string, term ui.Terminal) (checkSummary, error) { summary := checkSummary{MessageType: "summary"}cmd/restic/lock.go1
46:6function-result-limit
cmd/restic/lock.go:46:6
func openWithExclusiveLock(ctx context.Context, gopts global.Options, dryRun bool, printer restic.Printer) (context.Context, *repository.Repository, func(), error) { return internalOpenWithLocked(ctx, gopts, dryRun, true, printer)internal/archiver/archiver.go1
654:2identical-switch-branches
internal/archiver/archiver.go:654:2
return true case checkInode && node.Inode != fi.Inode: return truecmd/restic/cmd_backup_integration_test.go1
186:26import-shadowing
cmd/restic/cmd_backup_integration_test.go:186:26
var testFS *vssDeleteOriginalFS backupFSTestHook = func(fs fs.FS) fs.FS { testFS = &vssDeleteOriginalFS{cmd/restic/integration_helpers_test.go1
365:4inefficient-map-lookup
cmd/restic/integration_helpers_test.go:365:4
if _, ok := old[k]; !ok { old[k] = struct{}{} return old, kinternal/backend/rest/config_test.go1
30:26insecure-url-scheme
internal/backend/rest/config_test.go:30:26
Cfg: Config{ URL: parseURL("http://localhost:1234/"), Connections: 5,internal/ui/backup/progress.go1
14:22interface-method-limit
internal/ui/backup/progress.go:14:22
// It must be safe to call its methods from concurrent goroutines.type ProgressPrinter interface { Update(total, processed Counter, errors uint, currentFiles map[string]struct{}, start time.Time, secs uint64)internal/data/snapshot_find.go1
171:6max-control-nesting
internal/data/snapshot_find.go:171:6
} else if err == nil { if ids.Has(*sn.ID()) { continueinternal/restorer/filerestorer.go1
67:6max-parameters
internal/restorer/filerestorer.go:67:6
func newFileRestorer(dst string, blobsLoader blobsLoaderFn,internal/fs/vss_windows.go1
736:6max-public-structs
internal/fs/vss_windows.go:736:6
// nolint:structchecktype IVssEnumObjectVTable struct { ole.IUnknownVtblcmd/restic/cmd_backup_integration_test.go1
33:3modifies-parameter
cmd/restic/cmd_backup_integration_test.go:33:3
opts.GroupBy = data.SnapshotGroupByOptions{Host: true, Path: true} return runBackup(ctx, opts, gopts, gopts.Term, target)internal/backend/retry/backend_retry_test.go1
236:2modifies-value-receiver
internal/backend/retry/backend_retry_test.go:236:2
} r.pos += i if r.pos >= r.limit {cmd/restic/cmd_check_test.go1
49:17nested-structs
cmd/restic/cmd_check_test.go:49:17
func TestStringToIntSlice(t *testing.T) { testCases := []struct { input stringcmd/restic/cmd_key_list.go1
76:4nil-error-return
cmd/restic/cmd_key_list.go:76:4
printer.E("LoadKey() failed: %v", err) return nil }internal/data/tree.go1
185:4nil-value-with-nil-error
internal/data/tree.go:185:4
if !ok { return nil, nil }cmd/restic/cmd_prune.go1
155:5no-else-after-return
cmd/restic/cmd_prune.go:155:5
return errors.Fatalf("invalid number of bytes %q for --repack-smaller-than: %v", opts.SmallPackSize, err) } else if size <= 0 { return errors.Fatalf("--repack-smaller-than must be larger than zero")internal/backend/b2/config.go1
32:6no-init
internal/backend/b2/config.go:32:6
func init() { options.Register("b2", Config{})cmd/restic/cmd_snapshots_integration_test.go1
35:2no-naked-return
cmd/restic/cmd_snapshots_integration_test.go:35:2
} return}build.go1
79:2no-package-var
build.go:79:2
enableCGO bool enablePIE bool goVersion = ParseGoVersion(runtime.Version())cmd/restic/cmd_cat.go1
1:9package-comments
cmd/restic/cmd_cat.go:1:9
package maininternal/archiver/archiver_test.go1
2773:34range-value-address
internal/archiver/archiver_test.go:2773:34
for _, errorOnOpen := range []bool{false, true} { arch := New(repo, fs.Track{FS: &missingFS{FS: fs.NewLocal(), errorOnOpen: errorOnOpen}}, Options{}) _, excluded, err := arch.save(ctx, "/", filepath.Join(tempdir, "testdir"), nil, false)internal/backend/watchdog_roundtriper.go1
94:2redefines-builtin-id
internal/backend/watchdog_roundtriper.go:94:2
kick func() close func() isTimeout func(err error) boolcmd/restic/cmd_copy.go1
347:30redundant-conversion
cmd/restic/cmd_copy.go:347:30
printer.V(" copy %d blobs with disk size %s in %d packfiles\n", countBlobs, ui.FormatBytes(uint64(sizeBlobs)), len(packList)) return sizeBlobscmd/restic/cmd_snapshots.go1
378:3slice-preallocation
cmd/restic/cmd_snapshots.go:378:3
if grouped { snapshotGroups := []SnapshotGroup{}internal/backend/watchdog_roundtriper_test.go1
134:57standard-http-method-constant
internal/backend/watchdog_roundtriper_test.go:134:57
rt := newWatchdogRoundtripper(http.DefaultTransport, 10*time.Millisecond, 1024) req, err := http.NewRequestWithContext(context.TODO(), "GET", srv.URL, io.NopCloser(newSlowReader(bytes.NewReader(msg), 100*time.Millisecond))) rtest.OK(t, err)internal/fs/const_windows.go1
5:1task-comment
internal/fs/const_windows.go:5:1
// TODO honor flags when opening filescmd/restic/cmd_check.go1
75:1top-level-declaration-order
cmd/restic/cmd_check.go:75:1
// CheckOptions bundles all options for the 'check' command.type CheckOptions struct { ReadData boolinternal/archiver/testing_test.go1
490:38unchecked-type-assertion
internal/archiver/testing_test.go:490:38
if test.expectFailure && !subtestT.(*MockT).HasFailed { t.Fatal("expected failure of TestEnsureSnapshot not found")internal/backend/rest/rest.go1
156:2unclosed-http-response-body
internal/backend/rest/rest.go:156:2
resp, err := b.client.Do(req) if err != nil {internal/repository/index/indexmap.go1
292:41unexported-return
internal/repository/index/indexmap.go:292:41
func (h *hashedArrayTree) Ref(pos uint) *indexEntry { if pos >= h.size {internal/backend/layout/testing.go1
7:29unused-parameter
internal/backend/layout/testing.go:7:29
func TestDisablePackSubdirs(t testing.TB) { disablePackSubdirs = truecmd/restic/cmd_ls.go1
312:7unused-receiver
cmd/restic/cmd_ls.go:312:7
}func (p *textLsPrinter) Close() error { return nilcmd/restic/cmd_backup.go1
359:104use-any
cmd/restic/cmd_backup.go:359:104
// from being saved in a snapshot based on path and file infofunc collectRejectFuncs(opts BackupOptions, targets []string, fs fs.FS, warnf func(msg string, args ...interface{})) (funcs []archiver.RejectFunc, err error) { // allowed devicescmd/restic/cmd_key_add.go1
116:15use-errors-new
cmd/restic/cmd_key_add.go:116:15
if password == "" { return "", fmt.Errorf("an empty password is not allowed by default. Pass the flag `--new-insecure-no-password` to restic to disable this check") }cmd/restic/cmd_snapshots.go1
220:2use-slices-sort
cmd/restic/cmd_snapshots.go:220:2
// always sort the snapshots so that the newer ones are listed last sort.SliceStable(list, func(i, j int) bool { return list[i].Time.Before(list[j].Time)internal/fs/const.go1
12:2var-naming
internal/fs/const.go:12:2
O_APPEND int = syscall.O_APPEND // append data to the file when writing. O_CREATE int = syscall.O_CREAT // create a new file if none exists. O_EXCL int = syscall.O_EXCL // used with O_CREATE, file must not existinternal/backend/rewind_reader_test.go1
49:42weak-cryptography
internal/backend/rewind_reader_test.go:49:42
for _, hasher := range []hash.Hash{nil, md5.New()} { fn := func() RewindReader {cmd/restic/cmd_backup.go1
508:21add-constant
cmd/restic/cmd_backup.go:508:21
} if runtime.GOOS == "windows" { if vsscfg, err = fs.ParseVSSConfig(gopts.Extended); err != nil {internal/repository/lock_test.go1
344:18boolean-literal-comparison
internal/repository/lock_test.go:344:18
rtest.Assert(t, lockExists(repo, t, id1) == false, "stale lock still exists after RemoveStaleLocks was called")cmd/restic/cmd_backup.go1
359:6cognitive-complexity
cmd/restic/cmd_backup.go:359:6
// from being saved in a snapshot based on path and file infofunc collectRejectFuncs(opts BackupOptions, targets []string, fs fs.FS, warnf func(msg string, args ...interface{})) (funcs []archiver.RejectFunc, err error) { // allowed devicesinternal/archiver/scanner.go1
100:19confusing-naming
internal/archiver/scanner.go:100:19
// explicit is true when this path was an explicit backup target (same meaning as tree.Explicit on a leaf).func (s *Scanner) scan(ctx context.Context, stats ScanStats, target string, explicit bool) (ScanStats, error) { if ctx.Err() != nil {internal/archiver/exclude.go1
72:50confusing-results
internal/archiver/exclude.go:72:50
// method, otherwise data races may occur.func (rc *rejectionCache) Get(dir string) (bool, bool) { v, ok := rc.m[dir]internal/restic/progress.go1
70:6constructor-interface-return
internal/restic/progress.go:70:6
// NewNoopPrinter returns a Printer that discards all messages.func NewNoopPrinter() Printer { return &noopPrinter{}cmd/restic/cmd_cache.go1
60:6cyclomatic-complexity
cmd/restic/cmd_cache.go:60:6
func runCache(opts CacheOptions, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)internal/debug/debug.go1
80:4deep-exit
internal/debug/debug.go:80:4
fmt.Fprintf(os.Stderr, "error: invalid pattern %q: %v\n", t, err) os.Exit(5) }cmd/restic/cmd_backup.go1
261:7discarded-error-result
cmd/restic/cmd_backup.go:261:7
// ignore subsequent errors _ = f.Close() return nil, errcmd/restic/cmd_ls.go1
582:1doc-comment-period
cmd/restic/cmd_ls.go:582:1
// Allowed sort modesconst (internal/backend/retry/backend_retry.go1
207:3early-return
internal/backend/retry/backend_retry.go:207:3
if v, ok := be.failedLoads.Load(key); ok { if time.Since(v.(time.Time)) > failedLoadExpiry { be.failedLoads.Delete(key)cmd/restic/cmd_repair_index_integration_test.go1
111:23error-strings
cmd/restic/cmd_repair_index_integration_test.go:111:23
func (b *appendOnlyBackend) Remove(_ context.Context, h backend.Handle) error { return errors.Errorf("Failed to remove %v", h)}internal/repository/index_list_test.go1
49:4excessive-blank-identifiers
internal/repository/index_list_test.go:49:4
for range 5 { _, _, _, err := uploader.SaveBlob(ctx, restic.DataBlob, []byte("test"), restic.ID{}, false) rtest.OK(t, err)cmd/restic/cmd_find_integration_test.go1
151:6exported-declaration-comment
cmd/restic/cmd_find_integration_test.go:151:6
// JsonOutput is the struct `restic find --json` producestype JSONOutput struct { ObjectType string `json:"object_type"`cmd/restic/cmd_stats.go1
1:1file-length-limit
cmd/restic/cmd_stats.go:1:1
package maincmd/restic/cmd_prune_integration_test.go1
42:38flag-parameter
cmd/restic/cmd_prune_integration_test.go:42:38
func testPruneVariants(t *testing.T, unsafeNoSpaceRecovery bool) { suffix := ""cmd/restic/cmd_cat.go1
1:1format
cmd/restic/cmd_cat.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_cat.go`
cmd/restic/cmd_diff.go1
243:20function-length
cmd/restic/cmd_diff.go:243:20
func (c *Comparer) diffTree(ctx context.Context, stats *DiffStatsContainer, prefix string, id1, id2 restic.ID) error { debug.Log("diffing %v to %v", id1, id2)internal/archiver/archiver.go1
883:23function-result-limit
internal/archiver/archiver.go:883:23
// Snapshot saves several targets and returns a snapshot.func (arch *Archiver) Snapshot(ctx context.Context, targets []string, opts SnapshotOptions) (*data.Snapshot, restic.ID, *Summary, error) { arch.summary = &Summary{internal/fs/node.go1
95:2identical-switch-branches
internal/fs/node.go:95:2
node.Links = stat.Links case data.NodeTypeCharDev: node.Device = stat.Devicecmd/restic/cmd_diff.go1
96:16import-shadowing
cmd/restic/cmd_diff.go:96:16
func NewChange(path string, mode string) *Change { return &Change{MessageType: "change", Path: path, Modifier: mode}internal/archiver/tree.go1
249:6inefficient-map-lookup
internal/archiver/tree.go:249:6
node.Path = f.Join(t.Path, entry) t.Nodes[entry] = node continueinternal/backend/rest/rest_test.go1
136:33insecure-url-scheme
internal/backend/rest/rest_test.go:136:33
// while we may listen on 0.0.0.0, we connect to localhost addrToConnectTo = fmt.Sprintf("http://%s/restic-test/", strings.Replace(actualListenAddr, "0.0.0.0", "localhost", 1)) }internal/ui/restore/progress.go1
40:22interface-method-limit
internal/ui/restore/progress.go:40:22
type ProgressPrinter interface { Update(progress State, duration time.Duration)internal/data/snapshot_policy.go1
281:7max-control-nesting
internal/data/snapshot_policy.go:281:7
keepSnap = true if val == b.Last && nr == len(list)-1 { b.reason = fmt.Sprintf("oldest %v", b.reason)internal/repository/checker.go1
79:6max-public-structs
internal/repository/checker.go:79:6
// Checker handles index-related operations for repository checking.type Checker struct { repo *Repositorycmd/restic/cmd_backup_integration_test.go1
119:3modifies-parameter
cmd/restic/cmd_backup_integration_test.go:119:3
} path = vol[:len(vol)-1] + string(filepath.Separator) + path[len(vol)+1:] path = filepath.ToSlash(path)internal/data/node.go1
168:2modifies-value-receiver
internal/data/node.go:168:2
// something we can actually save. node.ModTime = fixTime(node.ModTime) node.AccessTime = fixTime(node.AccessTime)cmd/restic/cmd_check_test.go1
189:17nested-structs
cmd/restic/cmd_check_test.go:189:17
testCases := []struct { opts CheckOptionscmd/restic/cmd_mount.go1
294:3nil-error-return
cmd/restic/cmd_mount.go:294:3
if err != nil { return abs, nil }internal/data/tree.go1
197:2nil-value-with-nil-error
internal/data/tree.go:197:2
// we have already passed the name return nil, nil}cmd/restic/cmd_rewrite.go1
297:4no-else-after-return
cmd/restic/cmd_rewrite.go:297:4
return errors.Fatal("Nothing to do: no excludes/includes provided and no new metadata provided") } else if hasExcludes && hasIncludes { return errors.Fatal("exclude and include patterns are mutually exclusive")internal/backend/gs/config.go1
33:6no-init
internal/backend/gs/config.go:33:6
func init() { options.Register("gs", Config{})internal/backend/layout/layout_default.go1
91:2no-naked-return
internal/backend/layout/layout_default.go:91:2
dirname = l.join(l.path, defaultLayoutPaths[t]) return}build.go1
80:2no-package-var
build.go:80:2
enablePIE bool goVersion = ParseGoVersion(runtime.Version()))cmd/restic/cmd_check.go1
1:9package-comments
cmd/restic/cmd_check.go:1:9
package maininternal/archiver/tree.go1
266:24range-value-address
internal/archiver/tree.go:266:24
for i, subtree := range t.Nodes { err := unrollTree(f, &subtree) if err != nil {internal/data/tree_stream.go1
54:29redefines-builtin-id
internal/data/tree_stream.go:54:29
in <-chan trackedID, process func(id restic.ID, error error, nodes TreeNodeIterator) error, out chan<- trackedTreeItem,cmd/restic/cmd_forget_test.go1
17:9redundant-conversion
cmd/restic/cmd_forget_test.go:17:9
}{ {"0", ForgetPolicyCount(0), ""}, {"1", ForgetPolicyCount(1), ""},cmd/restic/cmd_snapshots.go1
383:8slice-preallocation
cmd/restic/cmd_snapshots.go:383:8
var err error var snapshots []Snapshotinternal/backend/watchdog_roundtriper_test.go1
161:57standard-http-method-constant
internal/backend/watchdog_roundtriper_test.go:161:57
rt := newWatchdogRoundtripper(http.DefaultTransport, 10*time.Millisecond, 1024) req, err := http.NewRequestWithContext(context.TODO(), "GET", srv.URL, io.NopCloser(bytes.NewReader(msg))) rtest.OK(t, err)internal/fs/fs_local_vss.go1
258:3task-comment
internal/fs/fs_local_vss.go:258:3
// -> try to backup without a snapshot // TODO: log warning? snapshotPath = pathcmd/restic/cmd_copy.go1
65:1top-level-declaration-order
cmd/restic/cmd_copy.go:65:1
// CopyOptions bundles all options for the copy command.type CopyOptions struct { global.SecondaryRepoOptionsinternal/backend/location/location_test.go1
56:42unchecked-type-assertion
internal/backend/location/location_test.go:56:42
test.Equals(t, "local", u.Scheme) test.Equals(t, "local:"+path, u.Config.(*testConfig).loc) })internal/backend/rest/rest.go1
263:2unclosed-http-response-body
internal/backend/rest/rest.go:263:2
resp, err := b.client.Do(req) if err != nil {internal/repository/repository.go1
1287:36unexported-return
internal/repository/repository.go:1287:36
// Next returns the next blob, an error or ErrPackEOF if all blobs were readfunc (b *packBlobIterator) Next() (packBlobValue, error) { if len(b.blobs) == 0 {internal/fs/node_freebsd.go1
10:35unused-parameter
internal/fs/node_freebsd.go:10:35
func nodeRestoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error { return nilcmd/restic/cmd_ls.go1
514:7unused-receiver
cmd/restic/cmd_ls.go:514:7
func (p *sortedPrinter) LeaveDir(_ string) error { return nilcmd/restic/cmd_backup.go1
407:87use-any
cmd/restic/cmd_backup.go:407:87
// collectTargets returns a list of target files/dirs from several sources.func collectTargets(opts BackupOptions, args []string, warnf func(msg string, args ...interface{}), stdin io.ReadCloser) (targets []string, err error) { if opts.Stdin || opts.StdinCommand {cmd/restic/cmd_key_list.go1
46:10use-errors-new
cmd/restic/cmd_key_list.go:46:10
if len(args) > 0 { return fmt.Errorf("the key list command expects no arguments, only options - please see `restic help key list` for usage and flags") }internal/feature/features.go1
135:2use-slices-sort
internal/feature/features.go:135:2
sort.Slice(help, func(i, j int) bool { return strings.Compare(help[i].Name, help[j].Name) < 0internal/fs/const.go1
13:2var-naming
internal/fs/const.go:13:2
O_CREATE int = syscall.O_CREAT // create a new file if none exists. O_EXCL int = syscall.O_EXCL // used with O_CREATE, file must not exist O_SYNC int = syscall.O_SYNC // open for synchronous I/O.internal/backend/rewind_reader_test.go1
121:15weak-cryptography
internal/backend/rewind_reader_test.go:121:15
if rd.Hash() != nil { hasher := md5.New() // must never fail according to interfacecmd/restic/cmd_backup_integration_test.go1
137:56add-constant
cmd/restic/cmd_backup_integration_test.go:137:56
// second backup, implicit incremental testRunBackup(t, filepath.Dir(env.testdata), []string{"testdata"}, opts, env.gopts)internal/repository/lock_test.go1
346:18boolean-literal-comparison
internal/repository/lock_test.go:346:18
"stale lock still exists after RemoveStaleLocks was called") rtest.Assert(t, lockExists(repo, t, id2) == true, "non-stale lock was removed by RemoveStaleLocks")cmd/restic/cmd_backup.go1
407:6cognitive-complexity
cmd/restic/cmd_backup.go:407:6
// collectTargets returns a list of target files/dirs from several sources.func collectTargets(opts BackupOptions, args []string, warnf func(msg string, args ...interface{}), stdin io.ReadCloser) (targets []string, err error) { if opts.Stdin || opts.StdinCommand {internal/archiver/tree.go1
158:16confusing-naming
internal/archiver/tree.go:158:16
// add adds a new target path into the tree.func (t *tree) add(fs fs.FS, target, root string, pc []string, explicit bool) error { if len(pc) == 0 {internal/restic/parallel_test.go1
34:38confusing-results
internal/restic/parallel_test.go:34:38
func (c *testCounter) SetMax(_ uint64) {}func (c *testCounter) Get() (uint64, uint64) { return c.value.Load(), 0 }func (c *testCounter) Done() {}internal/ui/backup/json.go1
25:6constructor-interface-return
internal/ui/backup/json.go:25:6
// NewJSONProgress returns a new backup progress reporter.func NewJSONProgress(term ui.Terminal, verbosity uint) ProgressPrinter { return &jsonProgress{cmd/restic/cmd_cat.go1
70:6cyclomatic-complexity
cmd/restic/cmd_cat.go:70:6
func runCat(ctx context.Context, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(gopts.JSON, gopts.Verbosity, term)cmd/restic/cmd_backup.go1
589:8discarded-error-result
cmd/restic/cmd_backup.go:589:8
errorHandler := func(item string, err error) { _ = progressReporter.Error(item, err) }cmd/restic/cmd_ls_integration_test.go1
109:1doc-comment-period
cmd/restic/cmd_ls_integration_test.go:109:1
// JSON lines testfunc TestRunLsJson(t *testing.T) {internal/backend/test/tests.go1
183:3early-return
internal/backend/test/tests.go:183:3
d := data if o < len(d) { d = d[o:]internal/archiver/archiver.go1
673:42error-strings
internal/archiver/archiver.go:673:42
if atree.FileInfoPath == "" { return futureNode{}, 0, errors.Errorf("FileInfoPath for %v is empty", snPath) }internal/repository/prune_test.go1
32:4excessive-blank-identifiers
internal/repository/prune_test.go:32:4
rtest.OK(t, err) _, _, _, err = uploader.SaveBlob(ctx, blob.Type, buf, blob.ID, true) rtest.OK(t, err)cmd/restic/cmd_forget.go1
65:6exported-declaration-comment
cmd/restic/cmd_forget.go:65:6
type ForgetPolicyCount intinternal/archiver/archiver.go1
1:1file-length-limit
internal/archiver/archiver.go:1:1
package archivercmd/restic/cmd_prune_integration_test.go1
217:107flag-parameter
cmd/restic/cmd_prune_integration_test.go:217:107
func testEdgeCaseRepo(t *testing.T, tarfile string, optionsCheck CheckOptions, optionsPrune PruneOptions, checkOK, pruneOK bool) { env, cleanup := withTestEnvironment(t)cmd/restic/cmd_cat_test.go1
1:1format
cmd/restic/cmd_cat_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_cat_test.go`
cmd/restic/cmd_diff.go1
357:6function-length
cmd/restic/cmd_diff.go:357:6
func runDiff(ctx context.Context, opts DiffOptions, gopts global.Options, args []string, term ui.Terminal) error { if len(args) != 2 {internal/archiver/archiver_test.go1
438:32function-result-limit
internal/archiver/archiver_test.go:438:32
func (repo *blobCountingSaver) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool) (restic.ID, bool, int, error) { id, exists, size, err := repo.saver.SaveBlob(ctx, t, buf, id, storeDuplicate)internal/repository/prune.go1
522:3identical-switch-branches
internal/repository/prune.go:522:3
return false case pi.unusedSize+pi.usedSize < uint64(targetPackSize) && pj.unusedSize+pj.usedSize >= uint64(targetPackSize): return truecmd/restic/cmd_ls_integration_test.go1
31:38import-shadowing
cmd/restic/cmd_ls_integration_test.go:31:38
func assertIsValidJSON(t *testing.T, data []byte) { // Sanity check: output must be valid JSON.internal/repository/checker.go1
135:5inefficient-map-lookup
internal/repository/checker.go:135:5
if _, ok := packToIndex[packID]; !ok { packToIndex[packID] = restic.NewIDSet() }internal/backend/watchdog_roundtriper_test.go1
91:53insecure-url-scheme
internal/backend/watchdog_roundtriper_test.go:91:53
cancel() req, err := http.NewRequestWithContext(ctx, "GET", "http://some.random.url.dfdgsfg", nil) rtest.OK(t, err)internal/fs/fs_local_vss.go1
204:7max-control-nesting
internal/fs/fs_local_vss.go:204:7
fs.msgMessage("mountpoints in snapshot volume [%s]:\n", vssVolume) for mp, mpInfo := range snapshot.mountPointInfo { info := ""internal/restorer/restorer_test.go1
535:6max-public-structs
internal/restorer/restorer_test.go:535:6
type TreeVisit struct { funcName string // name of the functioncmd/restic/cmd_backup_integration_test.go1
120:3modifies-parameter
cmd/restic/cmd_backup_integration_test.go:120:3
path = vol[:len(vol)-1] + string(filepath.Separator) + path[len(vol)+1:] path = filepath.ToSlash(path) }internal/data/node.go1
169:2modifies-value-receiver
internal/data/node.go:169:2
node.ModTime = fixTime(node.ModTime) node.AccessTime = fixTime(node.AccessTime) node.ChangeTime = fixTime(node.ChangeTime)cmd/restic/cmd_copy_integration_test.go1
66:34nested-structs
cmd/restic/cmd_copy_integration_test.go:66:34
// Check that the copied snapshots have the same tree contents as the old ones (= identical tree hash) origRestores := make(map[string]struct{}) for i, snapshotID := range snapshotIDs {cmd/restic/cmd_tag.go1
169:4nil-error-return
cmd/restic/cmd_tag.go:169:4
printer.E("unable to modify the tags for snapshot ID %q, ignoring: %v", sn.ID(), err) return nil }internal/backend/b2/b2.go1
83:4no-else-after-return
internal/backend/b2/b2.go:83:4
return nil, errors.New("connection to B2 failed") } else if err != nil { return nil, errors.Wrap(err, "b2.NewClient")internal/backend/local/config.go1
24:6no-init
internal/backend/local/config.go:24:6
func init() { options.Register("local", Config{})internal/backend/s3/s3.go1
573:5no-naked-return
internal/backend/s3/s3.go:573:5
objectInfo, err = be.client.StatObject(ctx, be.cfg.Bucket, filename, minio.StatObjectOptions{}) return },cmd/restic/cmd_backup.go1
174:5no-package-var
cmd/restic/cmd_backup.go:174:5
var backupFSTestHook func(fs fs.FS) fs.FScmd/restic/cmd_copy.go1
1:9package-comments
cmd/restic/cmd_copy.go:1:9
package maininternal/archiver/tree_test.go1
471:18range-value-address
internal/archiver/tree_test.go:471:18
if !cmp.Equal(&test.want, tree) { t.Error(cmp.Diff(&test.want, tree))internal/data/tree_stream.go1
192:29redefines-builtin-id
internal/data/tree_stream.go:192:29
skip func(tree restic.ID) bool, process func(id restic.ID, error error, nodes TreeNodeIterator) error,) error {cmd/restic/cmd_forget_test.go1
18:9redundant-conversion
cmd/restic/cmd_forget_test.go:18:9
{"0", ForgetPolicyCount(0), ""}, {"1", ForgetPolicyCount(1), ""}, {"unlimited", ForgetPolicyCount(-1), ""},internal/archiver/archiver_test.go1
1479:8slice-preallocation
internal/archiver/archiver_test.go:1479:8
var targets []string for _, target := range test.targets {internal/backend/watchdog_roundtriper_test.go1
194:57standard-http-method-constant
internal/backend/watchdog_roundtriper_test.go:194:57
rt := newWatchdogRoundtripper(http.DefaultTransport, 25*time.Millisecond, 1024) req, err := http.NewRequestWithContext(context.TODO(), "GET", srv.URL, io.NopCloser(bytes.NewReader(msg))) rtest.OK(t, err)internal/fs/vss_windows.go1
826:3task-comment
internal/fs/vss_windows.go:826:3
); err != nil { // TODO warn for expected event logs for VSS IVssWriterCallback failure return nil, newVssError(cmd/restic/cmd_debug.go1
82:1top-level-declaration-order
cmd/restic/cmd_debug.go:82:1
type DebugExamineOptions struct { TryRepair boolinternal/backend/location/registry.go1
62:29unchecked-type-assertion
internal/backend/location/registry.go:62:29
func (f *genericBackendFactory[C, T]) Create(ctx context.Context, cfg interface{}, rt http.RoundTripper, lim limiter.Limiter, errorLog func(string, ...interface{})) (backend.Backend, error) { return f.createFn(ctx, *cfg.(*C), rt, lim, errorLog)}internal/backend/rest/rest.go1
296:2unclosed-http-response-body
internal/backend/rest/rest.go:296:2
resp, err := b.client.Do(req) if err != nil {internal/fs/node_freebsd.go1
10:48unused-parameter
internal/fs/node_freebsd.go:10:48
func nodeRestoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error { return nilcmd/restic/cmd_ls.go1
635:7unused-receiver
cmd/restic/cmd_ls.go:635:7
func (c *SortMode) Type() string { return "mode"cmd/restic/cmd_backup.go1
592:46use-any
cmd/restic/cmd_backup.go:592:46
messageHandler := func(msg string, args ...interface{}) { if !gopts.JSON {cmd/restic/cmd_key_passwd.go1
56:10use-errors-new
cmd/restic/cmd_key_passwd.go:56:10
if len(args) > 0 { return fmt.Errorf("the key passwd command expects no arguments, only options - please see `restic help key passwd` for usage and flags") }internal/fuse/snapshots_dirstruct.go1
314:2use-slices-sort
internal/fuse/snapshots_dirstruct.go:314:2
// This needs to be done before hashing. sort.Slice(snapshots, func(i, j int) bool { si, sj := snapshots[i], snapshots[j]internal/fs/const.go1
14:2var-naming
internal/fs/const.go:14:2
O_EXCL int = syscall.O_EXCL // used with O_CREATE, file must not exist O_SYNC int = syscall.O_SYNC // open for synchronous I/O. O_TRUNC int = syscall.O_TRUNC // if possible, truncate file when opened.internal/backend/swift/swift.go1
123:9weak-cryptography
internal/backend/swift/swift.go:123:9
func (be *beSwift) Hasher() hash.Hash { return md5.New()}cmd/restic/cmd_backup_integration_test.go1
175:21add-constant
cmd/restic/cmd_backup_integration_test.go:175:21
func TestBackupVSS(t *testing.T) { if runtime.GOOS != "windows" || fs.HasSufficientPrivilegesForVSS() != nil { t.Skip("vss fs test can only be run on windows with admin privileges")internal/repository/lock_test.go1
348:18boolean-literal-comparison
internal/repository/lock_test.go:348:18
"non-stale lock was removed by RemoveStaleLocks") rtest.Assert(t, lockExists(repo, t, id3) == false, "stale lock still exists after RemoveStaleLocks was called")cmd/restic/cmd_backup.go1
498:6cognitive-complexity
cmd/restic/cmd_backup.go:498:6
func runBackup(ctx context.Context, opts BackupOptions, gopts global.Options, term ui.Terminal, args []string) error { var vsscfg fs.VSSConfiginternal/archiver/tree_saver.go1
76:21confusing-naming
internal/archiver/tree_saver.go:76:21
// save stores the nodes as a tree in the repo.func (s *treeSaver) save(ctx context.Context, job *saveTreeJob) (*data.Node, ItemStats, error) { var stats ItemStatsinternal/restic/progress.go1
15:35confusing-results
internal/restic/progress.go:15:35
func (noopCounter) SetMax(uint64) {}func (noopCounter) Get() (uint64, uint64) { return 0, 0 }func (noopCounter) Done() {}internal/ui/backup/text.go1
26:6constructor-interface-return
internal/ui/backup/text.go:26:6
// NewTextProgress returns a new backup progress reporter.func NewTextProgress(term ui.Terminal, verbosity uint) ProgressPrinter { return &textProgress{cmd/restic/cmd_check.go1
97:6cyclomatic-complexity
cmd/restic/cmd_check.go:97:6
func checkFlags(opts CheckOptions) error { if opts.ReadData && opts.ReadDataSubset != "" {cmd/restic/cmd_backup_integration_test.go1
154:10discarded-error-result
cmd/restic/cmd_backup_integration_test.go:154:10
// call Lstat to trigger snapshot creation _, _ = f.FS.Lstat(name) // nuke testdatacmd/restic/cmd_prune_integration_test.go1
159:1doc-comment-period
cmd/restic/cmd_prune_integration_test.go:159:1
// Test repos for edge casesfunc TestEdgeCaseRepos(t *testing.T) {internal/fs/node_windows.go1
270:4early-return
internal/fs/node_windows.go:270:4
if err != nil { if IsAccessDenied(err) || errors.Is(err, windows.ERROR_FILE_READ_ONLY) { // If existing file already has readonly or system flag, encrypt file call fails.internal/archiver/archiver_test.go1
232:15error-strings
internal/archiver/archiver_test.go:232:15
if excluded { t.Errorf("Save() excluded the node, that's unexpected") }internal/repository/repack.go1
129:5excessive-blank-identifiers
internal/repository/repack.go:129:5
// We do want to save already saved blobs! _, _, _, err = uploader.SaveBlob(wgCtx, blob.Type, buf, blob.ID, true) if err != nil {cmd/restic/cmd_forget.go1
67:5exported-declaration-comment
cmd/restic/cmd_forget.go:67:5
var ErrNegativePolicyCount = errors.New("negative values not allowed, use 'unlimited' instead")var ErrFailedToRemoveOneOrMoreSnapshots = errors.New("failed to remove one or more snapshots")internal/archiver/archiver_test.go1
1:1file-length-limit
internal/archiver/archiver_test.go:1:1
package archivercmd/restic/cmd_prune_integration_test.go1
217:116flag-parameter
cmd/restic/cmd_prune_integration_test.go:217:116
func testEdgeCaseRepo(t *testing.T, tarfile string, optionsCheck CheckOptions, optionsPrune PruneOptions, checkOK, pruneOK bool) { env, cleanup := withTestEnvironment(t)cmd/restic/cmd_check.go1
1:1format
cmd/restic/cmd_check.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_check.go`
cmd/restic/cmd_find.go1
290:18function-length
cmd/restic/cmd_find.go:290:18
func (f *Finder) findInSnapshot(ctx context.Context, sn *data.Snapshot) error { debug.Log("searching in snapshot %s\n for entries within [%s %s]", sn.ID(), f.pat.oldest, f.pat.newest)internal/archiver/archiver_test.go1
2293:25function-result-limit
internal/archiver/archiver_test.go:2293:25
func (f *failSaveSaver) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool) (restic.ID, bool, int, error) { val := f.failSaveRepo.cnt.Add(1)internal/repository/prune.go1
524:3identical-switch-branches
internal/repository/prune.go:524:3
return true case pj.unusedSize+pj.usedSize < uint64(targetPackSize) && pi.unusedSize+pi.usedSize >= uint64(targetPackSize): return falsecmd/restic/cmd_rewrite.go1
155:6import-shadowing
cmd/restic/cmd_rewrite.go:155:6
condExclude := len(rejectByNameFuncs) > 0 var filter rewriteFilterFuncinternal/repository/checker.go1
143:5inefficient-map-lookup
internal/repository/checker.go:143:5
if _, ok := packToPackBlobHash[pbs.PackID]; !ok { packToPackBlobHash[pbs.PackID] = restic.NewIDSet() }internal/fs/fs_local_vss.go1
206:8max-control-nesting
internal/fs/fs_local_vss.go:206:8
info := "" if !mpInfo.IsSnapshotted() { info = " (not snapshotted)"cmd/restic/cmd_check.go1
167:2modifies-parameter
cmd/restic/cmd_check.go:167:2
} s = s[:len(s)-1]internal/data/node.go1
170:2modifies-value-receiver
internal/data/node.go:170:2
node.AccessTime = fixTime(node.AccessTime) node.ChangeTime = fixTime(node.ChangeTime)cmd/restic/cmd_copy_integration_test.go1
69:30nested-structs
cmd/restic/cmd_copy_integration_test.go:69:30
restoredir := filepath.Join(env.base, fmt.Sprintf("restore%d", i)) origRestores[restoredir] = struct{}{} testRunRestore(t, env.gopts, restoredir, snapshotID.String())cmd/restic/integration_helpers_test.go1
43:5nil-error-return
cmd/restic/integration_helpers_test.go:43:5
t.Logf("error: %v\n", err) return nil }internal/backend/b2/b2.go1
104:4no-else-after-return
internal/backend/b2/b2.go:104:4
return nil, backend.ErrNoRepository } else if err != nil { return nil, errors.Wrap(err, "Bucket")internal/backend/rclone/config.go1
27:6no-init
internal/backend/rclone/config.go:27:6
func init() { options.Register("rclone", Config{})internal/bloblru/cache.go1
54:3no-naked-return
internal/bloblru/cache.go:54:3
if size > c.size { return }cmd/restic/cmd_backup.go1
177:5no-package-var
cmd/restic/cmd_backup.go:177:5
// ErrInvalidSourceData is used to report an incomplete backupvar ErrInvalidSourceData = errors.New("at least one source file could not be read")cmd/restic/cmd_debug.go1
3:9package-comments
cmd/restic/cmd_debug.go:3:9
package maininternal/archiver/tree_test.go1
472:22range-value-address
internal/archiver/tree_test.go:472:22
if !cmp.Equal(&test.want, tree) { t.Error(cmp.Diff(&test.want, tree)) }internal/repository/index/master_index_test.go1
524:5redefines-builtin-id
internal/repository/index/master_index_test.go:524:5
rtest.OK(t, master.Load(context.TODO(), repo, p, nil)) v, max := p.Get() rtest.Equals(t, uint64(indexCount), v)cmd/restic/cmd_forget_test.go1
19:17redundant-conversion
cmd/restic/cmd_forget_test.go:19:17
{"1", ForgetPolicyCount(1), ""}, {"unlimited", ForgetPolicyCount(-1), ""}, {"", ForgetPolicyCount(0), "strconv.ParseInt: parsing \"\": invalid syntax"},internal/archiver/file_saver_test.go1
60:6slice-preallocation
internal/archiver/file_saver_test.go:60:6
var results []futureNodeinternal/fuse/root.go1
41:1task-comment
internal/fuse/root.go:41:1
// Size of the blob cache. TODO: make this configurable.const blobCacheSize = 64 << 20cmd/restic/cmd_diff.go1
66:1top-level-declaration-order
cmd/restic/cmd_diff.go:66:1
// DiffOptions collects all options for the diff command.type DiffOptions struct { ShowMetadata boolinternal/backend/location/registry.go1
65:27unchecked-type-assertion
internal/backend/location/registry.go:65:27
func (f *genericBackendFactory[C, T]) Open(ctx context.Context, cfg interface{}, rt http.RoundTripper, lim limiter.Limiter, errorLog func(string, ...interface{})) (backend.Backend, error) { return f.openFn(ctx, *cfg.(*C), rt, lim, errorLog)}internal/backend/rest/rest.go1
326:2unclosed-http-response-body
internal/backend/rest/rest.go:326:2
resp, err := b.client.Do(req) if err != nil {internal/repository/index/index_test.go1
328:15unused-parameter
internal/repository/index/index_test.go:328:15
func listPack(t testing.TB, idx *index.Index, id restic.ID) (pbs []*pack.PackedBlob) { for pb := range idx.Values() {cmd/restic/cmd_repair_index_integration_test.go1
110:7unused-receiver
cmd/restic/cmd_repair_index_integration_test.go:110:7
// called via repo.Backend().Remove()func (b *appendOnlyBackend) Remove(_ context.Context, h backend.Handle) error { return errors.Errorf("Failed to remove %v", h)cmd/restic/cmd_check.go1
573:50use-any
cmd/restic/cmd_check.go:573:50
func (p *jsonErrorPrinter) E(msg string, args ...interface{}) { status := checkError{cmd/restic/cmd_key_remove.go1
43:10use-errors-new
cmd/restic/cmd_key_remove.go:43:10
if len(args) != 1 { return fmt.Errorf("key remove expects one argument as the key id") }internal/repository/prune.go1
514:2use-slices-sort
internal/repository/prune.go:514:2
debug.Log("%d candidate packfiles to repack", len(repackCandidates)) sort.Slice(repackCandidates, func(i, j int) bool { pi := repackCandidates[i].packInfointernal/fs/const.go1
15:2var-naming
internal/fs/const.go:15:2
O_SYNC int = syscall.O_SYNC // open for synchronous I/O. O_TRUNC int = syscall.O_TRUNC // if possible, truncate file when opened. O_NONBLOCK int = syscall.O_NONBLOCK // don't block open on fifos etc.cmd/restic/cmd_backup_integration_test.go1
254:44add-constant
cmd/restic/cmd_backup_integration_test.go:254:44
rtest.Equals(t, snapshotIDs, snapshotIDsAfter) dataIDsAfter := testRunList(t, env.gopts, "packs") rtest.Equals(t, packIDs, dataIDsAfter)internal/repository/lock_test.go1
372:18boolean-literal-comparison
internal/repository/lock_test.go:372:18
rtest.Assert(t, lockExists(repo, t, id1) == false, "lock still exists after RemoveAllLocks was called")cmd/restic/cmd_backup_integration_test.go1
151:31cognitive-complexity
cmd/restic/cmd_backup_integration_test.go:151:31
func (f *vssDeleteOriginalFS) Lstat(name string) (*fs.ExtendedFileInfo, error) { if !f.hasRemoved {internal/backend/azure/azure.go1
161:6confusing-naming
internal/backend/azure/azure.go:161:6
// Open opens the Azure backend at specified container.func Open(_ context.Context, cfg Config, rt http.RoundTripper, _ func(string, ...interface{})) (*Backend, error) { return open(cfg, rt)internal/ui/restore/json.go1
19:6constructor-interface-return
internal/ui/restore/json.go:19:6
func NewJSONProgress(terminal ui.Terminal, verbosity uint) ProgressPrinter { return &jsonPrinter{cmd/restic/cmd_check.go1
229:6cyclomatic-complexity
cmd/restic/cmd_check.go:229:6
func runCheck(ctx context.Context, opts CheckOptions, gopts global.Options, args []string, term ui.Terminal) (checkSummary, error) { summary := checkSummary{MessageType: "summary"}cmd/restic/cmd_cache.go1
166:6discarded-error-result
cmd/restic/cmd_cache.go:166:6
_ = tab.Write(gopts.Term.OutputWriter()) printer.S("%d cache dirs in %s", len(dirs), cachedir)cmd/restic/cmd_repair_index_integration_test.go1
109:1doc-comment-period
cmd/restic/cmd_repair_index_integration_test.go:109:1
// called via repo.Backend().Remove()func (b *appendOnlyBackend) Remove(_ context.Context, h backend.Handle) error {internal/fs/node_windows.go1
298:5early-return
internal/fs/node_windows.go:298:5
if err != nil { if IsAccessDenied(err) || errors.Is(err, windows.ERROR_FILE_READ_ONLY) { // If existing file already has readonly or system flag, decrypt file call fails.internal/archiver/archiver_test.go1
310:15error-strings
internal/archiver/archiver_test.go:310:15
if excluded { t.Errorf("Save() excluded the node, that's unexpected") }internal/repository/repack_test.go1
73:3excessive-blank-identifiers
internal/repository/repack_test.go:73:3
rtest.OK(t, repo.WithBlobUploader(context.TODO(), func(ctx context.Context, uploader restic.BlobSaverWithAsync) error { _, _, _, err := uploader.SaveBlob(ctx, restic.DataBlob, buf, id, false) return errcmd/restic/cmd_forget.go1
68:5exported-declaration-comment
cmd/restic/cmd_forget.go:68:5
var ErrNegativePolicyCount = errors.New("negative values not allowed, use 'unlimited' instead")var ErrFailedToRemoveOneOrMoreSnapshots = errors.New("failed to remove one or more snapshots")internal/backend/retry/backend_retry_test.go1
1:1file-length-limit
internal/backend/retry/backend_retry_test.go:1:1
package retrycmd/restic/cmd_rewrite.go1
194:28flag-parameter
cmd/restic/cmd_rewrite.go:194:28
func filterAndReplaceSnapshot(ctx context.Context, repo restic.Repository, sn *data.Snapshot, filter rewriteFilterFunc, dryRun bool, forget bool, newMetadata *snapshotMetadata, addTag string, printer restic.Printer, keepEmptySnapshot bool) (bool, error) {cmd/restic/cmd_check_integration_test.go1
1:1format
cmd/restic/cmd_check_integration_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_check_integration_test.go`
cmd/restic/cmd_find.go1
596:6function-length
cmd/restic/cmd_find.go:596:6
func runFind(ctx context.Context, opts FindOptions, gopts global.Options, args []string, term ui.Terminal) error { if len(args) == 0 {internal/archiver/file_saver_test.go1
33:6function-result-limit
internal/archiver/file_saver_test.go:33:6
func startFileSaver(ctx context.Context, t testing.TB, _ fs.FS) (*fileSaver, *mockSaver, context.Context, *errgroup.Group) { wg, ctx := errgroup.WithContext(ctx)internal/repository/prune.go1
559:3identical-switch-branches
internal/repository/prune.go:559:3
case reachedUnusedSizeAfter && packIsLargeEnough: // for all other packs stop repacking if tolerated unused size is reached.cmd/restic/cmd_rewrite.go1
194:2import-shadowing
cmd/restic/cmd_rewrite.go:194:2
func filterAndReplaceSnapshot(ctx context.Context, repo restic.Repository, sn *data.Snapshot, filter rewriteFilterFunc, dryRun bool, forget bool, newMetadata *snapshotMetadata, addTag string, printer restic.Printer, keepEmptySnapshot bool) (bool, error) {internal/repository/index/associated_data.go1
79:3inefficient-map-lookup
internal/repository/index/associated_data.go:79:3
if _, ok := a.overflow[bh]; ok { a.overflow[bh] = val returninternal/restorer/filerestorer.go1
294:6max-control-nesting
internal/restorer/filerestorer.go:294:6
for _, idxPack := range idxPacks { if idxPack.PackID().Equal(pack.id) { addBlob(idxPack.Handle(), blob.offset)cmd/restic/cmd_check.go1
204:4modifies-parameter
cmd/restic/cmd_check.go:204:4
printer.E("unable to create cache directory %s, disabling cache: %v", cachedir, err) gopts.NoCache = true return cleanupinternal/data/snapshot.go1
267:2modifies-value-receiver
internal/data/snapshot.go:267:2
func (sn Snapshots) Swap(i, j int) { sn[i], sn[j] = sn[j], sn[i]}cmd/restic/cmd_diff_integration_test.go1
104:31nested-structs
cmd/restic/cmd_diff_integration_test.go:104:31
snapshots := make(map[string]struct{}) opts := BackupOptions{}cmd/restic/integration_helpers_test.go1
49:5nil-error-return
cmd/restic/integration_helpers_test.go:49:5
t.Logf("error: %v\n", err) return nil }internal/backend/s3/s3.go1
142:5no-else-after-return
internal/backend/s3/s3.go:142:5
return nil, errors.Fatalf("no credentials found. $AWS_SECRET_ACCESS_KEY is set but $AWS_ACCESS_KEY_ID is empty") } else if keyID != "" && secret == "" { return nil, errors.Fatalf("no credentials found. $AWS_ACCESS_KEY_ID is set but $AWS_SECRET_ACCESS_KEY is empty")internal/backend/rest/config.go1
19:6no-init
internal/backend/rest/config.go:19:6
func init() { options.Register("rest", Config{})internal/bloblru/cache.go1
61:3no-naked-return
internal/bloblru/cache.go:61:3
if c.c.Contains(id) { // Doesn't update the recency list. return }cmd/restic/cmd_backup.go1
180:5no-package-var
cmd/restic/cmd_backup.go:180:5
// ErrNoSourceData is used to report that no source data was foundvar ErrNoSourceData = errors.Fatal("all source directories/files do not exist")cmd/restic/cmd_debug_disabled.go1
3:9package-comments
cmd/restic/cmd_debug_disabled.go:3:9
package maininternal/backend/layout/layout_test.go1
129:9range-value-address
internal/backend/layout/layout_test.go:129:9
t.Run(fmt.Sprintf("%v/%v", test.Type, test.Handle.Name), func(t *testing.T) { l := &DefaultLayout{ path: test.path,internal/repository/packer_manager.go1
151:16redefines-builtin-id
internal/repository/packer_manager.go:151:16
func randomInt(max int) (int, error) { rangeSize := big.NewInt(int64(max))cmd/restic/cmd_forget_test.go1
20:8redundant-conversion
cmd/restic/cmd_forget_test.go:20:8
{"unlimited", ForgetPolicyCount(-1), ""}, {"", ForgetPolicyCount(0), "strconv.ParseInt: parsing \"\": invalid syntax"}, {"-1", ForgetPolicyCount(0), ErrNegativePolicyCount.Error()},internal/archiver/testing.go1
83:6slice-preallocation
internal/archiver/testing.go:83:6
// ensure a stable order such that it can be guaranteed that a hardlink target already exists var names []string for name := range dir {internal/restorer/fileswriter.go1
20:1task-comment
internal/restorer/fileswriter.go:20:1
// multiple blobs can be concurrently written to the same file.// TODO I am not 100% convinced this is necessary, i.e. it may be okay// to use multiple os.File to write to the same target filecmd/restic/cmd_diff_integration_test.go1
64:1top-level-declaration-order
cmd/restic/cmd_diff_integration_test.go:64:1
var diffOutputRegexPatterns = []string{ "-.+modfile",internal/backend/rclone/internal_test.go1
31:10unchecked-type-assertion
internal/backend/rclone/internal_test.go:31:10
err = be.(*rclone).cmd.Process.Kill() rtest.OK(t, err)internal/backend/watchdog_roundtriper.go1
66:2unclosed-http-response-body
internal/backend/watchdog_roundtriper.go:66:2
resp, err := w.rt.RoundTrip(req) if err != nil {internal/repository/pack/blobs_test.go1
21:28unused-parameter
internal/repository/pack/blobs_test.go:21:28
func TestBlobsSortNilSlice(t *testing.T) { var blobs Blobscmd/restic/integration_test.go1
110:7unused-receiver
cmd/restic/integration_test.go:110:7
func (r *writeToOnly) Read(_ []byte) (n int, err error) { return 0, fmt.Errorf("should have called WriteTo instead")cmd/restic/cmd_check.go1
580:43use-any
cmd/restic/cmd_check.go:580:43
}func (*jsonErrorPrinter) S(_ string, _ ...interface{}) {}func (*jsonErrorPrinter) P(_ string, _ ...interface{}) {}cmd/restic/integration_test.go1
111:12use-errors-new
cmd/restic/integration_test.go:111:12
func (r *writeToOnly) Read(_ []byte) (n int, err error) { return 0, fmt.Errorf("should have called WriteTo instead")}internal/repository/repository_internal_test.go1
50:2use-slices-sort
internal/repository/repository_internal_test.go:50:2
copy(sorted[:], blobs[:]) sort.SliceStable(sorted[:], func(i, j int) bool { hi := backend.Handle{Type: backend.PackFile, Name: sorted[i].PackID().String()}internal/fs/const.go1
16:2var-naming
internal/fs/const.go:16:2
O_TRUNC int = syscall.O_TRUNC // if possible, truncate file when opened. O_NONBLOCK int = syscall.O_NONBLOCK // don't block open on fifos etc.)cmd/restic/cmd_backup_integration_test.go1
256:45add-constant
cmd/restic/cmd_backup_integration_test.go:256:45
rtest.Equals(t, packIDs, dataIDsAfter) indexIDsAfter := testRunList(t, env.gopts, "index") rtest.Equals(t, indexIDs, indexIDsAfter)internal/repository/lock_test.go1
374:18boolean-literal-comparison
internal/repository/lock_test.go:374:18
"lock still exists after RemoveAllLocks was called") rtest.Assert(t, lockExists(repo, t, id2) == false, "lock still exists after RemoveAllLocks was called")cmd/restic/cmd_backup_integration_test.go1
600:6cognitive-complexity
cmd/restic/cmd_backup_integration_test.go:600:6
func linksEqual(source, dest map[uint64][]string) bool { for _, vs := range source {internal/backend/gs/gs.go1
117:6confusing-naming
internal/backend/gs/gs.go:117:6
// Open opens the gs backend at the specified bucket.func Open(_ context.Context, cfg Config, rt http.RoundTripper, _ func(string, ...interface{})) (backend.Backend, error) { return open(cfg, rt)internal/ui/restore/text.go1
19:6constructor-interface-return
internal/ui/restore/text.go:19:6
func NewTextProgress(terminal ui.Terminal, verbosity uint) ProgressPrinter { return &textPrinter{cmd/restic/cmd_copy.go1
120:6cyclomatic-complexity
cmd/restic/cmd_copy.go:120:6
func runCopy(ctx context.Context, opts CopyOptions, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)cmd/restic/cmd_check.go1
479:21discarded-error-result
cmd/restic/cmd_check.go:479:21
} subsetSize, _ := ui.ParseBytes(opts.ReadDataSubset) if subsetSize > repoSize {cmd/restic/cmd_rewrite_integration_test.go1
334:1doc-comment-period
cmd/restic/cmd_rewrite_integration_test.go:334:1
// TestRewriteIncludeNothing makes sure when nothing is included, the original snapshot stays untouchedfunc TestRewriteIncludeNothing(t *testing.T) {internal/repository/debug.go1
317:5early-return
internal/repository/debug.go:317:5
} if plaintext != nil { outputPrefix = "repaired "internal/archiver/archiver_test.go1
2731:12error-strings
internal/archiver/archiver_test.go:2731:12
if excluded { t.Errorf("Save() excluded the node, that's unexpected") }internal/repository/repack_test.go1
345:3excessive-blank-identifiers
internal/repository/repack_test.go:345:3
rtest.OK(t, repo.WithBlobUploader(context.TODO(), func(ctx context.Context, uploader restic.BlobSaverWithAsync) error { _, _, _, err := uploader.SaveBlob(ctx, restic.DataBlob, modbuf, id, false) return errcmd/restic/cmd_key_add.go1
45:6exported-declaration-comment
cmd/restic/cmd_key_add.go:45:6
type KeyAddOptions struct { NewPasswordFile stringinternal/backend/s3/s3.go1
1:1file-length-limit
internal/backend/s3/s3.go:1:1
package s3cmd/restic/cmd_rewrite.go1
194:41flag-parameter
cmd/restic/cmd_rewrite.go:194:41
func filterAndReplaceSnapshot(ctx context.Context, repo restic.Repository, sn *data.Snapshot, filter rewriteFilterFunc, dryRun bool, forget bool, newMetadata *snapshotMetadata, addTag string, printer restic.Printer, keepEmptySnapshot bool) (bool, error) {cmd/restic/cmd_check_test.go1
1:1format
cmd/restic/cmd_check_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_check_test.go`
cmd/restic/cmd_find_integration_test.go1
215:6function-length
cmd/restic/cmd_find_integration_test.go:215:6
func TestFindPackID(t *testing.T) { env, cleanup := withTestEnvironment(t)internal/archiver/tree_saver_test.go1
33:6function-result-limit
internal/archiver/tree_saver_test.go:33:6
func setupTreeSaver() (context.Context, context.CancelFunc, *treeSaver, func() error) { ctx, cancel := context.WithCancel(context.Background())internal/repository/prune.go1
563:3identical-switch-branches
internal/repository/prune.go:563:3
default: repack(p.ID, p.packInfo)cmd/restic/cmd_snapshots.go1
273:3import-shadowing
cmd/restic/cmd_snapshots.go:273:3
for _, sn := range list { data := snapshot{ ID: sn.ID().Str(),internal/repository/repository_test.go1
430:5inefficient-map-lookup
internal/repository/repository_test.go:430:5
if _, ok := packEntries[packID]; !ok { packEntries[packID] = make(map[restic.ID]struct{}) }cmd/restic/cmd_check.go1
212:3modifies-parameter
cmd/restic/cmd_check.go:212:3
printer.E("unable to create temporary directory for cache during check, disabling cache: %v\n", err) gopts.NoCache = true return cleanupinternal/data/snapshot.go1
267:9modifies-value-receiver
internal/data/snapshot.go:267:9
func (sn Snapshots) Swap(i, j int) { sn[i], sn[j] = sn[j], sn[i]}cmd/restic/cmd_dump_test.go1
10:17nested-structs
cmd/restic/cmd_dump_test.go:10:17
func TestDumpSplitPath(t *testing.T) { testPaths := []struct { path stringinternal/backend/cache/cache.go1
58:4nil-error-return
internal/backend/cache/cache.go:58:4
if errors.Is(err, os.ErrExist) { return nil }internal/checker/checker.go1
131:5no-else-after-return
internal/checker/checker.go:131:5
return nil } else if sn != nil { trees = append(trees, *sn.Tree)internal/backend/s3/config.go1
54:6no-init
internal/backend/s3/config.go:54:6
func init() { options.Register("s3", Config{})internal/data/snapshot.go1
154:2no-naked-return
internal/data/snapshot.go:154:2
} return}cmd/restic/cmd_backup_integration_test.go1
371:5no-package-var
cmd/restic/cmd_backup_integration_test.go:371:5
var backupExcludeFilenames = []string{ "testfile1",cmd/restic/cmd_diff.go1
1:9package-comments
cmd/restic/cmd_diff.go:1:9
package maininternal/checker/checker.go1
209:24range-value-address
internal/checker/checker.go:209:24
if item.Error != nil { errs = append(errs, &Error{TreeID: id, Err: errors.Errorf("failed to decode tree %v: %w", id, item.Error)}) breakinternal/repository/repack_test.go1
15:36redefines-builtin-id
internal/repository/repack_test.go:15:36
func randomSize(random *rand.Rand, min, max int) int { return random.Intn(max-min) + mincmd/restic/cmd_forget_test.go1
21:10redundant-conversion
cmd/restic/cmd_forget_test.go:21:10
{"", ForgetPolicyCount(0), "strconv.ParseInt: parsing \"\": invalid syntax"}, {"-1", ForgetPolicyCount(0), ErrNegativePolicyCount.Error()}, {"abc", ForgetPolicyCount(0), "strconv.ParseInt: parsing \"abc\": invalid syntax"},internal/backend/cache/cache.go1
212:6slice-preallocation
internal/backend/cache/cache.go:212:6
var oldCacheDirs []os.FileInfo for _, fi := range entries {internal/restorer/restorer.go1
318:2task-comment
internal/restorer/restorer.go:318:2
res.opts.Progress.AddProgress(location, ActionOtherRestored, 0, 0) // TODO investigate if hardlinks have separate metadata on any supported system return res.restoreNodeMetadataTo(node, path, location)cmd/restic/cmd_dump.go1
63:1top-level-declaration-order
cmd/restic/cmd_dump.go:63:1
// DumpOptions collects all options for the dump command.type DumpOptions struct { data.SnapshotFilterinternal/backend/retry/backend_retry.go1
207:18unchecked-type-assertion
internal/backend/retry/backend_retry.go:207:18
if v, ok := be.failedLoads.Load(key); ok { if time.Since(v.(time.Time)) > failedLoadExpiry { be.failedLoads.Delete(key)internal/debug/round_tripper.go1
52:2unclosed-http-response-body
internal/debug/round_tripper.go:52:2
func (tr eofDetectRoundTripper) RoundTrip(req *http.Request) (res *http.Response, err error) { res, err = tr.RoundTripper.RoundTrip(req) if res != nil && res.Body != nil {internal/archiver/archiver_test.go1
2752:7unused-receiver
internal/archiver/archiver_test.go:2752:7
func (f *missingFile) Stat() (*fs.ExtendedFileInfo, error) { return nil, os.ErrNotExistcmd/restic/cmd_check.go1
581:43use-any
cmd/restic/cmd_check.go:581:43
func (*jsonErrorPrinter) S(_ string, _ ...interface{}) {}func (*jsonErrorPrinter) P(_ string, _ ...interface{}) {}func (*jsonErrorPrinter) PT(_ string, _ ...interface{}) {}cmd/restic/integration_test.go1
213:10use-errors-new
cmd/restic/integration_test.go:213:10
be.failedOnce = true return fmt.Errorf("oops") }internal/fs/const_unix.go1
8:7var-naming
internal/fs/const_unix.go:8:7
// O_NOFOLLOW instructs the kernel to not follow symlinks when opening a file.const O_NOFOLLOW int = syscall.O_NOFOLLOWcmd/restic/cmd_backup_integration_test.go1
283:20add-constant
cmd/restic/cmd_backup_integration_test.go:283:20
dirs := []string{ filepath.Join(p, "0"), filepath.Join(p, "1"),internal/repository/lock_test.go1
376:18boolean-literal-comparison
internal/repository/lock_test.go:376:18
"lock still exists after RemoveAllLocks was called") rtest.Assert(t, lockExists(repo, t, id3) == false, "lock still exists after RemoveAllLocks was called")cmd/restic/cmd_backup_integration_test.go1
618:6cognitive-complexity
cmd/restic/cmd_backup_integration_test.go:618:6
func linkEqual(source, dest []string) bool { // equal if sliced are equal without considering orderinternal/backend/limiter/static_limiter.go1
45:24confusing-naming
internal/backend/limiter/static_limiter.go:45:24
func (l staticLimiter) Upstream(r io.Reader) io.Reader { return l.limitReader(r, l.upstream)cmd/restic/cmd_copy.go1
187:6cyclomatic-complexity
cmd/restic/cmd_copy.go:187:6
func similarSnapshots(sna *data.Snapshot, snb *data.Snapshot) bool { // everything except Parent and Original must matchcmd/restic/cmd_diff_integration_test.go1
37:7discarded-error-result
cmd/restic/cmd_diff_integration_test.go:37:7
// ignore subsequent errors _ = srcFile.Close() return errinternal/archiver/exclude.go1
320:1doc-comment-period
internal/archiver/exclude.go:320:1
// RejectCloudFiles returns a func which rejects files which are online-only cloud filesfunc RejectCloudFiles(warnf func(msg string, args ...interface{})) (RejectFunc, error) {internal/repository/lock.go1
64:3early-return
internal/repository/lock.go:64:3
lock, err = newLock(ctx, repo, exclusive) if err != nil && IsAlreadyLocked(err) {internal/archiver/exclude.go1
191:26error-strings
internal/archiver/exclude.go:191:26
if runtime.GOOS == "windows" { return nil, errors.New("Device IDs are not supported on Windows") }internal/repository/repack_test.go1
355:3excessive-blank-identifiers
internal/repository/repack_test.go:355:3
rtest.OK(t, repo.WithBlobUploader(context.TODO(), func(ctx context.Context, uploader restic.BlobSaverWithAsync) error { _, _, _, err := uploader.SaveBlob(ctx, restic.DataBlob, buf, id, true) return errcmd/restic/cmd_key_passwd.go1
46:6exported-declaration-comment
cmd/restic/cmd_key_passwd.go:46:6
type KeyPasswdOptions struct { KeyAddOptionsinternal/backend/sftp/sftp.go1
1:1file-length-limit
internal/backend/sftp/sftp.go:1:1
package sftpcmd/restic/cmd_rewrite.go1
195:2flag-parameter
cmd/restic/cmd_rewrite.go:195:2
filter rewriteFilterFunc, dryRun bool, forget bool, newMetadata *snapshotMetadata, addTag string, printer restic.Printer, keepEmptySnapshot bool) (bool, error) {cmd/restic/cmd_copy.go1
1:1format
cmd/restic/cmd_copy.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_copy.go`
cmd/restic/cmd_forget.go1
178:6function-length
cmd/restic/cmd_forget.go:178:6
func runForget(ctx context.Context, opts ForgetOptions, pruneOptions PruneOptions, gopts global.Options, term ui.Terminal, args []string) error { err := verifyForgetOptions(&opts)internal/backend/rclone/backend.go1
47:6function-result-limit
internal/backend/rclone/backend.go:47:6
// run starts command with args and initializes the StdioConn.func run(errorLog func(string, ...interface{}), command string, args ...string) (*StdioConn, *sync.WaitGroup, chan struct{}, func() error, error) { cmd := exec.Command(command, args...)internal/restorer/restorer_test.go1
829:3identical-switch-branches
internal/restorer/restorer_test.go:829:3
childMayBeSelected = true case "/dir/subdir/file2": selectedForRestore = truecmd/restic/cmd_stats.go1
248:127import-shadowing
cmd/restic/cmd_stats.go:248:127
func statsWalkTree(repo restic.Loader, opts StatsOptions, stats *statsContainer, hardLinkIndex *data.HardlinkIndex[struct{}], progress *statsui.Progress) walker.WalkFunc { return func(parentTreeID restic.ID, npath string, node *data.Node, nodeErr error) error {internal/restorer/filerestorer_test.go1
128:5inefficient-map-lookup
internal/restorer/filerestorer_test.go:128:5
n := uint(len(blobData)) pack.blobs[blobID] = packBlobLayout{ offset: uint(len(pack.data)),cmd/restic/cmd_check.go1
216:2modifies-parameter
cmd/restic/cmd_check.go:216:2
gopts.CacheDir = tempdir printer.P("using temporary cache in %v\n", tempdir)internal/data/testing.go1
238:2modifies-value-receiver
internal/data/testing.go:238:2
t.TestTreeMap[id] = append([]byte{}, buf...) return id, true, len(buf), nilcmd/restic/cmd_find.go1
148:25nested-structs
cmd/restic/cmd_find.go:148:25
type findNode data.Node b, err := json.Marshal(struct { // Add these attributesinternal/backend/cache/file.go1
201:5nil-error-return
internal/backend/cache/file.go:201:5
if errors.Is(err, os.ErrNotExist) { return nil }internal/data/node.go1
311:4no-else-after-return
internal/data/node.go:311:4
return false } else if ln == 0 { // This means lo is also of length 0internal/backend/sftp/config.go1
29:6no-init
internal/backend/sftp/config.go:29:6
func init() { options.Register("sftp", Config{})internal/data/snapshot.go1
173:2no-naked-return
internal/data/snapshot.go:173:2
} return}cmd/restic/cmd_cat.go1
19:5no-package-var
cmd/restic/cmd_cat.go:19:5
var catAllowedCmds = []string{"config", "index", "snapshot", "key", "masterkey", "lock", "pack", "blob", "tree"}cmd/restic/cmd_dump.go1
1:9package-comments
cmd/restic/cmd_dump.go:1:9
package maininternal/checker/checker.go1
221:26range-value-address
internal/checker/checker.go:221:26
if blobID.IsNull() { errs = append(errs, &Error{TreeID: id, Err: errors.Errorf("file %q blob %d has null ID", node.Name, b)}) continueinternal/repository/repack_test.go1
15:41redefines-builtin-id
internal/repository/repack_test.go:15:41
func randomSize(random *rand.Rand, min, max int) int { return random.Intn(max-min) + mincmd/restic/cmd_forget_test.go1
22:11redundant-conversion
cmd/restic/cmd_forget_test.go:22:11
{"-1", ForgetPolicyCount(0), ErrNegativePolicyCount.Error()}, {"abc", ForgetPolicyCount(0), "strconv.ParseInt: parsing \"abc\": invalid syntax"}, }internal/backend/test/tests.go1
874:4slice-preallocation
internal/backend/test/tests.go:874:4
// list items IDs := restic.IDs{}internal/restorer/restorer.go1
520:3task-comment
internal/restorer/restorer.go:520:3
// TODO pass a proper value to the isDir parameter once this becomes relevant for the filters selectedForRestore, _ := res.SelectFilter(nodeLocation, false)cmd/restic/cmd_find.go1
71:1top-level-declaration-order
cmd/restic/cmd_find.go:71:1
// FindOptions bundles all options for the find command.type FindOptions struct { Oldest stringinternal/backend/sema/backend_test.go1
74:17unchecked-type-assertion
internal/backend/sema/backend_test.go:74:17
unwrapper := be.(backend.Unwrapper) test.Assert(t, unwrapper.Unwrap() == m, "Unwrap() returned wrong backend")internal/archiver/archiver_test.go1
2756:7unused-receiver
internal/archiver/archiver_test.go:2756:7
func (f *missingFile) Close() error { // prevent segfault in testcmd/restic/cmd_check.go1
582:44use-any
cmd/restic/cmd_check.go:582:44
func (*jsonErrorPrinter) P(_ string, _ ...interface{}) {}func (*jsonErrorPrinter) PT(_ string, _ ...interface{}) {}func (*jsonErrorPrinter) V(_ string, _ ...interface{}) {}cmd/restic/integration_test.go1
221:30use-errors-new
cmd/restic/integration_test.go:221:30
be.failedOnce = true return backend.FileInfo{}, fmt.Errorf("oops") }internal/fs/const_unix.go1
11:7var-naming
internal/fs/const_unix.go:11:7
// O_DIRECTORY instructs the kernel to only open directories.const O_DIRECTORY int = syscall.O_DIRECTORYcmd/restic/cmd_backup_integration_test.go1
413:35add-constant
cmd/restic/cmd_backup_integration_test.go:413:35
files = testRunLs(t, env.gopts, snapshotID) rtest.Assert(t, !includes(files, "/testdata/foo.tar.gz"), "expected file %q not in first snapshot, but it's included", "foo.tar.gz")cmd/restic/cmd_cache.go1
60:6cognitive-complexity
cmd/restic/cmd_cache.go:60:6
func runCache(opts CacheOptions, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)internal/backend/limiter/static_limiter.go1
53:24confusing-naming
internal/backend/limiter/static_limiter.go:53:24
func (l staticLimiter) Downstream(r io.Reader) io.Reader { return l.limitReader(r, l.downstream)cmd/restic/cmd_debug.go1
161:6cyclomatic-complexity
cmd/restic/cmd_debug.go:161:6
func runDebugExamine(ctx context.Context, gopts global.Options, opts DebugExamineOptions, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)cmd/restic/cmd_diff_integration_test.go1
44:7discarded-error-result
cmd/restic/cmd_diff_integration_test.go:44:7
// ignore subsequent errors _ = srcFile.Close() _ = dstFile.Close()internal/archiver/exclude_test.go1
138:1doc-comment-period
internal/archiver/exclude_test.go:138:1
// TestIsExcludedByFileSize is for testing the instance of// --exclude-larger-than parametersfunc TestIsExcludedByFileSize(t *testing.T) {internal/restic/backend_find.go1
36:4early-return
internal/restic/backend_find.go:36:4
if len(name) >= len(prefix) && prefix == name[:len(prefix)] { if match.IsNull() { match = idinternal/backend/cache/backend_test.go1
117:12error-strings
internal/backend/cache/backend_test.go:117:12
if !wbe.IsNotExist(err) { t.Errorf("Stat() returned error that does not match IsNotExist(): %v", err) }internal/repository/repository_test.go1
177:4excessive-blank-identifiers
internal/repository/repository_test.go:177:4
for i := 0; i < t.N; i++ { _, _, _, err = uploader.SaveBlob(ctx, restic.DataBlob, data, id, true) rtest.OK(t, err)cmd/restic/cmd_ls.go1
200:8exported-declaration-comment
cmd/restic/cmd_ls.go:200:8
func (p *ncduLsPrinter) Snapshot(sn *data.Snapshot) error { const NcduMajorVer = 1 const NcduMinorVer = 2internal/backend/test/tests.go1
1:1file-length-limit
internal/backend/test/tests.go:1:1
package testcmd/restic/cmd_snapshots.go1
203:87flag-parameter
cmd/restic/cmd_snapshots.go:203:87
// PrintSnapshots prints a text table of the snapshots in list to stdout.func PrintSnapshots(stdout io.Writer, list data.Snapshots, reasons []data.KeepReason, compact bool) error { // keep the reasons a snasphot is being kept in a map, so that it doesn'tcmd/restic/cmd_copy_integration_test.go1
1:1format
cmd/restic/cmd_copy_integration_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_copy_integration_test.go`
cmd/restic/cmd_ls.go1
316:6function-length
cmd/restic/cmd_ls.go:316:6
func runLs(ctx context.Context, opts LsOptions, gopts global.Options, args []string, term ui.Terminal) error { termPrinter := progress.NewTerminalPrinter(gopts.JSON, gopts.Verbosity, term)internal/data/testing.go1
225:30function-result-limit
internal/data/testing.go:225:30
func (t TestWritableTreeMap) SaveBlob(_ context.Context, tpe restic.BlobType, buf []byte, id restic.ID, _ bool) (newID restic.ID, known bool, size int, err error) { if tpe != restic.TreeBlob {internal/restorer/restorer_test.go1
1436:5identical-switch-branches
internal/restorer/restorer_test.go:1436:5
selectedForRestore = true case filepath.FromSlash("/dir2"): selectedForRestore = truecmd/restic/integration_helpers_test.go1
388:40import-shadowing
cmd/restic/integration_helpers_test.go:388:40
func appendRandomData(filename string, bytes uint) error { f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0666)internal/restorer/fileswriter.go1
191:4inefficient-map-lookup
internal/restorer/fileswriter.go:191:4
if wr, ok := bucket.files[path]; ok { bucket.files[path].users++ return wr, nilcmd/restic/cmd_check_integration_test.go1
42:3modifies-parameter
cmd/restic/cmd_check_integration_test.go:42:3
buf, err := withCaptureStdout(t, gopts, func(ctx context.Context, gopts global.Options) error { gopts.Verbosity = 2 _, err := runCheck(ctx, opts, gopts, args, gopts.Term)internal/filter/exclude.go1
131:3modifies-value-receiver
internal/filter/exclude.go:131:3
opts.Excludes = append(opts.Excludes, excludePatterns...) }cmd/restic/cmd_find.go1
210:25nested-structs
cmd/restic/cmd_find.go:210:25
func (s *statefulOutput) PrintObjectJSON(kind, id, nodepath, treeID string, sn *data.Snapshot) { b, err := json.Marshal(struct { // Add these attributesinternal/backend/gs/gs.go1
138:4nil-error-return
internal/backend/gs/gs.go:138:4
// however, the client doesn't have storage.bucket.get permission return be, nil }internal/fs/node_windows.go1
429:5no-else-after-return
internal/fs/node_windows.go:429:5
return false, nil } else { debug.Log("Checking extended attributes. Prepared volume name: %s, actual volume name: %s, isEASupportedVolume: %v, err: %v", volumeName, volumeNameActual, isEASupportedVolume, err)internal/backend/swift/config.go1
42:6no-init
internal/backend/swift/config.go:42:6
func init() { options.Register("swift", Config{})internal/data/snapshot_find.go1
89:2no-naked-return
internal/data/snapshot_find.go:89:2
id, subfolder, _ = strings.Cut(s, ":") return}cmd/restic/cmd_copy.go1
75:5no-package-var
cmd/restic/cmd_copy.go:75:5
var errSentinelEndIteration = errors.New("end iteration")cmd/restic/cmd_features.go1
1:9package-comments
cmd/restic/cmd_features.go:1:9
package maininternal/checker/checker.go1
232:26range-value-address
internal/checker/checker.go:232:26
debug.Log("tree %v references blob %v which isn't contained in index", id, blobID) errs = append(errs, &Error{TreeID: id, Err: errors.Errorf("file %q blob %v not found in index", node.Name, blobID)}) }internal/restic/progress_test.go1
14:5redefines-builtin-id
internal/restic/progress_test.go:14:5
c.Done() v, max := c.Get() if v != 0 || max != 0 {cmd/restic/cmd_list.go1
113:13redundant-conversion
cmd/restic/cmd_list.go:113:13
bar := printer.NewCounter("snapshot") bar.SetMax(uint64(1)) err = data.FindUsedBlobs(ctx, repo, []restic.ID{*sn.Tree}, usedBlobs, bar)internal/backend/test/tests.go1
894:8slice-preallocation
internal/backend/test/tests.go:894:8
var handles []backend.Handle for _, ts := range testStrings {internal/terminal/terminal_unix.go1
38:2task-comment
internal/terminal/terminal_unix.go:38:2
} // TODO actually read termcap db and detect if terminal supports what we need return term != "dumb"cmd/restic/cmd_find_integration_test.go1
50:1top-level-declaration-order
cmd/restic/cmd_find_integration_test.go:50:1
type testMatch struct { Path string `json:"path,omitempty"`internal/backend/sema/backend_test.go1
221:10unchecked-type-assertion
internal/backend/sema/backend_test.go:221:10
be := sema.NewBackend(m) fb := be.(backend.FreezeBackend)internal/archiver/testing.go1
46:7unused-receiver
internal/archiver/testing.go:46:7
func (d TestDir) String() string { return "<Dir>"cmd/restic/cmd_check.go1
583:43use-any
cmd/restic/cmd_check.go:583:43
func (*jsonErrorPrinter) PT(_ string, _ ...interface{}) {}func (*jsonErrorPrinter) V(_ string, _ ...interface{}) {}func (*jsonErrorPrinter) VV(_ string, _ ...interface{}) {}internal/archiver/archiver_test.go1
2666:20use-errors-new
internal/archiver/archiver_test.go:2666:20
var filteredErr error replacementErr := fmt.Errorf("replacement") arch.Error = func(item string, err error) error {internal/fs/const_windows.go1
10:7var-naming
internal/fs/const_windows.go:10:7
// It must not conflict with the other O_* values from go/src/syscall/types_windows.goconst O_NOFOLLOW int = 0x40000000cmd/restic/cmd_backup_integration_test.go1
414:64add-constant
cmd/restic/cmd_backup_integration_test.go:414:64
rtest.Assert(t, !includes(files, "/testdata/foo.tar.gz"), "expected file %q not in first snapshot, but it's included", "foo.tar.gz") rtest.Assert(t, !includes(files, "/testdata/private/secret/passwords.txt"),cmd/restic/cmd_cat.go1
70:6cognitive-complexity
cmd/restic/cmd_cat.go:70:6
func runCat(ctx context.Context, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(gopts.JSON, gopts.Verbosity, term)internal/backend/local/local.go1
55:6confusing-naming
internal/backend/local/local.go:55:6
// Open opens the local backend as specified by config.func Open(_ context.Context, cfg Config, _ func(string, ...interface{})) (*Local, error) { debug.Log("open local backend at %v", cfg.Path)cmd/restic/cmd_diff.go1
243:20cyclomatic-complexity
cmd/restic/cmd_diff.go:243:20
func (c *Comparer) diffTree(ctx context.Context, stats *DiffStatsContainer, prefix string, id1, id2 restic.ID) error { debug.Log("diffing %v to %v", id1, id2)cmd/restic/cmd_diff_integration_test.go1
45:7discarded-error-result
cmd/restic/cmd_diff_integration_test.go:45:7
_ = srcFile.Close() _ = dstFile.Close() return errinternal/backend/azure/azure.go1
221:1doc-comment-period
internal/backend/azure/azure.go:221:1
// Hasher may return a hash function for calculating a content hash for the backendfunc (be *Backend) Hasher() hash.Hash {internal/restorer/filerestorer.go1
147:4early-return
internal/restorer/filerestorer.go:147:4
packID := blob.PackID() if !file.state.HasMatchingBlob(idx) { if largeFile {internal/backend/cache/file.go1
78:21error-strings
internal/backend/cache/file.go:78:21
if rd == nil { return errors.New("Save() called with nil reader") }internal/repository/repository_test.go1
401:4excessive-blank-identifiers
internal/repository/repository_test.go:401:4
_, _, _, err = uploader.SaveBlob(ctx, restic.DataBlob, buf, restic.ID{}, false) rtest.OK(t, err)cmd/restic/cmd_ls.go1
201:8exported-declaration-comment
cmd/restic/cmd_ls.go:201:8
const NcduMajorVer = 1 const NcduMinorVer = 2internal/checker/checker_test.go1
1:1file-length-limit
internal/checker/checker_test.go:1:1
package checker_testcmd/restic/cmd_snapshots.go1
376:83flag-parameter
cmd/restic/cmd_snapshots.go:376:83
// printSnapshotGroupJSON writes the JSON representation of list to stdout.func printSnapshotGroupJSON(stdout io.Writer, snGroups map[string]data.Snapshots, grouped bool) error { if grouped {cmd/restic/cmd_debug.go1
1:1format
cmd/restic/cmd_debug.go:1:1
//go:build debug- Fix (safe): run `strider fmt cmd/restic/cmd_debug.go`
cmd/restic/cmd_mount.go1
123:6function-length
cmd/restic/cmd_mount.go:123:6
func runMount(ctx context.Context, opts MountOptions, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)internal/debug/debug.go1
129:6function-result-limit
internal/debug/debug.go:129:6
// taken from https://github.com/VividCortex/tracefunc getPosition() (fn, dir, file string, line int) { pc, file, line, ok := runtime.Caller(2)internal/ui/backup/json.go1
134:2identical-switch-branches
internal/ui/backup/json.go:134:2
}) case "file unchanged": b.print(verboseUpdate{helpers/build-release-binaries/main.go1
310:3import-shadowing
helpers/build-release-binaries/main.go:310:3
for _, platform := range platforms { os, arch, _ := strings.Cut(platform, "/") targets[os] = append(targets[os], arch)internal/walker/walker_test.go1
71:3inefficient-map-lookup
internal/walker/walker_test.go:71:3
if _, ok := m[id]; !ok { m[id] = buf }cmd/restic/cmd_copy.go1
128:3modifies-parameter
cmd/restic/cmd_copy.go:128:3
// swap global options, if the secondary repo was set via from-repo gopts, secondaryGopts = secondaryGopts, gopts }internal/filter/exclude.go1
144:3modifies-value-receiver
internal/filter/exclude.go:144:3
opts.InsensitiveExcludes = append(opts.InsensitiveExcludes, excludes...) }cmd/restic/cmd_find.go1
280:24nested-structs
cmd/restic/cmd_find.go:280:24
out statefulOutput blobIDs map[string]struct{} treeIDs map[string]struct{}internal/backend/limiter/limiter_backend_test.go1
32:4nil-error-return
internal/backend/limiter/limiter_backend_test.go:32:4
if err != nil { return nil }internal/fs/sd_windows.go1
54:5no-else-after-return
internal/fs/sd_windows.go:54:5
return getSecurityDescriptor(filePath) } else if errors.Is(err, windows.ERROR_NOT_SUPPORTED) { return nil, nilinternal/data/node.go1
54:6no-init
internal/data/node.go:54:6
// init is called when the package is initialized. Any new GenericAttributeTypes being created must be added here as well.func init() { storeGenericAttributeType(TypeCreationTime, TypeFileAttributes, TypeSecurityDescriptor)internal/fs/ea_windows.go1
78:2no-naked-return
internal/fs/ea_windows.go:78:2
} return}cmd/restic/cmd_diff_integration_test.go1
64:5no-package-var
cmd/restic/cmd_diff_integration_test.go:64:5
var diffOutputRegexPatterns = []string{ "-.+modfile",cmd/restic/cmd_find.go1
1:9package-comments
cmd/restic/cmd_find.go:1:9
package maininternal/data/snapshot_policy_test.go1
260:17range-value-address
internal/data/snapshot_policy_test.go:260:17
if policySum(&p) > 0 && len(keep) > policySum(&p) { t.Errorf("not enough snapshots removed: policy allows %v snapshots to remain, but ended up with %v",internal/ui/progress/counter.go1
22:9redefines-builtin-id
internal/ui/progress/counter.go:22:9
Updater value, max atomic.Uint64}cmd/restic/cmd_ls_integration_test.go1
59:18redundant-conversion
cmd/restic/cmd_ls_integration_test.go:59:18
func TestRunLsSort(t *testing.T) { rtest.Equals(t, SortMode(0), SortModeName, "unexpected default sort mode")internal/data/find_test.go1
58:6slice-preallocation
internal/data/find_test.go:58:6
var hs restic.BlobHandles for h := range s {cmd/restic/cmd_forget.go1
65:1top-level-declaration-order
cmd/restic/cmd_forget.go:65:1
type ForgetPolicyCount intinternal/backend/sftp/sftp.go1
460:27unchecked-type-assertion
internal/backend/sftp/sftp.go:460:27
_, rderr := rd.Read([]byte{0}) if rderr == io.EOF && rd.(*util.LimitedReadCloser).N != 0 { // file is too shortinternal/archiver/testing.go1
55:7unused-receiver
internal/archiver/testing.go:55:7
func (f TestFile) String() string { return "<File>"cmd/restic/cmd_check.go1
584:44use-any
cmd/restic/cmd_check.go:584:44
func (*jsonErrorPrinter) V(_ string, _ ...interface{}) {}func (*jsonErrorPrinter) VV(_ string, _ ...interface{}) {}internal/archiver/archiver_test.go1
2674:9use-errors-new
internal/archiver/archiver_test.go:2674:9
node: &data.Node{Type: data.NodeTypeFile}, err: fmt.Errorf("not found"), }internal/fs/const_windows.go1
13:7var-naming
internal/fs/const_windows.go:13:7
// O_DIRECTORY is a noop on Windows.const O_DIRECTORY int = 0cmd/restic/cmd_backup_integration_test.go1
416:3add-constant
cmd/restic/cmd_backup_integration_test.go:416:3
rtest.Assert(t, !includes(files, "/testdata/private/secret/passwords.txt"), "expected file %q not in first snapshot, but it's included", "passwords.txt")}cmd/restic/cmd_check.go1
97:6cognitive-complexity
cmd/restic/cmd_check.go:97:6
func checkFlags(opts CheckOptions) error { if opts.ReadData && opts.ReadDataSubset != "" {internal/backend/retry/backend_retry_test.go1
324:6confusing-naming
internal/backend/retry/backend_retry_test.go:324:6
func TestBackendLoadNotExists(t *testing.T) { // Without HasFlakyErrors, should fail after 1 attemptcmd/restic/cmd_diff.go1
357:6cyclomatic-complexity
cmd/restic/cmd_diff.go:357:6
func runDiff(ctx context.Context, opts DiffOptions, gopts global.Options, args []string, term ui.Terminal) error { if len(args) != 2 {cmd/restic/cmd_diff_integration_test.go1
52:7discarded-error-result
cmd/restic/cmd_diff_integration_test.go:52:7
// ignore subsequent errors _ = dstFile.Close() return errinternal/backend/azure/azure.go1
461:1doc-comment-period
internal/backend/azure/azure.go:461:1
// Close does nothingfunc (be *Backend) Close() error { return nil }internal/backend/cache/file_test.go1
127:14error-strings
internal/backend/cache/file_test.go:127:14
if !maps.Equal(list2, want) { t.Errorf("ClearIndexes removed indexes, want:\n %v\ngot:\n %v", list2, want) }cmd/restic/cmd_ls.go1
213:7exported-declaration-comment
cmd/restic/cmd_ls.go:213:7
func lsNcduOutput(node lsNodeOutput) ([]byte, error) { type NcduNode struct { Name string `json:"name"`internal/data/tree_test.go1
1:1file-length-limit
internal/data/tree_test.go:1:1
package data_testcmd/restic/cmd_snapshots_integration_test.go1
38:65flag-parameter
cmd/restic/cmd_snapshots_integration_test.go:38:65
func snapshotsGroupTestData(t *testing.T, env *testEnvironment, keepPath bool) string { testSetupBackupData(t, env)cmd/restic/cmd_debug_disabled.go1
1:1format
cmd/restic/cmd_debug_disabled.go:1:1
//go:build !debug- Fix (safe): run `strider fmt cmd/restic/cmd_debug_disabled.go`
cmd/restic/cmd_mount_integration_test.go1
94:6function-length
cmd/restic/cmd_mount_integration_test.go:94:6
func checkSnapshots(t testing.TB, gopts global.Options, mountpoint string, snapshotIDs restic.IDs, expectedSnapshotsInFuseDir int) { t.Logf("checking for %d snapshots: %v", len(snapshotIDs), snapshotIDs)internal/repository/repository.go1
624:25function-result-limit
internal/repository/repository.go:624:25
func (r *blobSaverRepo) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool) (newID restic.ID, known bool, size int, err error) { return r.repo.saveBlob(ctx, t, buf, id, storeDuplicate)internal/ui/backup/text.go1
109:2identical-switch-branches
internal/ui/backup/text.go:109:2
d.Seconds(), ui.FormatBytes(s.DataSize), ui.FormatBytes(s.DataSizeInRepo)) case "file unchanged": b.VV("unchanged %v", item)internal/archiver/archiver.go1
29:60import-shadowing
internal/archiver/archiver.go:29:60
// dirs). If false is returned, files are ignored and dirs are not even walked.type SelectFunc func(item string, fi *fs.ExtendedFileInfo, fs fs.FS) boolcmd/restic/cmd_copy.go1
352:2modifies-parameter
cmd/restic/cmd_copy.go:352:2
func copySaveSnapshot(ctx context.Context, sn *data.Snapshot, dstRepo restic.Repository, printer restic.Printer) error { sn.Parent = nil // Parent does not have relevance in the new repo. // Use Original as a persistent snapshot IDinternal/filter/include.go1
44:3modifies-value-receiver
internal/filter/include.go:44:3
opts.Includes = append(opts.Includes, includePatterns...) }cmd/restic/cmd_find.go1
281:24nested-structs
cmd/restic/cmd_find.go:281:24
blobIDs map[string]struct{} treeIDs map[string]struct{} itemsFound intinternal/backend/s3/s3.go1
499:5nil-error-return
internal/backend/s3/s3.go:499:5
case "InvalidObjectState": return false, nil case "RestoreAlreadyInProgress":internal/fs/sd_windows.go1
56:5no-else-after-return
internal/fs/sd_windows.go:56:5
return nil, nil } else { return nil, fmt.Errorf("get named security info failed with: %w", err)internal/feature/registry.go1
17:6no-init
internal/feature/registry.go:17:6
func init() { Flag.SetFlags(map[FlagName]FlagDesc{internal/fs/ea_windows.go1
154:2no-naked-return
internal/fs/ea_windows.go:154:2
status = ntStatus(r0) return}cmd/restic/cmd_find.go1
27:5no-package-var
cmd/restic/cmd_find.go:27:5
// errFindDone is returned from the tree walk when all requested tree IDs were found.var errFindDone = errors.New("find: all tree IDs found")cmd/restic/cmd_forget.go1
1:9package-comments
cmd/restic/cmd_forget.go:1:9
package maininternal/data/snapshot_policy_test.go1
260:50range-value-address
internal/data/snapshot_policy_test.go:260:50
if policySum(&p) > 0 && len(keep) > policySum(&p) { t.Errorf("not enough snapshots removed: policy allows %v snapshots to remain, but ended up with %v",internal/ui/progress/counter.go1
46:26redefines-builtin-id
internal/ui/progress/counter.go:46:26
// SetMax sets the maximum expected counter value. This method is concurrency-safe.func (c *Counter) SetMax(max uint64) { c.max.Store(max)cmd/restic/cmd_repair_packs_integration_test.go1
62:35redundant-conversion
cmd/restic/cmd_repair_packs_integration_test.go:62:35
rtest.Assert(t, err != nil, "expected check errors, got none") rtest.Assert(t, strings.Contains(string(outError), packIDString), "expected mention of %q", packIDString)internal/feature/features.go1
124:6slice-preallocation
internal/feature/features.go:124:6
func (f *FlagSet) List() []Help { var help []Helpcmd/restic/cmd_generate.go1
43:1top-level-declaration-order
cmd/restic/cmd_generate.go:43:1
type generateOptions struct { ManDir stringinternal/backend/watchdog_roundtriper_test.go1
62:7unchecked-type-assertion
internal/backend/watchdog_roundtriper_test.go:62:7
_, _ = w.Write(data[:2]) w.(http.Flusher).Flush() data = data[2:]internal/archiver/testing.go1
64:7unused-receiver
internal/archiver/testing.go:64:7
func (s TestSymlink) String() string { return "<Symlink>"cmd/restic/cmd_debug.go1
96:41use-any
cmd/restic/cmd_debug.go:96:41
func prettyPrintJSON(wr io.Writer, item interface{}) error { buf, err := json.MarshalIndent(item, "", " ")internal/archiver/archiver_test.go1
2687:9use-errors-new
internal/archiver/archiver_test.go:2687:9
node: &data.Node{Type: data.NodeTypeIrregular}, err: fmt.Errorf(`unsupported file type "irregular"`), }internal/fs/ea_windows.go1
92:2var-naming
internal/fs/ea_windows.go:92:2
// Windows NTSTATUS value: STATUS_NO_EAS_ON_FILE=0xC0000052 STATUS_NO_EAS_ON_FILE = -1073741742)cmd/restic/cmd_backup_integration_test.go1
472:9add-constant
cmd/restic/cmd_backup_integration_test.go:472:9
} t.Logf("repository grown by %d bytes", stat2.size-stat1.size)cmd/restic/cmd_check.go1
229:6cognitive-complexity
cmd/restic/cmd_check.go:229:6
func runCheck(ctx context.Context, opts CheckOptions, gopts global.Options, args []string, term ui.Terminal) (checkSummary, error) { summary := checkSummary{MessageType: "summary"}internal/backend/s3/s3.go1
200:6confusing-naming
internal/backend/s3/s3.go:200:6
// does not exist yet.func Open(_ context.Context, cfg Config, rt http.RoundTripper, _ func(string, ...interface{})) (backend.Backend, error) { return open(cfg, rt)cmd/restic/cmd_diff_integration_test.go1
151:6cyclomatic-complexity
cmd/restic/cmd_diff_integration_test.go:151:6
func TestDiffJSON(t *testing.T) { env, cleanup, firstSnapshotID, secondSnapshotID := setupDiffRepo(t)cmd/restic/cmd_dump.go1
190:8discarded-error-result
cmd/restic/cmd_dump.go:190:8
defer func() { _ = file.Close() }()internal/backend/azure/azure.go1
464:1doc-comment-period
internal/backend/azure/azure.go:464:1
// Warmup not implementedfunc (be *Backend) Warmup(_ context.Context, _ []backend.Handle) ([]backend.Handle, error) {internal/backend/cache/file_test.go1
134:14error-strings
internal/backend/cache/file_test.go:134:14
if !maps.Equal(list3, want) { t.Errorf("ClearIndexes returned a wrong list, want:\n %v\ngot:\n %v", want, list3) }cmd/restic/cmd_ls.go1
584:2exported-declaration-comment
cmd/restic/cmd_ls.go:584:2
const ( SortModeName SortMode = iota SortModeSizeinternal/fs/node_windows_test.go1
1:1file-length-limit
internal/fs/node_windows_test.go:1:1
//go:build windowscmd/restic/find.go1
13:79flag-parameter
cmd/restic/find.go:13:79
// MUST be followed by finalizeSnapshotFilter after flag parsingfunc initMultiSnapshotFilter(flags *pflag.FlagSet, filt *data.SnapshotFilter, addHostShorthand bool) { hostShorthand := "H"cmd/restic/cmd_diff.go1
1:1format
cmd/restic/cmd_diff.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_diff.go`
cmd/restic/cmd_recover.go1
45:6function-length
cmd/restic/cmd_recover.go:45:6
func runRecover(ctx context.Context, gopts global.Options, term ui.Terminal) error { hostname, err := os.Hostname()internal/repository/repository.go1
1021:22function-result-limit
internal/repository/repository.go:1021:22
// occupies in the repo (compressed or not, including encryption overhead).func (r *Repository) saveBlob(ctx context.Context, t restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool) (newID restic.ID, known bool, size int, err error) {internal/ui/restore/json.go1
74:2identical-switch-branches
internal/ui/restore/json.go:74:2
action = "restored" case restorer.ActionFileRestored: action = "restored"internal/archiver/archiver.go1
134:20import-shadowing
internal/archiver/archiver.go:134:20
// for excluded items ExcludedItem func(path string)}cmd/restic/cmd_copy.go1
355:3modifies-parameter
cmd/restic/cmd_copy.go:355:3
if sn.Original == nil { sn.Original = sn.ID() }internal/filter/include.go1
57:3modifies-value-receiver
internal/filter/include.go:57:3
opts.InsensitiveIncludes = append(opts.InsensitiveIncludes, includePatterns...) }cmd/restic/cmd_find.go1
435:25nested-structs
cmd/restic/cmd_find.go:435:25
// Replace the short ID with the long one f.blobIDs[idStr] = struct{}{} delete(f.blobIDs, id.Str())internal/backend/s3/s3.go1
501:5nil-error-return
internal/backend/s3/s3.go:501:5
case "RestoreAlreadyInProgress": return true, nil }internal/fs/sd_windows.go1
124:5no-else-after-return
internal/fs/sd_windows.go:124:5
return setSecurityDescriptor(filePath, securityDescriptor) } else { return fmt.Errorf("set named security info failed with: %w", err)internal/fs/fs_local.go1
11:6no-init
internal/fs/fs_local.go:11:6
func init() { if err := enableProcessPrivileges(); err != nil {internal/fs/ea_windows.go1
160:2no-naked-return
internal/fs/ea_windows.go:160:2
status = ntStatus(r0) return}cmd/restic/cmd_find.go1
106:5no-package-var
cmd/restic/cmd_find.go:106:5
var timeFormats = []string{ "2006-01-02",cmd/restic/cmd_generate.go1
1:9package-comments
cmd/restic/cmd_generate.go:1:9
package maininternal/data/snapshot_policy_test.go1
262:16range-value-address
internal/data/snapshot_policy_test.go:262:16
t.Errorf("not enough snapshots removed: policy allows %v snapshots to remain, but ended up with %v", policySum(&p), len(keep)) }internal/ui/progress/counter.go1
52:29redefines-builtin-id
internal/ui/progress/counter.go:52:29
// This method is concurrency-safe.func (c *Counter) Get() (v, max uint64) { return c.value.Load(), c.max.Load()cmd/restic/cmd_restore_integration_test.go1
297:90redundant-conversion
cmd/restic/cmd_restore_integration_test.go:297:90
testRunRestoreLatest(t, env.gopts, filepath.Join(env.base, "restore0"), nil, nil) rtest.OK(t, testFileSize(filepath.Join(env.base, "restore0", "testdata", "testfile.c"), int64(101)))internal/filter/filter.go1
259:2slice-preallocation
internal/filter/filter.go:259:2
func ParsePatterns(pattern []string) []Pattern { patpat := make([]Pattern, 0) for _, pat := range pattern {cmd/restic/cmd_init.go1
46:1top-level-declaration-order
cmd/restic/cmd_init.go:46:1
// InitOptions bundles all options for the init command.type InitOptions struct { global.SecondaryRepoOptionsinternal/backend/watchdog_roundtriper_test.go1
184:4unchecked-type-assertion
internal/backend/watchdog_roundtriper_test.go:184:4
_, _ = w.Write(data[:2]) w.(http.Flusher).Flush() data = data[2:]internal/archiver/testing.go1
73:7unused-receiver
internal/archiver/testing.go:73:7
func (s TestHardlink) String() string { return "<Hardlink>"cmd/restic/cmd_diff.go1
87:30use-any
cmd/restic/cmd_diff.go:87:30
printChange func(change *Change) printError func(string, ...interface{})}internal/archiver/archiver_test.go1
2717:16use-errors-new
internal/archiver/archiver_test.go:2717:16
}, overrideErr: fmt.Errorf(`unsupported file type "irregular"`), }internal/fs/ea_windows.go1
144:6var-naming
internal/fs/ea_windows.go:144:6
func getFileEA(handle windows.Handle, iosb *ioStatusBlock, buf *uint8, bufLen uint32, returnSingleEntry bool, eaList uintptr, eaListLen uint32, eaIndex *uint32, restartScan bool) (status ntStatus) { var _p0 uint32 if returnSingleEntry {cmd/restic/cmd_backup_integration_test.go1
529:11add-constant
cmd/restic/cmd_backup_integration_test.go:529:11
if newest == nil { t.Fatal("expected a backup, got nil") }cmd/restic/cmd_check.go1
440:6cognitive-complexity
cmd/restic/cmd_check.go:440:6
func buildPacksFilter(opts CheckOptions, printer restic.Printer, filteredStatus bool) (func(packs map[restic.ID]int64) map[restic.ID]int64, error) {internal/backend/sftp/sftp.go1
162:6confusing-naming
internal/backend/sftp/sftp.go:162:6
func open(sftp *SFTP, cfg Config) (*SFTP, error) { fi, err := sftp.c.Stat(sftp.Layout.Filename(backend.Handle{Type: backend.ConfigFile}))cmd/restic/cmd_dump.go1
84:6cyclomatic-complexity
cmd/restic/cmd_dump.go:84:6
func printFromTree(ctx context.Context, tree data.TreeNodeIterator, repo restic.BlobLoader, prefix string, pathComponents []string, d *dump.Dumper, canWriteArchiveFunc func() error) error { // If we print / we need to assume that there are multiple nodes at thatcmd/restic/cmd_find.go1
172:10discarded-error-result
cmd/restic/cmd_find.go:172:10
if !s.inuse { _, _ = s.stdout.Write([]byte("[")) s.inuse = trueinternal/backend/b2/b2.go1
156:1doc-comment-period
internal/backend/b2/b2.go:156:1
// Hasher may return a hash function for calculating a content hash for the backendfunc (be *b2Backend) Hasher() hash.Hash {internal/backend/httpuseragent_roundtripper_test.go1
14:13error-strings
internal/backend/httpuseragent_roundtripper_test.go:14:13
if userAgent != "TestUserAgent" { t.Errorf("Expected User-Agent: TestUserAgent, got: %s", userAgent) }cmd/restic/cmd_ls.go1
585:2exported-declaration-comment
cmd/restic/cmd_ls.go:585:2
SortModeName SortMode = iota SortModeSize SortModeAtimeinternal/fs/vss_windows.go1
1:1file-length-limit
internal/fs/vss_windows.go:1:1
//go:build windowscmd/restic/format.go1
12:39flag-parameter
cmd/restic/format.go:12:39
func formatNodeOutput(n lsNodeOutput, long bool, human bool) string { if !long {cmd/restic/cmd_diff_integration_test.go1
1:1format
cmd/restic/cmd_diff_integration_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_diff_integration_test.go`
cmd/restic/cmd_repair_snapshots.go1
112:6function-length
cmd/restic/cmd_repair_snapshots.go:112:6
func runRepairSnapshots(ctx context.Context, gopts global.Options, opts RepairOptions, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)internal/ui/restore/json.go1
76:2identical-switch-branches
internal/ui/restore/json.go:76:2
action = "restored" case restorer.ActionOtherRestored: action = "restored"internal/archiver/archiver_test.go1
451:50import-shadowing
internal/archiver/archiver_test.go:451:50
func appendToFile(t testing.TB, filename string, data []byte) { f, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)cmd/restic/cmd_diff.go1
165:4modifies-parameter
cmd/restic/cmd_diff.go:165:4
case restic.DataBlob: stats.DataBlobs++ case restic.TreeBlob:internal/options/options.go1
90:2modifies-value-receiver
internal/options/options.go:90:2
func (h helpList) Swap(i, j int) { h[i], h[j] = h[j], h[i]}cmd/restic/cmd_find.go1
451:30nested-structs
cmd/restic/cmd_find.go:451:30
case restic.DataBlob: f.blobIDs[h.ID.String()] = struct{}{} case restic.TreeBlob:internal/backend/sftp/sftp.go1
219:4nil-error-return
internal/backend/sftp/sftp.go:219:4
if fi, statErr := r.c.Lstat(dir); statErr == nil && fi.IsDir() { return nil }internal/fs/vss_windows.go1
969:4no-else-after-return
internal/fs/vss_windows.go:969:4
return vssSnapshot{}, err } else if !isSupported { iVssBackupComponents.Release()internal/fs/fs_local_vss.go2
22:6no-init
internal/fs/fs_local_vss.go:22:6
func init() { if runtime.GOOS == "windows" {73:3no-naked-return
internal/fs/fs_local_vss.go:73:3
if list == "" { return }cmd/restic/cmd_find.go1
446:5no-package-var
cmd/restic/cmd_find.go:446:5
var errAllPacksFound = errors.New("all packs found")cmd/restic/cmd_init.go1
1:9package-comments
cmd/restic/cmd_init.go:1:9
package maininternal/data/tree_test.go1
77:33range-value-address
internal/data/tree_test.go:77:33
for i, n := range testNodes { nodeData, err := json.Marshal(&n) rtest.OK(t, err)internal/ui/progress/terminal.go1
31:32redefines-builtin-id
internal/ui/progress/terminal.go:31:32
// newProgressMax returns a progress.Counter that prints to terminal if provided.func newProgressMax(show bool, max uint64, description string, term ui.Terminal) restic.Counter { if !show {cmd/restic/cmd_restore_integration_test.go1
318:35redundant-conversion
cmd/restic/cmd_restore_integration_test.go:318:35
testRunRestoreLatest(t, env.gopts, filepath.Join(env.base, "restore1"), []string{filepath.Dir(p1)}, nil) rtest.OK(t, testFileSize(p1rAbs, int64(102))) if _, err := os.Stat(p2rAbs); os.IsNotExist(err) {internal/filter/filter_patterns_test.go1
25:2slice-preallocation
internal/filter/filter_patterns_test.go:25:2
// Test all patterns defined in matchTests are valid patterns := make([]string, 0)cmd/restic/cmd_key_add.go1
45:1top-level-declaration-order
cmd/restic/cmd_key_add.go:45:1
type KeyAddOptions struct { NewPasswordFile stringinternal/fs/node_unix_test.go1
37:18unchecked-type-assertion
internal/fs/node_unix_test.go:37:18
stat := fi.Sys().(*syscall.Stat_t)internal/backend/azure/azure.go1
196:7unused-receiver
internal/backend/azure/azure.go:196:7
// IsNotExist returns true if the error is caused by a not existing file.func (be *Backend) IsNotExist(err error) bool { return bloberror.HasCode(err, bloberror.BlobNotFound)cmd/restic/cmd_diff.go1
161:114use-any
cmd/restic/cmd_diff.go:161:114
// updateBlobs updates the blob counters in the stats struct.func updateBlobs(repo restic.Loader, blobs restic.AssociatedBlobSet, stats *DiffStat, printError func(string, ...interface{})) { for h := range blobs.Keys() {internal/archiver/exclude.go1
97:15use-errors-new
internal/archiver/exclude.go:97:15
if colon == 0 { return nil, fmt.Errorf("no name for exclusion tagfile provided") }internal/fs/ea_windows.go1
148:6var-naming
internal/fs/ea_windows.go:148:6
} var _p1 uint32 if restartScan {cmd/restic/cmd_backup_integration_test.go1
694:76add-constant
cmd/restic/cmd_backup_integration_test.go:694:76
err := testRunBackupAssumeFailure(t, filepath.Dir(env.testdata), []string{"python", "-c", "import sys; print('test'); sys.exit(1)"}, opts, env.gopts) rtest.Assert(t, err != nil, "Expected error while backing up")cmd/restic/cmd_copy.go1
120:6cognitive-complexity
cmd/restic/cmd_copy.go:120:6
func runCopy(ctx context.Context, opts CopyOptions, gopts global.Options, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)internal/data/snapshot.go1
125:20confusing-naming
internal/data/snapshot.go:125:20
// ID returns the snapshot's ID.func (sn Snapshot) ID() *restic.ID { return sn.idcmd/restic/cmd_dump.go1
135:6cyclomatic-complexity
cmd/restic/cmd_dump.go:135:6
func runDump(ctx context.Context, opts DumpOptions, gopts global.Options, args []string, term ui.Terminal) error { if len(args) != 2 {cmd/restic/cmd_find.go1
179:10discarded-error-result
cmd/restic/cmd_find.go:179:10
} _, _ = s.stdout.Write([]byte(`{"matches":[`)) s.oldsn = s.newsninternal/backend/b2/b2.go1
327:1doc-comment-period
internal/backend/b2/b2.go:327:1
// Close does nothingfunc (be *b2Backend) Close() error { return nil }internal/backend/httpuseragent_roundtripper_test.go1
48:12error-strings
internal/backend/httpuseragent_roundtripper_test.go:48:12
if resp.StatusCode != http.StatusOK { t.Errorf("Expected status code: %d, got: %d", http.StatusOK, resp.StatusCode) }cmd/restic/cmd_ls.go1
586:2exported-declaration-comment
cmd/restic/cmd_ls.go:586:2
SortModeSize SortModeAtime SortModeCtimeinternal/global/global.go1
1:1file-length-limit
internal/global/global.go:1:1
package globalcmd/restic/format.go1
12:50flag-parameter
cmd/restic/format.go:12:50
func formatNodeOutput(n lsNodeOutput, long bool, human bool) string { if !long {cmd/restic/cmd_dump.go1
1:1format
cmd/restic/cmd_dump.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_dump.go`
cmd/restic/cmd_restore.go1
99:6function-length
cmd/restic/cmd_restore.go:99:6
func runRestore(ctx context.Context, opts RestoreOptions, gopts global.Options, term ui.Terminal, args []string) error {internal/ui/restore/text.go1
53:2identical-switch-branches
internal/ui/restore/text.go:53:2
action = "restored" case restorer.ActionFileRestored: action = "restored"internal/archiver/archiver_test.go1
477:2import-shadowing
internal/archiver/archiver_test.go:477:2
data := rtest.Random(23, 512*1024+887898) testfile := filepath.Join(tempdir, "testfile")cmd/restic/cmd_diff.go1
167:4modifies-parameter
cmd/restic/cmd_diff.go:167:4
case restic.TreeBlob: stats.TreeBlobs++ }internal/options/options.go1
90:8modifies-value-receiver
internal/options/options.go:90:8
func (h helpList) Swap(i, j int) { h[i], h[j] = h[j], h[i]}cmd/restic/cmd_find.go1
453:30nested-structs
cmd/restic/cmd_find.go:453:30
case restic.TreeBlob: f.treeIDs[h.ID.String()] = struct{}{} default:internal/checker/checker.go1
105:4nil-error-return
internal/checker/checker.go:105:4
errs = append(errs, &SnapshotError{ID: id.String(), Message: err}) return nil }internal/fs/vss_windows.go1
989:5no-else-after-return
internal/fs/vss_windows.go:989:5
return vssSnapshot{}, err } else { breakinternal/migrations/upgrade_repo_v2.go1
11:6no-init
internal/migrations/upgrade_repo_v2.go:11:6
func init() { register(&UpgradeRepoV2{})internal/fs/fs_local_vss.go1
86:2no-naked-return
internal/fs/fs_local_vss.go:86:2
return}cmd/restic/cmd_forget.go1
67:5no-package-var
cmd/restic/cmd_forget.go:67:5
var ErrNegativePolicyCount = errors.New("negative values not allowed, use 'unlimited' instead")var ErrFailedToRemoveOneOrMoreSnapshots = errors.New("failed to remove one or more snapshots")cmd/restic/cmd_key.go1
1:9package-comments
cmd/restic/cmd_key.go:1:9
package maininternal/data/tree_test.go1
202:26range-value-address
internal/data/tree_test.go:202:26
for i := range nodes { rtest.OK(b, t.AddNode(&nodes[i])) }internal/ui/progress/terminal.go1
37:50redefines-builtin-id
internal/ui/progress/terminal.go:37:50
return NewCounter(interval, max, func(v uint64, max uint64, d time.Duration, final bool) { var status stringcmd/restic/cmd_restore_integration_test.go1
325:35redundant-conversion
cmd/restic/cmd_restore_integration_test.go:325:35
testRunRestoreLatest(t, env.gopts, filepath.Join(env.base, "restore2"), []string{filepath.Dir(p2)}, nil) rtest.OK(t, testFileSize(p2rAbs, int64(103))) if _, err := os.Stat(p1rAbs); os.IsNotExist(err) {internal/filter/filter_patterns_test.go1
40:2slice-preallocation
internal/filter/filter_patterns_test.go:40:2
// Test all patterns defined in childMatchTests are valid childPatterns := make([]string, 0)cmd/restic/cmd_key_integration_test.go1
214:1top-level-declaration-order
cmd/restic/cmd_key_integration_test.go:214:1
type emptySaveBackend struct { backend.Backendinternal/fs/node_unix_test.go1
81:18unchecked-type-assertion
internal/fs/node_unix_test.go:81:18
func checkDevice(t testing.TB, fi fs.FileInfo, node *data.Node) { stat := fi.Sys().(*syscall.Stat_t) if node.Device != uint64(stat.Rdev) {internal/backend/azure/azure.go1
222:7unused-receiver
internal/backend/azure/azure.go:222:7
// Hasher may return a hash function for calculating a content hash for the backendfunc (be *Backend) Hasher() hash.Hash { return md5.New()cmd/restic/cmd_find.go1
139:16use-any
cmd/restic/cmd_find.go:139:16
printer interface { S(string, ...interface{}) P(string, ...interface{})internal/backend/b2/b2.go1
34:19use-errors-new
internal/backend/b2/b2.go:34:19
var errTooShort = fmt.Errorf("file is too short")internal/fs/vss_windows.go1
27:2var-naming
internal/fs/vss_windows.go:27:2
const ( S_OK HRESULT = 0x00000000 S_FALSE HRESULT = 0x00000001cmd/restic/cmd_backup_integration_test.go1
694:86add-constant
cmd/restic/cmd_backup_integration_test.go:694:86
err := testRunBackupAssumeFailure(t, filepath.Dir(env.testdata), []string{"python", "-c", "import sys; print('test'); sys.exit(1)"}, opts, env.gopts) rtest.Assert(t, err != nil, "Expected error while backing up")cmd/restic/cmd_copy.go1
208:6cognitive-complexity
cmd/restic/cmd_copy.go:208:6
// data equivalent to at least 10 packfiles was written.func copyTreeBatched(ctx context.Context, srcRepo *repository.Repository, dstRepo restic.Repository, selectedSnapshots iter.Seq2[*data.Snapshot, error], printer restic.Printer) error {internal/data/snapshot_find.go1
112:26confusing-naming
internal/data/snapshot_find.go:112:26
// or a snapshot specified by `snapshotID`.func (f *SnapshotFilter) FindLatest(ctx context.Context, be restic.Lister, loader restic.LoaderUnpacked, snapshotID string) (*Snapshot, string, error) { id, subfolder := splitSnapshotID(snapshotID)cmd/restic/cmd_find.go2
596:6cyclomatic-complexity
cmd/restic/cmd_find.go:596:6
func runFind(ctx context.Context, opts FindOptions, gopts global.Options, args []string, term ui.Terminal) error { if len(args) == 0 {184:10discarded-error-result
cmd/restic/cmd_find.go:184:10
if s.hits > 0 { _, _ = s.stdout.Write([]byte(",")) }internal/backend/b2/b2.go1
330:1doc-comment-period
internal/backend/b2/b2.go:330:1
// Warmup not implementedfunc (be *b2Backend) Warmup(_ context.Context, _ []backend.Handle) ([]backend.Handle, error) {internal/backend/limiter/limiter_backend_test.go1
77:28error-strings
internal/backend/limiter/limiter_backend_test.go:77:28
if length != 0 || offset != 0 { return nil, fmt.Errorf("Not supported") }cmd/restic/cmd_ls.go1
587:2exported-declaration-comment
cmd/restic/cmd_ls.go:587:2
SortModeAtime SortModeCtime SortModeMtimeinternal/repository/checker.go1
1:1file-length-limit
internal/repository/checker.go:1:1
package repositorycmd/restic/integration_helpers_test.go1
312:79flag-parameter
cmd/restic/integration_helpers_test.go:312:79
func removePacksExcept(gopts global.Options, t testing.TB, keep restic.IDSet, removeTreePacks bool) { be := captureBackend(&gopts)cmd/restic/cmd_dump_test.go1
1:1format
cmd/restic/cmd_dump_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_dump_test.go`
cmd/restic/cmd_rewrite.go1
193:6function-length
cmd/restic/cmd_rewrite.go:193:6
func filterAndReplaceSnapshot(ctx context.Context, repo restic.Repository, sn *data.Snapshot, filter rewriteFilterFunc, dryRun bool, forget bool, newMetadata *snapshotMetadata, addTag string, printer restic.Printer,internal/ui/restore/text.go1
55:2identical-switch-branches
internal/ui/restore/text.go:55:2
action = "restored" case restorer.ActionOtherRestored: action = "restored"internal/archiver/archiver_test.go1
494:42import-shadowing
internal/archiver/archiver_test.go:494:42
func save(t testing.TB, filename string, data []byte) { f, err := os.Create(filename)cmd/restic/cmd_diff.go1
176:3modifies-parameter
cmd/restic/cmd_diff.go:176:3
stats.Bytes += uint64(size) }internal/restic/blob.go1
113:2modifies-value-receiver
internal/restic/blob.go:113:2
func (h BlobHandles) Swap(i, j int) { h[i], h[j] = h[j], h[i]}cmd/restic/cmd_find.go1
462:29nested-structs
cmd/restic/cmd_find.go:462:29
func (f *Finder) packsToBlobs(ctx context.Context, packs []string) error { packIDs := make(map[string]struct{}) for _, p := range packs {internal/checker/checker.go1
130:4nil-error-return
internal/checker/checker.go:130:4
errs = append(errs, &SnapshotError{ID: id, Message: err}) return nil } else if sn != nil {internal/fuse/snapshots_dir.go1
67:4no-else-after-return
internal/fuse/snapshots_dir.go:67:4
return nil, unwrapCtxCanceled(err) } else if meta == nil { return nil, syscall.ENOENTinternal/repository/lock_file_unix.go1
17:6no-init
internal/repository/lock_file_unix.go:17:6
func init() { ignoreSIGHUP.Do(func() {internal/repository/crypto/crypto.go1
233:2no-naked-return
internal/repository/crypto/crypto.go:233:2
tail = head[len(in):] return}cmd/restic/cmd_forget.go1
68:5no-package-var
cmd/restic/cmd_forget.go:68:5
var ErrNegativePolicyCount = errors.New("negative values not allowed, use 'unlimited' instead")var ErrFailedToRemoveOneOrMoreSnapshots = errors.New("failed to remove one or more snapshots")cmd/restic/cmd_key_add.go1
1:9package-comments
cmd/restic/cmd_key_add.go:1:9
package maininternal/fs/node_test.go1
220:30range-value-address
internal/fs/node_test.go:220:30
} rtest.OK(t, NodeCreateAt(&test, nodePath)) // Restore metadata, restoring all xattrsinternal/ui/table/table.go1
70:29redefines-builtin-id
internal/ui/table/table.go:70:29
func printLine(w io.Writer, print func(io.Writer, string) error, sep string, data []string, widths []int) error { var fields [][]stringcmd/restic/cmd_stats.go1
256:25redundant-conversion
cmd/restic/cmd_stats.go:256:25
} progress.Update(1, 0, uint64(node.Size)) if opts.countMode == countModeUniqueFilesByContents || opts.countMode == countModeBlobsPerFile {internal/fs/node_xattr_all_test.go1
111:3slice-preallocation
internal/fs/node_xattr_all_test.go:111:3
if runtime.GOOS == "windows" { out := []string{} for _, pattern := range patterns {cmd/restic/cmd_key_passwd.go1
46:1top-level-declaration-order
cmd/restic/cmd_key_passwd.go:46:1
type KeyPasswdOptions struct { KeyAddOptionsinternal/fs/node_windows.go1
369:19unchecked-type-assertion
internal/fs/node_windows.go:369:19
winFI := stat.sys.(*syscall.Win32FileAttributeData)internal/backend/azure/azure.go1
462:7unused-receiver
internal/backend/azure/azure.go:462:7
// Close does nothingfunc (be *Backend) Close() error { return nil }cmd/restic/cmd_find.go1
140:16use-any
cmd/restic/cmd_find.go:140:16
S(string, ...interface{}) P(string, ...interface{}) E(string, ...interface{})internal/backend/backend.go1
10:23use-errors-new
internal/backend/backend.go:10:23
var ErrNoRepository = fmt.Errorf("repository does not exist")internal/fs/vss_windows.go1
28:2var-naming
internal/fs/vss_windows.go:28:2
S_OK HRESULT = 0x00000000 S_FALSE HRESULT = 0x00000001 E_ACCESSDENIED HRESULT = 0x80070005cmd/restic/cmd_backup_integration_test.go1
709:18add-constant
cmd/restic/cmd_backup_integration_test.go:709:18
StdinCommand: true, StdinFilename: "stdin", }cmd/restic/cmd_copy_integration_test.go1
33:6cognitive-complexity
cmd/restic/cmd_copy_integration_test.go:33:6
func TestCopy(t *testing.T) { env, cleanup := withTestEnvironment(t)internal/data/snapshot_test.go1
34:6confusing-naming
internal/data/snapshot_test.go:34:6
func testLoadJSONUnpacked(t *testing.T, version uint) { repo, _, _ := repository.TestRepositoryWithVersion(t, version)cmd/restic/cmd_forget.go1
162:6cyclomatic-complexity
cmd/restic/cmd_forget.go:162:6
func verifyForgetOptions(opts *ForgetOptions) error { if opts.Last < -1 || opts.Hourly < -1 || opts.Daily < -1 || opts.Weekly < -1 ||cmd/restic/cmd_find.go1
186:9discarded-error-result
cmd/restic/cmd_find.go:186:9
} _, _ = s.stdout.Write(b) s.hits++internal/backend/backend.go1
140:1doc-comment-period
internal/backend/backend.go:140:1
// ApplyEnvironmenter fills in a backend configuration from the environmenttype ApplyEnvironmenter interface {internal/backend/local/layout_test.go1
55:14error-strings
internal/backend/local/layout_test.go:55:14
if len(packs) == 0 { t.Errorf("List() returned zero pack files") }cmd/restic/cmd_ls.go1
588:2exported-declaration-comment
cmd/restic/cmd_ls.go:588:2
SortModeCtime SortModeMtime SortModeExtinternal/repository/index/index.go1
1:1file-length-limit
internal/repository/index/index.go:1:1
package indexcmd/restic/lock.go1
11:72flag-parameter
cmd/restic/lock.go:11:72
func internalOpenWithLocked(ctx context.Context, gopts global.Options, dryRun bool, exclusive bool, printer restic.Printer) (context.Context, *repository.Repository, func(), error) { repo, err := global.OpenRepository(ctx, gopts, printer)cmd/restic/cmd_features.go1
1:1format
cmd/restic/cmd_features.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_features.go`
cmd/restic/cmd_snapshots.go1
203:6function-length
cmd/restic/cmd_snapshots.go:203:6
// PrintSnapshots prints a text table of the snapshots in list to stdout.func PrintSnapshots(stdout io.Writer, list data.Snapshots, reasons []data.KeepReason, compact bool) error { // keep the reasons a snasphot is being kept in a map, so that it doesn'tinternal/archiver/archiver_test.go1
688:4import-shadowing
internal/archiver/archiver_test.go:688:4
fs := fs.NewLocal() fiBefore, err := fs.Lstat(filename)cmd/restic/cmd_diff.go1
293:5modifies-parameter
cmd/restic/cmd_diff.go:293:5
mod += "M" stats.ChangedFiles++internal/restic/blob.go1
113:8modifies-value-receiver
internal/restic/blob.go:113:8
func (h BlobHandles) Swap(i, j int) { h[i], h[j] = h[j], h[i]}cmd/restic/cmd_find.go1
464:16nested-structs
cmd/restic/cmd_find.go:464:16
for _, p := range packs { packIDs[p] = struct{}{} }internal/data/snapshot.go1
132:3nil-error-return
internal/data/snapshot.go:132:3
if err != nil { return nil }internal/fuse/snapshots_dir.go1
110:4no-else-after-return
internal/fuse/snapshots_dir.go:110:4
return nil, unwrapCtxCanceled(err) } else if meta == nil { return nil, syscall.ENOENTinternal/repository/crypto/crypto_int_test.go1
86:2no-naked-return
internal/repository/crypto/crypto_int_test.go:86:2
copy(dst[:], data) return}cmd/restic/cmd_key_add.go1
96:5no-package-var
cmd/restic/cmd_key_add.go:96:5
// testKeyNewPassword is used to set a new password during integration testing.var testKeyNewPassword stringcmd/restic/cmd_key_list.go1
1:9package-comments
cmd/restic/cmd_key_list.go:1:9
package maininternal/fs/node_test.go1
222:37range-value-address
internal/fs/node_test.go:222:37
// Restore metadata, restoring all xattrs rtest.OK(t, NodeRestoreMetadata(&test, nodePath, func(msg string) { rtest.OK(t, fmt.Errorf("Warning triggered for path: %s: %s", nodePath, msg)) }, func(_ string) bool { return true }, ownershipByName))internal/ui/termstatus/stdio_wrapper.go1
12:2redefines-builtin-id
internal/ui/termstatus/stdio_wrapper.go:12:2
buf bytes.Buffer print func(string)}cmd/restic/cmd_stats.go1
445:16redundant-conversion
cmd/restic/cmd_stats.go:445:16
lowerBound := uint64(1) growthFactor := uint64(10)internal/repository/pack/pack_test.go1
46:2slice-preallocation
internal/repository/pack/pack_test.go:46:2
func createBuffers(t testing.TB, lengths []int) []Buf { bufs := []Buf{} for _, l := range lengths {cmd/restic/cmd_ls.go1
75:1top-level-declaration-order
cmd/restic/cmd_ls.go:75:1
// LsOptions collects all options for the ls command.type LsOptions struct { ListLong boolinternal/fs/node_windows.go1
394:27unchecked-type-assertion
internal/fs/node_windows.go:394:27
// Cache hit, immediately return the cached value return eaSupportedValue.(bool), nil }internal/backend/azure/azure.go1
465:7unused-receiver
internal/backend/azure/azure.go:465:7
// Warmup not implementedfunc (be *Backend) Warmup(_ context.Context, _ []backend.Handle) ([]backend.Handle, error) { return []backend.Handle{}, nilcmd/restic/cmd_find.go1
141:16use-any
cmd/restic/cmd_find.go:141:16
P(string, ...interface{}) E(string, ...interface{}) }internal/backend/limiter/limiter_backend_test.go1
35:11use-errors-new
internal/backend/limiter/limiter_backend_test.go:35:11
if !bytes.Equal(data, buf.Bytes()) { return fmt.Errorf("data mismatch") }internal/fs/vss_windows.go1
29:2var-naming
internal/fs/vss_windows.go:29:2
S_FALSE HRESULT = 0x00000001 E_ACCESSDENIED HRESULT = 0x80070005 E_OUTOFMEMORY HRESULT = 0x8007000Ecmd/restic/cmd_backup_test.go1
76:60add-constant
cmd/restic/cmd_backup_test.go:76:60
_, err = collectTargets(opts, []string{filepath.Join(dir, "cmdline arg"), filepath.Join(dir, "non-existing-file")}, t.Logf, nil) rtest.Assert(t, err == ErrInvalidSourceData, "expected error when not all targets exist")cmd/restic/cmd_debug.go1
161:6cognitive-complexity
cmd/restic/cmd_debug.go:161:6
func runDebugExamine(ctx context.Context, gopts global.Options, opts DebugExamineOptions, args []string, term ui.Terminal) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)internal/data/tree_test.go1
213:6confusing-naming
internal/data/tree_test.go:213:6
func testLoadTree(t *testing.T, version uint) { if rtest.BenchArchiveDirectory == "" {cmd/restic/cmd_forget.go1
178:6cyclomatic-complexity
cmd/restic/cmd_forget.go:178:6
func runForget(ctx context.Context, opts ForgetOptions, pruneOptions PruneOptions, gopts global.Options, term ui.Terminal, args []string) error { err := verifyForgetOptions(&opts)cmd/restic/cmd_find.go1
231:10discarded-error-result
cmd/restic/cmd_find.go:231:10
if !s.inuse { _, _ = s.stdout.Write([]byte("[")) s.inuse = trueinternal/backend/cache/dir.go1
9:1doc-comment-period
internal/backend/cache/dir.go:9:1
// EnvDir return $RESTIC_CACHE_DIR envfunc EnvDir() string {internal/backend/local/layout_test.go1
73:14error-strings
internal/backend/local/layout_test.go:73:14
if err = be.Close(); err != nil { t.Errorf("Close() returned error %v", err) }cmd/restic/cmd_ls.go1
589:2exported-declaration-comment
cmd/restic/cmd_ls.go:589:2
SortModeMtime SortModeExt SortModeInvalidinternal/repository/index/index_test.go1
1:1file-length-limit
internal/repository/index/index_test.go:1:1
package index_testinternal/archiver/archiver.go1
463:93flag-parameter
internal/archiver/archiver.go:463:93
// set); Excludes (`SelectByName` and `Select`) are skipped for that path only.func (arch *Archiver) save(ctx context.Context, snPath, target string, previous *data.Node, explicit bool) (fn futureNode, excluded bool, err error) { start := time.Now()cmd/restic/cmd_find.go1
1:1format
cmd/restic/cmd_find.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_find.go`
cmd/restic/cmd_stats.go1
98:6function-length
cmd/restic/cmd_stats.go:98:6
func runStats(ctx context.Context, opts StatsOptions, gopts global.Options, args []string, term ui.Terminal) error { err := verifyStatsInput(opts)internal/archiver/archiver_test.go1
1668:54import-shadowing
internal/archiver/archiver_test.go:1668:54
}, selFn: func(item string, fi *fs.ExtendedFileInfo, fs fs.FS) bool { return fs.Base(item) != "subdir"cmd/restic/cmd_diff.go1
326:5modifies-parameter
cmd/restic/cmd_diff.go:326:5
if node1.Type == data.NodeTypeDir { prefix += "/" }internal/restic/blob_set.go1
30:2modifies-value-receiver
internal/restic/blob_set.go:30:2
func (s BlobSet) Insert(h BlobHandle) { s[h] = struct{}{}}cmd/restic/cmd_find.go1
467:31nested-structs
cmd/restic/cmd_find.go:467:31
if f.blobIDs == nil { f.blobIDs = make(map[string]struct{}) }internal/fs/node.go1
305:4nil-error-return
internal/fs/node.go:305:4
path, err) return nil }internal/fuse/snapshots_dir.go1
123:5no-else-after-return
internal/fuse/snapshots_dir.go:123:5
return newSnapshotLink(d.root, forget, inode, entry.linkTarget, entry.snapshot) } else if entry.snapshot != nil { return newDirFromSnapshot(d.root, forget, inode, entry.snapshot)internal/repository/crypto/crypto_int_test.go1
95:2no-naked-return
internal/repository/crypto/crypto_int_test.go:95:2
copy(dst[:], data) return}cmd/restic/cmd_ls_test.go1
19:5no-package-var
cmd/restic/cmd_ls_test.go:19:5
var lsTestNodes = []lsTestNode{ // Mode is omitted when zero.cmd/restic/cmd_key_passwd.go1
1:9package-comments
cmd/restic/cmd_key_passwd.go:1:9
package maininternal/fs/node_windows_test.go1
358:51range-value-address
internal/fs/node_windows_test.go:358:51
for _, testNode := range expectedNodes { testPath, node := restoreAndGetNode(t, tempDir, &testNode, warningExpected) rawMessage := node.GenericAttributes[genericAttr]internal/ui/termstatus/stdio_wrapper.go1
17:20redefines-builtin-id
internal/ui/termstatus/stdio_wrapper.go:17:20
func newLineWriter(print func(string)) *lineWriter { return &lineWriter{print: print}cmd/restic/cmd_stats.go1
446:18redundant-conversion
cmd/restic/cmd_stats.go:446:18
lowerBound := uint64(1) growthFactor := uint64(10)internal/restorer/filerestorer_test.go1
158:6slice-preallocation
internal/restorer/filerestorer_test.go:158:6
var files []*fileInfo for _, file := range content {cmd/restic/cmd_ls_test.go1
19:1top-level-declaration-order
cmd/restic/cmd_ls_test.go:19:1
var lsTestNodes = []lsTestNode{ // Mode is omitted when zero.internal/fs/node_windows.go1
419:27unchecked-type-assertion
internal/fs/node_windows.go:419:27
// Cache hit, immediately return the cached value return eaSupportedValue.(bool), nil }internal/backend/azure/azure.go1
468:7unused-receiver
internal/backend/azure/azure.go:468:7
}func (be *Backend) WarmupWait(_ context.Context, _ []backend.Handle) error { return nil }cmd/restic/cmd_find.go1
284:16use-any
cmd/restic/cmd_find.go:284:16
printer interface { S(string, ...interface{}) P(string, ...interface{})internal/backend/limiter/limiter_backend_test.go1
77:17use-errors-new
internal/backend/limiter/limiter_backend_test.go:77:17
if length != 0 || offset != 0 { return nil, fmt.Errorf("Not supported") }internal/fs/vss_windows.go1
30:2var-naming
internal/fs/vss_windows.go:30:2
E_ACCESSDENIED HRESULT = 0x80070005 E_OUTOFMEMORY HRESULT = 0x8007000E E_INVALIDARG HRESULT = 0x80070057cmd/restic/cmd_cat.go1
94:7add-constant
cmd/restic/cmd_cat.go:94:7
switch tpe { case "config": buf, err := json.MarshalIndent(repo.Config(), "", " ")cmd/restic/cmd_diff.go1
180:20cognitive-complexity
cmd/restic/cmd_diff.go:180:20
func (c *Comparer) printDir(ctx context.Context, mode string, stats *DiffStat, blobs restic.AssociatedBlobSet, prefix string, id restic.ID) error { debug.Log("print %v tree %v", mode, id)internal/data/tree_test.go1
302:6confusing-naming
internal/data/tree_test.go:302:6
func benchmarkLoadTree(t *testing.B, version uint) { if rtest.BenchArchiveDirectory == "" {cmd/restic/cmd_generate.go1
115:6cyclomatic-complexity
cmd/restic/cmd_generate.go:115:6
func runGenerate(opts generateOptions, gopts global.Options, args []string, term ui.Terminal) error { if len(args) > 0 {cmd/restic/cmd_find.go1
235:10discarded-error-result
cmd/restic/cmd_find.go:235:10
if s.hits > 0 { _, _ = s.stdout.Write([]byte(",")) }internal/backend/gs/gs.go1
185:1doc-comment-period
internal/backend/gs/gs.go:185:1
// Hasher may return a hash function for calculating a content hash for the backendfunc (be *gs) Hasher() hash.Hash {internal/backend/sftp/layout_test.go1
59:14error-strings
internal/backend/sftp/layout_test.go:59:14
if len(packs) == 0 { t.Errorf("List() returned zero pack files") }cmd/restic/cmd_ls.go1
590:2exported-declaration-comment
cmd/restic/cmd_ls.go:590:2
SortModeExt SortModeInvalid)internal/repository/index/master_index.go1
1:1file-length-limit
internal/repository/index/master_index.go:1:1
package indexinternal/archiver/archiver_test.go1
429:38flag-parameter
internal/archiver/archiver_test.go:429:38
func (repo *blobCountingSaver) count(exists bool, h restic.BlobHandle) { if exists {cmd/restic/cmd_find_integration_test.go1
1:1format
cmd/restic/cmd_find_integration_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_find_integration_test.go`
cmd/restic/cmd_tag_integration_test.go1
18:6function-length
cmd/restic/cmd_tag_integration_test.go:18:6
func TestTag(t *testing.T) { env, cleanup := withTestEnvironment(t)internal/archiver/archiver_test.go1
1677:54import-shadowing
internal/archiver/archiver_test.go:1677:54
}, selFn: func(item string, fi *fs.ExtendedFileInfo, fs fs.FS) bool { return fs.IsAbs(item)cmd/restic/cmd_diff.go1
340:5modifies-parameter
cmd/restic/cmd_diff.go:340:5
if node2.Type == data.NodeTypeDir { prefix += "/" }internal/restic/ids.go1
20:2modifies-value-receiver
internal/restic/ids.go:20:2
func (ids IDs) Swap(i, j int) { ids[i], ids[j] = ids[j], ids[i]}cmd/restic/cmd_find.go1
470:31nested-structs
cmd/restic/cmd_find.go:470:31
if f.treeIDs == nil { f.treeIDs = make(map[string]struct{}) }internal/fs/node_xattr.go1
103:4nil-error-return
internal/fs/node_xattr.go:103:4
if ignoreListError && isListxattrPermissionError(err) { return nil }internal/repository/lock_file.go1
333:4no-else-after-return
internal/repository/lock_file.go:333:4
return err } else if !exists { return errRemovedLockinternal/repository/index/indexmap.go1
289:2no-naked-return
internal/repository/index/indexmap.go:289:2
idx = pos >> h.maskShift return}cmd/restic/cmd_prune_integration_test.go1
124:5no-package-var
cmd/restic/cmd_prune_integration_test.go:124:5
var pruneDefaultOptions = PruneOptions{MaxUnused: "5%"}cmd/restic/cmd_key_remove.go1
1:9package-comments
cmd/restic/cmd_key_remove.go:1:9
package maininternal/fs/node_windows_test.go1
433:51range-value-address
internal/fs/node_windows_test.go:433:51
for _, testNode := range expectedNodes { testPath, node := restoreAndGetNode(t, tempDir, &testNode, true) _, ua, err := genericAttributesToWindowsAttrs(node.GenericAttributes)cmd/restic/cmd_stats_test.go1
27:11redundant-conversion
cmd/restic/cmd_stats_test.go:27:11
h := newSizeHistogram(42) for i := uint64(0); i < 45; i++ { h.Add(i)internal/restorer/filerestorer_test.go1
160:3slice-preallocation
internal/restorer/filerestorer_test.go:160:3
for _, file := range content { content := restic.IDs{} for _, blob := range file.blobs {cmd/restic/cmd_migrate.go1
48:1top-level-declaration-order
cmd/restic/cmd_migrate.go:48:1
// MigrateOptions bundles all options for the 'check' command.type MigrateOptions struct { Force boolinternal/fs/node_windows_test.go1
252:18unchecked-type-assertion
internal/fs/node_windows_test.go:252:18
test.OK(t, errors.Wrapf(err, "Could not Lstat for path: %s", path)) attr := fi.Sys().(*syscall.Win32FileAttributeData) creationTimeAttribute := attr.CreationTimeinternal/backend/b2/b2.go1
157:7unused-receiver
internal/backend/b2/b2.go:157:7
// Hasher may return a hash function for calculating a content hash for the backendfunc (be *b2Backend) Hasher() hash.Hash { return nilcmd/restic/cmd_find.go1
285:16use-any
cmd/restic/cmd_find.go:285:16
S(string, ...interface{}) P(string, ...interface{}) E(string, ...interface{})internal/backend/limiter/limiter_backend_test.go1
99:12use-errors-new
internal/backend/limiter/limiter_backend_test.go:99:12
if !bytes.Equal(data, dataRead.Bytes()) { return fmt.Errorf("read broken data") }internal/fs/vss_windows.go1
31:2var-naming
internal/fs/vss_windows.go:31:2
E_OUTOFMEMORY HRESULT = 0x8007000E E_INVALIDARG HRESULT = 0x80070057 VSS_E_BAD_STATE HRESULT = 0x80042301cmd/restic/cmd_cat.go1
129:44add-constant
cmd/restic/cmd_cat.go:129:44
buf, err := json.MarshalIndent(&key, "", " ") if err != nil {cmd/restic/cmd_diff.go1
214:20cognitive-complexity
cmd/restic/cmd_diff.go:214:20
func (c *Comparer) collectDir(ctx context.Context, blobs restic.AssociatedBlobSet, id restic.ID) error { debug.Log("print tree %v", id)internal/dump/common.go1
115:18confusing-naming
internal/dump/common.go:115:18
func (d *Dumper) writeNode(ctx context.Context, w io.Writer, node *data.Node) error { wg, ctx := errgroup.WithContext(ctx)cmd/restic/cmd_list.go1
50:6cyclomatic-complexity
cmd/restic/cmd_list.go:50:6
func runList(ctx context.Context, gopts global.Options, args []string, term ui.Terminal, listAllowedArgsUseString string) error { printer := progress.NewTerminalPrinter(false, gopts.Verbosity, term)cmd/restic/cmd_find.go1
237:9discarded-error-result
cmd/restic/cmd_find.go:237:9
} _, _ = s.stdout.Write(b) s.hits++internal/backend/gs/gs.go1
349:1doc-comment-period
internal/backend/gs/gs.go:349:1
// Warmup not implementedfunc (be *gs) Warmup(_ context.Context, _ []backend.Handle) ([]backend.Handle, error) {internal/backend/sftp/layout_test.go1
77:14error-strings
internal/backend/sftp/layout_test.go:77:14
if err = be.Close(); err != nil { t.Errorf("Close() returned error %v", err) }cmd/restic/main.go1
31:5exported-declaration-comment
cmd/restic/main.go:31:5
var ErrOK = errors.New("ok")internal/repository/index/master_index_test.go1
1:1file-length-limit
internal/repository/index/master_index_test.go:1:1
package index_testinternal/archiver/scanner.go1
100:77flag-parameter
internal/archiver/scanner.go:100:77
// explicit is true when this path was an explicit backup target (same meaning as tree.Explicit on a leaf).func (s *Scanner) scan(ctx context.Context, stats ScanStats, target string, explicit bool) (ScanStats, error) { if ctx.Err() != nil {cmd/restic/cmd_forget.go1
1:1format
cmd/restic/cmd_forget.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_forget.go`
cmd/restic/main.go1
36:6function-length
cmd/restic/main.go:36:6
func newRootCommand(globalOptions *global.Options) *cobra.Command { cmd := &cobra.Command{internal/archiver/archiver_test.go1
1838:2import-shadowing
internal/archiver/archiver_test.go:1838:2
fs *MockFS}cmd/restic/cmd_find.go1
544:5modifies-parameter
cmd/restic/cmd_find.go:544:5
delete(packIDs, packID.Str()) packIDs[idStr] = struct{}{} matchingID = trueinternal/restic/ids.go1
20:10modifies-value-receiver
internal/restic/ids.go:20:10
func (ids IDs) Swap(i, j int) { ids[i], ids[j] = ids[j], ids[i]}cmd/restic/cmd_find.go1
482:21nested-structs
cmd/restic/cmd_find.go:482:21
delete(packIDs, id.Str()) packIDs[idStr] = struct{}{} }internal/repository/checker.go1
122:4nil-error-return
internal/repository/checker.go:122:4
errs = append(errs, err) return nil }internal/repository/repository.go1
136:4no-else-after-return
internal/repository/repository.go:136:4
return nil, fmt.Errorf("pack size larger than limit of %v MiB", MaxPackSize/1024/1024) } else if opts.PackSize < MinPackSize { return nil, fmt.Errorf("pack size smaller than minimum of %v MiB", MinPackSize/1024/1024)internal/restorer/restorer_test.go1
1439:5no-naked-return
internal/restorer/restorer_test.go:1439:5
} return },cmd/restic/main.go1
31:5no-package-var
cmd/restic/main.go:31:5
var ErrOK = errors.New("ok")cmd/restic/cmd_list.go1
1:9package-comments
cmd/restic/cmd_list.go:1:9
package maininternal/fs/node_windows_test.go1
469:51range-value-address
internal/fs/node_windows_test.go:469:51
for _, testNode := range expectedNodes { testPath, node := restoreAndGetNode(t, tempDir, &testNode, false)cmd/restic/integration_helpers_unix_test.go1
67:13redundant-conversion
cmd/restic/integration_helpers_unix_test.go:67:13
} linkTests[uint64(stat.Ino)] = append(linkTests[uint64(stat.Ino)], f.Name()) }internal/ui/table/table.go1
71:6slice-preallocation
internal/ui/table/table.go:71:6
func printLine(w io.Writer, print func(io.Writer, string) error, sep string, data []string, widths []int) error { var fields [][]stringcmd/restic/cmd_mount.go1
101:1top-level-declaration-order
cmd/restic/cmd_mount.go:101:1
// MountOptions collects all options for the mount command.type MountOptions struct { OwnerRoot boolinternal/fs/stat_bsd.go1
13:15unchecked-type-assertion
internal/fs/stat_bsd.go:13:15
func extendedStat(fi os.FileInfo) *ExtendedFileInfo { s := fi.Sys().(*syscall.Stat_t)internal/backend/b2/b2.go1
162:7unused-receiver
internal/backend/b2/b2.go:162:7
// IsNotExist returns true if the error is caused by a non-existing file.func (be *b2Backend) IsNotExist(err error) bool { // blazer/b2 does not export its error types and values,cmd/restic/cmd_find.go1
286:16use-any
cmd/restic/cmd_find.go:286:16
P(string, ...interface{}) E(string, ...interface{}) }internal/backend/limiter/static_limiter_test.go1
134:15use-errors-new
internal/backend/limiter/static_limiter_test.go:134:15
rt = limiter.Transport(roundTripper(func(req *http.Request) (*http.Response, error) { return nil, fmt.Errorf("error") }))internal/fs/vss_windows.go1
32:2var-naming
internal/fs/vss_windows.go:32:2
E_INVALIDARG HRESULT = 0x80070057 VSS_E_BAD_STATE HRESULT = 0x80042301 VSS_E_UNEXPECTED HRESULT = 0x80042302cmd/restic/cmd_cat.go1
136:7add-constant
cmd/restic/cmd_cat.go:136:7
return nil case "masterkey": buf, err := json.MarshalIndent(repo.Key(), "", " ")cmd/restic/cmd_diff.go1
243:20cognitive-complexity
cmd/restic/cmd_diff.go:243:20
func (c *Comparer) diffTree(ctx context.Context, stats *DiffStatsContainer, prefix string, id1, id2 restic.ID) error { debug.Log("diffing %v to %v", id1, id2)internal/filter/filter.go1
120:6confusing-naming
internal/filter/filter.go:120:6
func childMatch(pattern Pattern, strs []string) (matched bool, err error) { if pattern.parts[0].pattern != "/" {cmd/restic/cmd_ls.go1
316:6cyclomatic-complexity
cmd/restic/cmd_ls.go:316:6
func runLs(ctx context.Context, opts LsOptions, gopts global.Options, args []string, term ui.Terminal) error { termPrinter := progress.NewTerminalPrinter(gopts.JSON, gopts.Verbosity, term)cmd/restic/cmd_find.go1
267:11discarded-error-result
cmd/restic/cmd_find.go:267:11
if s.inuse { _, _ = s.stdout.Write([]byte("]\n")) } else {internal/backend/layout/layout_rest.go1
51:1doc-comment-period
internal/backend/layout/layout_rest.go:51:1
// Paths returns all directory namesfunc (l *RESTLayout) Paths() (dirs []string) {internal/backend/sftp/sftp.go1
397:24error-strings
internal/backend/sftp/sftp.go:397:24
_ = f.Close() return errors.Errorf("Write %v: wrote %d bytes instead of the expected %d bytes", tmpFilename, wbytes, rd.Length()) }helpers/build-release-binaries/main.go1
216:7exported-declaration-comment
helpers/build-release-binaries/main.go:216:7
type Job struct{ GOOS, GOARCH string }internal/repository/prune.go1
1:1file-length-limit
internal/repository/prune.go:1:1
package repositoryinternal/archiver/tree.go1
34:41flag-parameter
internal/archiver/tree.go:34:41
// tests for examples.func pathComponents(fs fs.FS, p string, includeRelative bool) (components []string, virtualPrefix bool) { volume := fs.VolumeName(p)cmd/restic/cmd_forget_integration_test.go1
1:1format
cmd/restic/cmd_forget_integration_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_forget_integration_test.go`
cmd/restic/main.go1
161:6function-length
cmd/restic/main.go:161:6
func main() { tweakGoGC()internal/archiver/archiver_test.go1
2420:48import-shadowing
internal/archiver/archiver_test.go:2420:48
func snapshot(t testing.TB, repo archiverRepo, fs fs.FS, parent *data.Snapshot, filename string) (*data.Snapshot, *data.Node) { ctx, cancel := context.WithCancel(context.Background())cmd/restic/cmd_find_integration_test.go1
21:3modifies-parameter
cmd/restic/cmd_find_integration_test.go:21:3
buf, err := withCaptureStdout(t, gopts, func(ctx context.Context, gopts global.Options) error { gopts.JSON = wantJSONinternal/restic/idset.go1
29:2modifies-value-receiver
internal/restic/idset.go:29:2
func (s IDSet) Insert(id ID) { s[id] = struct{}{}}cmd/restic/cmd_find.go1
527:76nested-structs
cmd/restic/cmd_find.go:527:76
func (f *Finder) indexPacksToBlobs(ctx context.Context, packIDs map[string]struct{}) (map[string]struct{}, error) { wctx, cancel := context.WithCancel(ctx)internal/repository/index/master_index_test.go1
443:5nil-error-return
internal/repository/index/master_index_test.go:443:5
if err != nil { return nil }internal/restorer/restorer.go1
495:4no-else-after-return
internal/restorer/restorer.go:495:4
return nil } else if err != nil { return errinternal/restorer/restorer_windows_test.go1
257:4no-naked-return
internal/restorer/restorer_windows_test.go:257:4
if attr == nil { return }cmd/restic/main.go1
33:5no-package-var
cmd/restic/main.go:33:5
var cmdGroupDefault = "default"var cmdGroupAdvanced = "advanced"cmd/restic/cmd_ls.go1
1:9package-comments
cmd/restic/cmd_ls.go:1:9
package maininternal/fs/node_windows_test.go1
491:21range-value-address
internal/fs/node_windows_test.go:491:21
if strings.EqualFold(ea.Name, expectedExtAttr.Name) { foundExtAttr = &ea breakcmd/restic/integration_helpers_unix_test.go1
67:50redundant-conversion
cmd/restic/integration_helpers_unix_test.go:67:50
} linkTests[uint64(stat.Ino)] = append(linkTests[uint64(stat.Ino)], f.Name()) }internal/walker/walker_test.go1
30:6slice-preallocation
internal/walker/walker_test.go:30:6
tb := data.NewTreeJSONBuilder() var names []string for name := range tree {cmd/restic/cmd_prune.go1
54:1top-level-declaration-order
cmd/restic/cmd_prune.go:54:1
// PruneOptions collects all options for the cleanup command.type PruneOptions struct { DryRun boolinternal/fs/stat_darwin.go1
16:15unchecked-type-assertion
internal/fs/stat_darwin.go:16:15
func extendedStat(fi os.FileInfo) *ExtendedFileInfo { s := fi.Sys().(*syscall.Stat_t)internal/backend/b2/b2.go1
328:7unused-receiver
internal/backend/b2/b2.go:328:7
// Close does nothingfunc (be *b2Backend) Close() error { return nil }cmd/restic/cmd_ls.go1
293:25use-any
cmd/restic/cmd_ls.go:293:25
termPrinter interface { P(msg string, args ...interface{}) S(msg string, args ...interface{})internal/backend/local/local.go1
34:19use-errors-new
internal/backend/local/local.go:34:19
var errTooShort = fmt.Errorf("file is too short")internal/fs/vss_windows.go1
33:2var-naming
internal/fs/vss_windows.go:33:2
VSS_E_BAD_STATE HRESULT = 0x80042301 VSS_E_UNEXPECTED HRESULT = 0x80042302 VSS_E_PROVIDER_ALREADY_REGISTERED HRESULT = 0x80042303cmd/restic/cmd_check.go1
277:14add-constant
cmd/restic/cmd_check.go:277:14
case *repository.ErrMixedPack: printer.S("%s", hint.Error()) summary.HintPrune = truecmd/restic/cmd_diff.go1
357:6cognitive-complexity
cmd/restic/cmd_diff.go:357:6
func runDiff(ctx context.Context, opts DiffOptions, gopts global.Options, args []string, term ui.Terminal) error { if len(args) != 2 {internal/filter/filter.go1
152:6confusing-naming
internal/filter/filter.go:152:6
func match(pattern Pattern, strs []string) (matched bool, err error) { if ok, pos := hasDoubleWildcard(pattern); ok {cmd/restic/cmd_ls.go1
517:25cyclomatic-complexity
cmd/restic/cmd_ls.go:517:25
}func (p *sortedPrinter) Close() error { var comparator func(a, b lsNodeOutput) intcmd/restic/cmd_find.go1
269:11discarded-error-result
cmd/restic/cmd_find.go:269:11
} else { _, _ = s.stdout.Write([]byte("[]\n")) }internal/backend/limiter/static_limiter.go1
24:1doc-comment-period
internal/backend/limiter/static_limiter.go:24:1
// NewStaticLimiter constructs a Limiter with a fixed (static) upload and// download rate capfunc NewStaticLimiter(l Limits) Limiter {internal/backend/test/tests.go1
210:13error-strings
internal/backend/test/tests.go:210:13
t.Logf("Load, l %v, o %v, len(d) %v, getlen %v", l, o, len(d), getlen) t.Errorf("Load(%d, %d) returned unexpected error: %+v", l, o, err) continueinternal/archiver/archiver.go1
25:6exported-declaration-comment
internal/archiver/archiver.go:25:6
// dirs). If false is returned, files are ignored and dirs are not even walked.type SelectByNameFunc func(item string) boolinternal/repository/repository.go1
1:1file-length-limit
internal/repository/repository.go:1:1
package repositoryinternal/backend/local/local.go1
310:83flag-parameter
internal/backend/local/local.go:310:83
func visitFiles(ctx context.Context, dir string, fn func(backend.FileInfo) error, ignoreNotADirectory bool) error { d, err := os.Open(dir)cmd/restic/cmd_forget_test.go1
1:1format
cmd/restic/cmd_forget_test.go:1:1
package main- Fix (safe): run `strider fmt cmd/restic/cmd_forget_test.go`
internal/archiver/archiver.go1
463:23function-length
internal/archiver/archiver.go:463:23
// set); Excludes (`SelectByName` and `Select`) are skipped for that path only.func (arch *Archiver) save(ctx context.Context, snPath, target string, previous *data.Node, explicit bool) (fn futureNode, excluded bool, err error) { start := time.Now()internal/archiver/archiver_test.go1
2522:2import-shadowing
internal/archiver/archiver_test.go:2522:2
fs := &overrideFS{ FS: localFS,cmd/restic/cmd_forget.go1
159:2modifies-parameter
cmd/restic/cmd_forget.go:159:2
f.SortFlags = false}cmd/restic/cmd_find.go1
527:98nested-structs
cmd/restic/cmd_find.go:527:98
func (f *Finder) indexPacksToBlobs(ctx context.Context, packIDs map[string]struct{}) (map[string]struct{}, error) { wctx, cancel := context.WithCancel(ctx)internal/repository/key.go1
168:5nil-error-return
internal/repository/key.go:168:5
if errors.Is(err, crypto.ErrUnauthenticated) { return nil }internal/restorer/restorer.go1
567:4no-else-after-return
internal/restorer/restorer.go:567:4
return buf, err } else if !overwrite { size := node.Sizecmd/restic/main.go1
34:5no-package-var
cmd/restic/main.go:34:5
var cmdGroupDefault = "default"var cmdGroupAdvanced = "advanced"cmd/restic/cmd_migrate.go1
1:9package-comments
cmd/restic/cmd_migrate.go:1:9
package maininternal/fs/vss_windows.go1
1072:4range-value-address
internal/fs/vss_windows.go:1072:4
err := iVssBackupComponents.GetSnapshotProperties(info.snapshotSetID, &info.snapshotProperties) if err != nil {cmd/restic/integration_test.go1
33:36redundant-conversion
cmd/restic/integration_test.go:33:36
} return os.Chmod(p, fi.Mode() & ^(os.FileMode(0222))) })cmd/restic/cmd_prune_integration_test.go1
124:1top-level-declaration-order
cmd/restic/cmd_prune_integration_test.go:124:1
var pruneDefaultOptions = PruneOptions{MaxUnused: "5%"}internal/fs/stat_unix.go1
13:15unchecked-type-assertion
internal/fs/stat_unix.go:13:15
func extendedStat(fi os.FileInfo) *ExtendedFileInfo { s := fi.Sys().(*syscall.Stat_t)internal/backend/b2/b2.go1
331:7unused-receiver
internal/backend/b2/b2.go:331:7
// Warmup not implementedfunc (be *b2Backend) Warmup(_ context.Context, _ []backend.Handle) ([]backend.Handle, error) { return []backend.Handle{}, nil