1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Enable tenv and testifylint rules (#32852)

Enables tenv and testifylint linters
closes: https://github.com/go-gitea/gitea/issues/32842
This commit is contained in:
TheFox0x7
2024-12-15 11:41:29 +01:00
committed by GitHub
parent df9a78cd04
commit 33e8e82c4b
113 changed files with 272 additions and 282 deletions

View File

@@ -4,7 +4,6 @@
package archiver
import (
"errors"
"testing"
"time"
@@ -121,7 +120,7 @@ func TestArchive_Basic(t *testing.T) {
// It's fine to go ahead and set it to nil now.
assert.Equal(t, zipReq, zipReq2)
assert.False(t, zipReq == zipReq2)
assert.NotSame(t, zipReq, zipReq2)
// Same commit, different compression formats should have different names.
// Ideally, the extension would match what we originally requested.
@@ -131,5 +130,5 @@ func TestArchive_Basic(t *testing.T) {
func TestErrUnknownArchiveFormat(t *testing.T) {
err := ErrUnknownArchiveFormat{RequestFormat: "master"}
assert.True(t, errors.Is(err, ErrUnknownArchiveFormat{}))
assert.ErrorIs(t, err, ErrUnknownArchiveFormat{})
}

View File

@@ -65,7 +65,7 @@ func Test_detectLicense(t *testing.T) {
result, err := detectLicense(strings.NewReader(tests[2].arg + tests[3].arg + tests[4].arg))
assert.NoError(t, err)
t.Run("multiple licenses test", func(t *testing.T) {
assert.Equal(t, 3, len(result))
assert.Len(t, result, 3)
assert.Contains(t, result, tests[2].want[0])
assert.Contains(t, result, tests[3].want[0])
assert.Contains(t, result, tests[4].want[0])

View File

@@ -103,7 +103,7 @@ func TestRepositoryTransfer(t *testing.T) {
assert.NoError(t, models.CreatePendingRepositoryTransfer(db.DefaultContext, doer, user2, repo.ID, nil))
transfer, err = models.GetPendingRepositoryTransfer(db.DefaultContext, repo)
assert.Nil(t, err)
assert.NoError(t, err)
assert.NoError(t, transfer.LoadAttributes(db.DefaultContext))
assert.Equal(t, "user2", transfer.Recipient.Name)