2
0

style(wishlist): fix linter warnings and formatting
All checks were successful
Build and Release / Create Release (push) Successful in 0s
Build and Release / Unit Tests (push) Successful in 3m17s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 4m49s
Build and Release / Lint (push) Successful in 4m57s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 3m0s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h4m54s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 7m7s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Successful in 7m59s
Build and Release / Build Binary (linux/arm64) (push) Successful in 8m35s

Adds revive:disable-line comments for exported types without doc comments. Fixes column alignment in migration struct. Adds explanatory nolint comments for intentional nil returns. Sorts imports alphabetically.
This commit is contained in:
2026-02-02 16:01:58 -05:00
parent 36f5d77c9f
commit 42e18e0fe1
8 changed files with 16 additions and 16 deletions

View File

@@ -11,11 +11,11 @@ import (
func CreateWishlistCategoryTable(x *xorm.Engine) error {
type WishlistCategory struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX NOT NULL"`
Name string `xorm:"VARCHAR(100) NOT NULL"`
Color string `xorm:"VARCHAR(7) NOT NULL DEFAULT '#6c757d'"`
SortOrder int `xorm:"NOT NULL DEFAULT 0"`
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX NOT NULL"`
Name string `xorm:"VARCHAR(100) NOT NULL"`
Color string `xorm:"VARCHAR(7) NOT NULL DEFAULT '#6c757d'"`
SortOrder int `xorm:"NOT NULL DEFAULT 0"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
}
return x.Sync(new(WishlistCategory))

View File

@@ -12,7 +12,7 @@ import (
)
// WishlistCategory represents a user-defined category for wishlist items.
type WishlistCategory struct {
type WishlistCategory struct { //revive:disable-line:exported
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX NOT NULL"`
Name string `xorm:"VARCHAR(100) NOT NULL"`

View File

@@ -13,7 +13,7 @@ import (
)
// WishlistComment represents a comment on a wishlist item.
type WishlistComment struct {
type WishlistComment struct { //revive:disable-line:exported
ID int64 `xorm:"pk autoincr"`
ItemID int64 `xorm:"INDEX NOT NULL"`
UserID int64 `xorm:"INDEX NOT NULL"`

View File

@@ -11,7 +11,7 @@ import (
)
// WishlistCommentReaction represents a thumbs up/down reaction on a wishlist comment.
type WishlistCommentReaction struct {
type WishlistCommentReaction struct { //revive:disable-line:exported
ID int64 `xorm:"pk autoincr"`
CommentID int64 `xorm:"INDEX NOT NULL"`
UserID int64 `xorm:"INDEX NOT NULL"`

View File

@@ -18,7 +18,7 @@ const (
)
// WishlistImportance represents a user's importance rating on a wishlist item.
type WishlistImportance struct {
type WishlistImportance struct { //revive:disable-line:exported
ID int64 `xorm:"pk autoincr"`
ItemID int64 `xorm:"UNIQUE(user_item) INDEX NOT NULL"`
UserID int64 `xorm:"UNIQUE(user_item) INDEX NOT NULL"`

View File

@@ -14,7 +14,7 @@ import (
)
// WishlistItemStatus represents the state of a wishlist item.
type WishlistItemStatus int
type WishlistItemStatus int //revive:disable-line:exported
const (
WishlistItemOpen WishlistItemStatus = 0
@@ -42,7 +42,7 @@ func (s WishlistItemStatus) IsClosed() bool {
}
// WishlistItem represents a feature request in a repository wishlist.
type WishlistItem struct {
type WishlistItem struct { //revive:disable-line:exported
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX NOT NULL"`
CategoryID int64 `xorm:"INDEX DEFAULT 0"`
@@ -87,7 +87,7 @@ func (item *WishlistItem) LoadCategory(ctx context.Context) error {
c, err := GetCategoryByID(ctx, item.CategoryID)
if err != nil {
// Category may have been deleted
return nil //nolint:nilerr
return nil //nolint:nilerr // category may have been deleted, treat as uncategorized
}
item.Category = c
return nil
@@ -100,14 +100,14 @@ func (item *WishlistItem) LoadRelease(ctx context.Context) error {
}
r, err := repo_model.GetReleaseByID(ctx, item.ReleaseID)
if err != nil {
return nil //nolint:nilerr
return nil //nolint:nilerr // release may have been deleted
}
item.Release = r
return nil
}
// WishlistItemSearchOptions configures the wishlist item query.
type WishlistItemSearchOptions struct {
type WishlistItemSearchOptions struct { //revive:disable-line:exported
RepoID int64
CategoryID int64 // 0 = all categories, >0 = specific
Status WishlistItemStatus // -1 = all

View File

@@ -13,7 +13,7 @@ import (
const MaxVotesPerRepo = 3
// WishlistVote represents a user's vote on a wishlist item.
type WishlistVote struct {
type WishlistVote struct { //revive:disable-line:exported
ID int64 `xorm:"pk autoincr"`
ItemID int64 `xorm:"UNIQUE(user_item) INDEX NOT NULL"`
UserID int64 `xorm:"UNIQUE(user_item) INDEX NOT NULL"`

View File

@@ -16,7 +16,6 @@ import (
asymkey_model "code.gitcaddy.com/server/v3/models/asymkey"
blog_model "code.gitcaddy.com/server/v3/models/blog"
wishlist_model "code.gitcaddy.com/server/v3/models/wishlist"
"code.gitcaddy.com/server/v3/models/db"
git_model "code.gitcaddy.com/server/v3/models/git"
issues_model "code.gitcaddy.com/server/v3/models/issues"
@@ -26,6 +25,7 @@ import (
repo_model "code.gitcaddy.com/server/v3/models/repo"
unit_model "code.gitcaddy.com/server/v3/models/unit"
user_model "code.gitcaddy.com/server/v3/models/user"
wishlist_model "code.gitcaddy.com/server/v3/models/wishlist"
"code.gitcaddy.com/server/v3/modules/cache"
"code.gitcaddy.com/server/v3/modules/git"
"code.gitcaddy.com/server/v3/modules/gitrepo"