Add testifylint to lint checks (#4535)

go-require lint is ignored for now

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4535
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
This commit is contained in:
TheFox0x7 2024-07-30 19:41:10 +00:00 committed by Earl Warren
parent 94933470cd
commit 4de909747b
504 changed files with 5028 additions and 4680 deletions

View file

@ -17,6 +17,7 @@ import (
"github.com/PuerkitoBio/goquery"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func resultFilenames(t testing.TB, doc *HTMLDoc) []string {
@ -26,7 +27,7 @@ func resultFilenames(t testing.TB, doc *HTMLDoc) []string {
result := make([]string, resultSelections.Length())
resultSelections.Each(func(i int, selection *goquery.Selection) {
assert.True(t, resultSelections.Find("div ol li").Length() > 0)
assert.Positive(t, resultSelections.Find("div ol li").Length(), 0)
result[i] = selection.
Find(".header").
Find("span.file a.file-link").
@ -51,7 +52,7 @@ func testSearchRepo(t *testing.T, indexer bool) {
defer test.MockVariableValue(&testWebRoutes, routers.NormalRoutes())()
repo, err := repo_model.GetRepositoryByOwnerAndName(db.DefaultContext, "user2", "repo1")
assert.NoError(t, err)
require.NoError(t, err)
if indexer {
code_indexer.UpdateRepoIndexer(repo)
@ -70,7 +71,7 @@ func testSearchRepo(t *testing.T, indexer bool) {
defer test.MockVariableValue(&setting.Indexer.ExcludePatterns, setting.IndexerGlobFromString("**/y/**"))()
repo, err = repo_model.GetRepositoryByOwnerAndName(db.DefaultContext, "user2", "glob")
assert.NoError(t, err)
require.NoError(t, err)
if indexer {
code_indexer.UpdateRepoIndexer(repo)