Skip to content

Commit 984e837

Browse files
committed
fix nolint directives which aren't guarding anything significant
scope condition one for now
1 parent 05e2ad5 commit 984e837

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

services/gitdiff/gitdiff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ func SyncUserSpecificDiff(ctx context.Context, userID int64, pull *issues_model.
13561356
// But as that does not work for all potential errors, we simply mark all files as unchanged and drop the error which always works, even if not as good as possible
13571357
if err != nil {
13581358
log.Error("Could not get changed files between %s and %s for pull request %d in repo with path %s. Assuming no changes. Error: %w", review.CommitSHA, latestCommit, pull.Index, gitRepo.Path, err)
1359-
err = nil //nolint
1359+
err = nil //nolint:ineffassign,wastedassign
13601360
}
13611361

13621362
filesChangedSinceLastDiff := make(map[string]pull_model.ViewedState)

services/migrations/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error {
7878
hostName, _, err := net.SplitHostPort(u.Host)
7979
if err != nil {
8080
// u.Host can be "host" or "host:port"
81-
err = nil //nolint
81+
err = nil //nolint:ineffassign,wastedassign
8282
hostName = u.Host
8383
}
8484

services/repository/files/file_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
)
1111

1212
func TestCleanUploadFileName(t *testing.T) {
13-
assert.Equal(t, "", CleanGitTreePath("")) //nolint
14-
assert.Equal(t, "", CleanGitTreePath(".")) //nolint
13+
assert.Empty(t, CleanGitTreePath(""))
14+
assert.Empty(t, CleanGitTreePath("."))
1515
assert.Equal(t, "a/b", CleanGitTreePath("a/b"))
16-
assert.Equal(t, "", CleanGitTreePath(".git/b")) //nolint
17-
assert.Equal(t, "", CleanGitTreePath("a/.git")) //nolint
16+
assert.Empty(t, CleanGitTreePath(".git/b"))
17+
assert.Empty(t, CleanGitTreePath("a/.git"))
1818
}

services/user/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func UpdateUser(ctx context.Context, u *user_model.User, opts *UpdateOptions) er
137137
} else if !user_model.IsLastAdminUser(ctx, u) /* not the last admin */ {
138138
u.IsAdmin = opts.IsAdmin.Value().FieldValue // it's safe to change it from false to true (not the last admin)
139139
cols = append(cols, "is_admin")
140-
} else /* IsAdmin=false but this is the last admin user */ { //nolint
140+
} else /* IsAdmin=false but this is the last admin user */ { //nolint:gocritic // could flatten the condition, no idea how to flatten comments at the moment
141141
if !opts.IsAdmin.Value().FromSync {
142142
return user_model.ErrDeleteLastAdminUser{UID: u.ID}
143143
}

0 commit comments

Comments
 (0)