Skip to content

Commit 37be8ed

Browse files
committed
fix/added fixes recommended in copilot review
Signed-off-by: Rayyan Khan <rayyanrehman101@gmail.com>
1 parent a8d1d3c commit 37be8ed

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cmd/harbor/root/project/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func ListProjectCommand() *cobra.Command {
120120
flags.Int64VarP(&opts.PageSize, "page-size", "", 0, "Size of per page (0 to fetch all)")
121121
flags.BoolVarP(&private, "private", "", false, "Show only private projects")
122122
flags.BoolVarP(&public, "public", "", false, "Show only public projects")
123-
flags.StringVarP(&opts.Sort, "sort", "", "", "Sort the resource list in ascending or descending order") //doc should clearly mention how to use, what is going to get sorted
123+
flags.StringVarP(&opts.Sort, "sort", "", "", "Sort the resource list in ascending or descending order")
124124
flags.StringSliceVar(&fuzzy, "fuzzy", nil, "Fuzzy match filter (key=value)")
125125
flags.StringSliceVar(&match, "match", nil, "exact match filter (key=value)")
126126
flags.StringSliceVar(&ranges, "range", nil, "range filter (key=min~max)")

cmd/harbor/root/project/list_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ func (m *MockProjectLister) mockListFunc(opts ...api.ListFlags) (project.ListPro
8787
func (m *MockProjectLister) populateProjects() []*models.Project {
8888
projects := make([]*models.Project, 0, m.projectsCnt)
8989
for i := 0; i < int(m.projectsCnt); i++ {
90-
user := &models.Project{
90+
project := &models.Project{
9191
ProjectID: int32(i + 1), // #nosec G115
9292
Name: fmt.Sprintf("Project%d", i+1),
9393
}
94-
projects = append(projects, user)
94+
projects = append(projects, project)
9595
}
9696
m.projects = projects
9797
return projects
@@ -265,7 +265,7 @@ func TestBuildListOptions(t *testing.T) {
265265

266266
// Check if we expected an error but did not get one (or vice-versa)
267267
if (err != nil) != (tt.wantedErr != "") {
268-
t.Fatalf("fetchProjects() error presence mismatch: got error %v, wantError %v", err, tt.wantedErr)
268+
t.Fatalf("BuildListOptions() error presence mismatch: got error %v, wantError %v", err, tt.wantedErr)
269269
}
270270

271271
if tt.wantedErr != "" {
@@ -394,7 +394,7 @@ func TestFetchProjects(t *testing.T) {
394394
} else {
395395
if opts.PageSize == 0 {
396396
if !projectsAreEqual(allProjects, m.projects) {
397-
t.Errorf("Expected all of the users to be returned")
397+
t.Errorf("Expected all of the projects to be returned")
398398
}
399399
} else {
400400
requiredPage, requiredPageSize := opts.Page, opts.PageSize
@@ -403,11 +403,11 @@ func TestFetchProjects(t *testing.T) {
403403

404404
if start >= int64(m.projectsCnt) {
405405
if len(allProjects) != 0 {
406-
t.Errorf("Expected empty result for page beyond data, got %d users", len(allProjects))
406+
t.Errorf("Expected empty result for page beyond data, got %d projects", len(allProjects))
407407
}
408408
} else {
409409
if !projectsAreEqual(allProjects, m.projects[start:end]) {
410-
t.Errorf("Expected different set of users")
410+
t.Errorf("Expected different set of projects")
411411
}
412412
}
413413
}

0 commit comments

Comments
 (0)