X Tutup
Skip to content

Commit 44775f8

Browse files
committed
Add nolint directives to allow-list current lint violations
1 parent e43cb2b commit 44775f8

File tree

14 files changed

+125
-12
lines changed

14 files changed

+125
-12
lines changed

pkg/cmd/pr/create/create_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ func TestPRCreate_recover(t *testing.T) {
283283
cs.Register(`git status --porcelain`, 0, "")
284284
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
285285

286+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
286287
as, teardown := prompt.InitAskStubber()
287288
defer teardown()
288289

@@ -379,6 +380,7 @@ func TestPRCreate(t *testing.T) {
379380
cs.Register(`git show-ref --verify -- HEAD refs/remotes/origin/feature`, 0, "")
380381
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
381382

383+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
382384
ask, cleanupAsk := prompt.InitAskStubber()
383385
defer cleanupAsk()
384386

@@ -425,6 +427,7 @@ func TestPRCreate_NoMaintainerModify(t *testing.T) {
425427
cs.Register(`git show-ref --verify -- HEAD refs/remotes/origin/feature`, 0, "")
426428
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
427429

430+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
428431
ask, cleanupAsk := prompt.InitAskStubber()
429432
defer cleanupAsk()
430433

@@ -476,6 +479,7 @@ func TestPRCreate_createFork(t *testing.T) {
476479
cs.Register(`git remote add -f fork https://github.com/monalisa/REPO.git`, 0, "")
477480
cs.Register(`git push --set-upstream fork HEAD:feature`, 0, "")
478481

482+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
479483
ask, cleanupAsk := prompt.InitAskStubber()
480484
defer cleanupAsk()
481485

@@ -535,6 +539,7 @@ func TestPRCreate_pushedToNonBaseRepo(t *testing.T) {
535539
deadbeef refs/remotes/origin/feature
536540
`)) // determineTrackingBranch
537541

542+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
538543
_, cleanupAsk := prompt.InitAskStubber()
539544
defer cleanupAsk()
540545

@@ -576,6 +581,7 @@ func TestPRCreate_pushedToDifferentBranchName(t *testing.T) {
576581
deadbeef refs/remotes/origin/my-feat2
577582
`)) // determineTrackingBranch
578583

584+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
579585
_, cleanupAsk := prompt.InitAskStubber()
580586
defer cleanupAsk()
581587

@@ -609,6 +615,7 @@ func TestPRCreate_nonLegacyTemplate(t *testing.T) {
609615
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "1234567890,commit 0\n2345678901,commit 1")
610616
cs.Register(`git status --porcelain`, 0, "")
611617

618+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
612619
as, teardown := prompt.InitAskStubber()
613620
defer teardown()
614621

@@ -757,6 +764,7 @@ func TestPRCreate_web(t *testing.T) {
757764
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
758765
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
759766

767+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
760768
ask, cleanupAsk := prompt.InitAskStubber()
761769
defer cleanupAsk()
762770

@@ -831,6 +839,7 @@ func TestPRCreate_webProject(t *testing.T) {
831839
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
832840
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
833841

842+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
834843
ask, cleanupAsk := prompt.InitAskStubber()
835844
defer cleanupAsk()
836845

pkg/cmd/pr/merge/merge_test.go

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,10 @@ func TestPrMerge_alreadyMerged(t *testing.T) {
769769
cs.Register(`git branch -D blueberries`, 0, "")
770770
cs.Register(`git pull --ff-only`, 0, "")
771771

772+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
772773
as, surveyTeardown := prompt.InitAskStubber()
773774
defer surveyTeardown()
775+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
774776
as.StubOne(true)
775777

776778
output, err := runCommand(http, "blueberries", true, "pr merge 4")
@@ -846,11 +848,15 @@ func TestPRMerge_interactive(t *testing.T) {
846848

847849
cs.Register(`git rev-parse --verify refs/heads/blueberries`, 0, "")
848850

851+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
849852
as, surveyTeardown := prompt.InitAskStubber()
850853
defer surveyTeardown()
851854

852-
as.StubOne(0) // Merge method survey
853-
as.StubOne(false) // Delete branch survey
855+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
856+
as.StubOne(0) // Merge method survey
857+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
858+
as.StubOne(false) // Delete branch survey
859+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
854860
as.StubOne("Submit") // Confirm submit survey
855861

856862
output, err := runCommand(http, "blueberries", true, "")
@@ -905,10 +911,13 @@ func TestPRMerge_interactiveWithDeleteBranch(t *testing.T) {
905911
cs.Register(`git branch -D blueberries`, 0, "")
906912
cs.Register(`git pull --ff-only`, 0, "")
907913

914+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
908915
as, surveyTeardown := prompt.InitAskStubber()
909916
defer surveyTeardown()
910917

911-
as.StubOne(0) // Merge method survey
918+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
919+
as.StubOne(0) // Merge method survey
920+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
912921
as.StubOne("Submit") // Confirm submit survey
913922

914923
output, err := runCommand(http, "blueberries", true, "-d")
@@ -964,14 +973,20 @@ func TestPRMerge_interactiveSquashEditCommitMsgAndSubject(t *testing.T) {
964973
_, cmdTeardown := run.Stub()
965974
defer cmdTeardown(t)
966975

976+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
967977
as, surveyTeardown := prompt.InitAskStubber()
968978
defer surveyTeardown()
969979

970-
as.StubOne(2) // Merge method survey
971-
as.StubOne(false) // Delete branch survey
980+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
981+
as.StubOne(2) // Merge method survey
982+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
983+
as.StubOne(false) // Delete branch survey
984+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
972985
as.StubOne("Edit commit subject") // Confirm submit survey
986+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
973987
as.StubOne("Edit commit message") // Confirm submit survey
974-
as.StubOne("Submit") // Confirm submit survey
988+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
989+
as.StubOne("Submit") // Confirm submit survey
975990

976991
err := mergeRun(&MergeOptions{
977992
IO: io,
@@ -1017,11 +1032,15 @@ func TestPRMerge_interactiveCancelled(t *testing.T) {
10171032

10181033
cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
10191034

1035+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
10201036
as, surveyTeardown := prompt.InitAskStubber()
10211037
defer surveyTeardown()
10221038

1023-
as.StubOne(0) // Merge method survey
1024-
as.StubOne(true) // Delete branch survey
1039+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
1040+
as.StubOne(0) // Merge method survey
1041+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
1042+
as.StubOne(true) // Delete branch survey
1043+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
10251044
as.StubOne("Cancel") // Confirm submit survey
10261045

10271046
output, err := runCommand(http, "blueberries", true, "")
@@ -1038,8 +1057,10 @@ func Test_mergeMethodSurvey(t *testing.T) {
10381057
RebaseMergeAllowed: true,
10391058
SquashMergeAllowed: true,
10401059
}
1060+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
10411061
as, surveyTeardown := prompt.InitAskStubber()
10421062
defer surveyTeardown()
1063+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
10431064
as.StubOne(0) // Select first option which is rebase merge
10441065
method, err := mergeMethodSurvey(repo)
10451066
assert.Nil(t, err)

pkg/cmd/pr/review/review_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,21 +270,25 @@ func TestPRReview_interactive(t *testing.T) {
270270
}),
271271
)
272272

273+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
273274
as, teardown := prompt.InitAskStubber()
274275
defer teardown()
275276

277+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
276278
as.Stub([]*prompt.QuestionStub{
277279
{
278280
Name: "reviewType",
279281
Value: "Approve",
280282
},
281283
})
284+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
282285
as.Stub([]*prompt.QuestionStub{
283286
{
284287
Name: "body",
285288
Value: "cool story",
286289
},
287290
})
291+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
288292
as.Stub([]*prompt.QuestionStub{
289293
{
290294
Name: "confirm",
@@ -333,21 +337,25 @@ func TestPRReview_interactive_blank_approve(t *testing.T) {
333337
}),
334338
)
335339

340+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
336341
as, teardown := prompt.InitAskStubber()
337342
defer teardown()
338343

344+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
339345
as.Stub([]*prompt.QuestionStub{
340346
{
341347
Name: "reviewType",
342348
Value: "Approve",
343349
},
344350
})
351+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
345352
as.Stub([]*prompt.QuestionStub{
346353
{
347354
Name: "body",
348355
Default: true,
349356
},
350357
})
358+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
351359
as.Stub([]*prompt.QuestionStub{
352360
{
353361
Name: "confirm",

pkg/cmd/pr/shared/survey_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,18 @@ func TestMetadataSurvey_selectAll(t *testing.T) {
4343
},
4444
}
4545

46+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
4647
as, restoreAsk := prompt.InitAskStubber()
4748
defer restoreAsk()
4849

50+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
4951
as.Stub([]*prompt.QuestionStub{
5052
{
5153
Name: "metadata",
5254
Value: []string{"Labels", "Projects", "Assignees", "Reviewers", "Milestone"},
5355
},
5456
})
57+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
5558
as.Stub([]*prompt.QuestionStub{
5659
{
5760
Name: "reviewers",
@@ -109,15 +112,18 @@ func TestMetadataSurvey_keepExisting(t *testing.T) {
109112
},
110113
}
111114

115+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
112116
as, restoreAsk := prompt.InitAskStubber()
113117
defer restoreAsk()
114118

119+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
115120
as.Stub([]*prompt.QuestionStub{
116121
{
117122
Name: "metadata",
118123
Value: []string{"Labels", "Projects"},
119124
},
120125
})
126+
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
121127
as.Stub([]*prompt.QuestionStub{
122128
{
123129
Name: "labels",

pkg/cmd/pr/shared/templates_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ func TestTemplateManager_hasAPI(t *testing.T) {
6363

6464
assert.Equal(t, "LEGACY", string(m.LegacyBody()))
6565

66+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
6667
as, askRestore := prompt.InitAskStubber()
6768
defer askRestore()
6869

70+
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
6971
as.StubOne(1) // choose "Feature Request"
7072
tpl, err := m.Choose()
7173
assert.NoError(t, err)

pkg/cmd/release/create/create_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ func Test_createRun_interactive(t *testing.T) {
631631
return val, nil
632632
}
633633

634+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
634635
as, teardown := prompt.InitAskStubber()
635636
defer teardown()
636637
if tt.askStubs != nil {

pkg/cmd/repo/archive/archive_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func Test_ArchiveRun(t *testing.T) {
8080
name: "unarchived repo tty",
8181
wantStdout: "✓ Archived repository OWNER/REPO\n",
8282
askStubs: func(q *prompt.AskStubber) {
83+
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
8384
q.StubOne(true)
8485
},
8586
isTTY: true,
@@ -98,6 +99,7 @@ func Test_ArchiveRun(t *testing.T) {
9899
wantStdout: "✓ Archived repository OWNER/REPO\n",
99100
opts: ArchiveOptions{},
100101
askStubs: func(q *prompt.AskStubber) {
102+
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
101103
q.StubOne(true)
102104
},
103105
isTTY: true,
@@ -138,6 +140,7 @@ func Test_ArchiveRun(t *testing.T) {
138140
io, _, stdout, stderr := iostreams.Test()
139141
tt.opts.IO = io
140142

143+
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
141144
q, teardown := prompt.InitAskStubber()
142145
defer teardown()
143146
if tt.askStubs != nil {

0 commit comments

Comments
 (0)
X Tutup