diff options
author | TheFox0x7 <thefox0x7@gmail.com> | 2025-06-27 07:59:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-27 07:59:55 +0200 |
commit | eb36a4554ee9a9d15954f08dd37deee54385e29c (patch) | |
tree | df3681b399bc6add525f7ef33359e379c06f73f3 /services/repository/files/file_test.go | |
parent | 376bf01769b78b2ddf3562e6b6774e8f19053403 (diff) | |
download | gitea-eb36a4554ee9a9d15954f08dd37deee54385e29c.tar.gz gitea-eb36a4554ee9a9d15954f08dd37deee54385e29c.zip |
enforce nolint scope (#34851)
enable nolintlint scope requirement
add comments to new directives so it's more obvious why they are in
place
---
I can also toggle the mandatory comments on if that's something of
interest.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'services/repository/files/file_test.go')
-rw-r--r-- | services/repository/files/file_test.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/services/repository/files/file_test.go b/services/repository/files/file_test.go index 894c184472..cdb6a266ff 100644 --- a/services/repository/files/file_test.go +++ b/services/repository/files/file_test.go @@ -10,9 +10,18 @@ import ( ) func TestCleanUploadFileName(t *testing.T) { - assert.Equal(t, "", CleanGitTreePath("")) //nolint - assert.Equal(t, "", CleanGitTreePath(".")) //nolint - assert.Equal(t, "a/b", CleanGitTreePath("a/b")) - assert.Equal(t, "", CleanGitTreePath(".git/b")) //nolint - assert.Equal(t, "", CleanGitTreePath("a/.git")) //nolint + cases := []struct { + input, expected string + }{ + {"", ""}, + {".", ""}, + {"a/./b", "a/b"}, + {"a.git", "a.git"}, + {".git/b", ""}, + {"a/.git", ""}, + {"/a/../../b", "b"}, + } + for _, c := range cases { + assert.Equal(t, c.expected, CleanGitTreePath(c.input), "input: %q", c.input) + } } |