From 42e18e0fe1774d695d7210d5144b0e328430b5b4 Mon Sep 17 00:00:00 2001 From: logikonline Date: Mon, 2 Feb 2026 16:01:58 -0500 Subject: [PATCH] style(wishlist): fix linter warnings and formatting 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. --- models/migrations/v1_26/v357.go | 10 +++++----- models/wishlist/wishlist_category.go | 2 +- models/wishlist/wishlist_comment.go | 2 +- models/wishlist/wishlist_comment_reaction.go | 2 +- models/wishlist/wishlist_importance.go | 2 +- models/wishlist/wishlist_item.go | 10 +++++----- models/wishlist/wishlist_vote.go | 2 +- services/context/repo.go | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/models/migrations/v1_26/v357.go b/models/migrations/v1_26/v357.go index 6cb6094e12..1e73d23631 100644 --- a/models/migrations/v1_26/v357.go +++ b/models/migrations/v1_26/v357.go @@ -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)) diff --git a/models/wishlist/wishlist_category.go b/models/wishlist/wishlist_category.go index ef047dd8bd..5308c697ad 100644 --- a/models/wishlist/wishlist_category.go +++ b/models/wishlist/wishlist_category.go @@ -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"` diff --git a/models/wishlist/wishlist_comment.go b/models/wishlist/wishlist_comment.go index 1ddba97a9f..d395eb4da3 100644 --- a/models/wishlist/wishlist_comment.go +++ b/models/wishlist/wishlist_comment.go @@ -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"` diff --git a/models/wishlist/wishlist_comment_reaction.go b/models/wishlist/wishlist_comment_reaction.go index b89efd3390..36fd8be98b 100644 --- a/models/wishlist/wishlist_comment_reaction.go +++ b/models/wishlist/wishlist_comment_reaction.go @@ -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"` diff --git a/models/wishlist/wishlist_importance.go b/models/wishlist/wishlist_importance.go index c121a9d872..55a7722f51 100644 --- a/models/wishlist/wishlist_importance.go +++ b/models/wishlist/wishlist_importance.go @@ -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"` diff --git a/models/wishlist/wishlist_item.go b/models/wishlist/wishlist_item.go index 11d5d99e05..be2aad5a94 100644 --- a/models/wishlist/wishlist_item.go +++ b/models/wishlist/wishlist_item.go @@ -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 diff --git a/models/wishlist/wishlist_vote.go b/models/wishlist/wishlist_vote.go index 6b969e9e0f..c92ae18161 100644 --- a/models/wishlist/wishlist_vote.go +++ b/models/wishlist/wishlist_vote.go @@ -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"` diff --git a/services/context/repo.go b/services/context/repo.go index 0e1d6d71e3..cf6c712b46 100644 --- a/services/context/repo.go +++ b/services/context/repo.go @@ -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"