Add nolint directives to allow-list current lint violations
This commit is contained in:
parent
e43cb2b880
commit
44775f87c8
14 changed files with 125 additions and 12 deletions
|
|
@ -283,6 +283,7 @@ func TestPRCreate_recover(t *testing.T) {
|
|||
cs.Register(`git status --porcelain`, 0, "")
|
||||
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
|
||||
|
|
@ -379,6 +380,7 @@ func TestPRCreate(t *testing.T) {
|
|||
cs.Register(`git show-ref --verify -- HEAD refs/remotes/origin/feature`, 0, "")
|
||||
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
@ -425,6 +427,7 @@ func TestPRCreate_NoMaintainerModify(t *testing.T) {
|
|||
cs.Register(`git show-ref --verify -- HEAD refs/remotes/origin/feature`, 0, "")
|
||||
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
@ -476,6 +479,7 @@ func TestPRCreate_createFork(t *testing.T) {
|
|||
cs.Register(`git remote add -f fork https://github.com/monalisa/REPO.git`, 0, "")
|
||||
cs.Register(`git push --set-upstream fork HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
@ -535,6 +539,7 @@ func TestPRCreate_pushedToNonBaseRepo(t *testing.T) {
|
|||
deadbeef refs/remotes/origin/feature
|
||||
`)) // determineTrackingBranch
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
_, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
@ -576,6 +581,7 @@ func TestPRCreate_pushedToDifferentBranchName(t *testing.T) {
|
|||
deadbeef refs/remotes/origin/my-feat2
|
||||
`)) // determineTrackingBranch
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
_, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
@ -609,6 +615,7 @@ func TestPRCreate_nonLegacyTemplate(t *testing.T) {
|
|||
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "1234567890,commit 0\n2345678901,commit 1")
|
||||
cs.Register(`git status --porcelain`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
|
||||
|
|
@ -757,6 +764,7 @@ func TestPRCreate_web(t *testing.T) {
|
|||
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
|
||||
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
@ -831,6 +839,7 @@ func TestPRCreate_webProject(t *testing.T) {
|
|||
cs.Register(`git( .+)? log( .+)? origin/master\.\.\.feature`, 0, "")
|
||||
cs.Register(`git push --set-upstream origin HEAD:feature`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
ask, cleanupAsk := prompt.InitAskStubber()
|
||||
defer cleanupAsk()
|
||||
|
||||
|
|
|
|||
|
|
@ -769,8 +769,10 @@ func TestPrMerge_alreadyMerged(t *testing.T) {
|
|||
cs.Register(`git branch -D blueberries`, 0, "")
|
||||
cs.Register(`git pull --ff-only`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, surveyTeardown := prompt.InitAskStubber()
|
||||
defer surveyTeardown()
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true)
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "pr merge 4")
|
||||
|
|
@ -846,11 +848,15 @@ func TestPRMerge_interactive(t *testing.T) {
|
|||
|
||||
cs.Register(`git rev-parse --verify refs/heads/blueberries`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, surveyTeardown := prompt.InitAskStubber()
|
||||
defer surveyTeardown()
|
||||
|
||||
as.StubOne(0) // Merge method survey
|
||||
as.StubOne(false) // Delete branch survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0) // Merge method survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false) // Delete branch survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Submit") // Confirm submit survey
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "")
|
||||
|
|
@ -905,10 +911,13 @@ func TestPRMerge_interactiveWithDeleteBranch(t *testing.T) {
|
|||
cs.Register(`git branch -D blueberries`, 0, "")
|
||||
cs.Register(`git pull --ff-only`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, surveyTeardown := prompt.InitAskStubber()
|
||||
defer surveyTeardown()
|
||||
|
||||
as.StubOne(0) // Merge method survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0) // Merge method survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Submit") // Confirm submit survey
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "-d")
|
||||
|
|
@ -964,14 +973,20 @@ func TestPRMerge_interactiveSquashEditCommitMsgAndSubject(t *testing.T) {
|
|||
_, cmdTeardown := run.Stub()
|
||||
defer cmdTeardown(t)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, surveyTeardown := prompt.InitAskStubber()
|
||||
defer surveyTeardown()
|
||||
|
||||
as.StubOne(2) // Merge method survey
|
||||
as.StubOne(false) // Delete branch survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2) // Merge method survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false) // Delete branch survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Edit commit subject") // Confirm submit survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Edit commit message") // Confirm submit survey
|
||||
as.StubOne("Submit") // Confirm submit survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Submit") // Confirm submit survey
|
||||
|
||||
err := mergeRun(&MergeOptions{
|
||||
IO: io,
|
||||
|
|
@ -1017,11 +1032,15 @@ func TestPRMerge_interactiveCancelled(t *testing.T) {
|
|||
|
||||
cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, surveyTeardown := prompt.InitAskStubber()
|
||||
defer surveyTeardown()
|
||||
|
||||
as.StubOne(0) // Merge method survey
|
||||
as.StubOne(true) // Delete branch survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0) // Merge method survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) // Delete branch survey
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Cancel") // Confirm submit survey
|
||||
|
||||
output, err := runCommand(http, "blueberries", true, "")
|
||||
|
|
@ -1038,8 +1057,10 @@ func Test_mergeMethodSurvey(t *testing.T) {
|
|||
RebaseMergeAllowed: true,
|
||||
SquashMergeAllowed: true,
|
||||
}
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, surveyTeardown := prompt.InitAskStubber()
|
||||
defer surveyTeardown()
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0) // Select first option which is rebase merge
|
||||
method, err := mergeMethodSurvey(repo)
|
||||
assert.Nil(t, err)
|
||||
|
|
|
|||
|
|
@ -270,21 +270,25 @@ func TestPRReview_interactive(t *testing.T) {
|
|||
}),
|
||||
)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "reviewType",
|
||||
Value: "Approve",
|
||||
},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "body",
|
||||
Value: "cool story",
|
||||
},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "confirm",
|
||||
|
|
@ -333,21 +337,25 @@ func TestPRReview_interactive_blank_approve(t *testing.T) {
|
|||
}),
|
||||
)
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "reviewType",
|
||||
Value: "Approve",
|
||||
},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "body",
|
||||
Default: true,
|
||||
},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "confirm",
|
||||
|
|
|
|||
|
|
@ -43,15 +43,18 @@ func TestMetadataSurvey_selectAll(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, restoreAsk := prompt.InitAskStubber()
|
||||
defer restoreAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "metadata",
|
||||
Value: []string{"Labels", "Projects", "Assignees", "Reviewers", "Milestone"},
|
||||
},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "reviewers",
|
||||
|
|
@ -109,15 +112,18 @@ func TestMetadataSurvey_keepExisting(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, restoreAsk := prompt.InitAskStubber()
|
||||
defer restoreAsk()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "metadata",
|
||||
Value: []string{"Labels", "Projects"},
|
||||
},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{
|
||||
Name: "labels",
|
||||
|
|
|
|||
|
|
@ -63,9 +63,11 @@ func TestTemplateManager_hasAPI(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "LEGACY", string(m.LegacyBody()))
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, askRestore := prompt.InitAskStubber()
|
||||
defer askRestore()
|
||||
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(1) // choose "Feature Request"
|
||||
tpl, err := m.Choose()
|
||||
assert.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -631,6 +631,7 @@ func Test_createRun_interactive(t *testing.T) {
|
|||
return val, nil
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ func Test_ArchiveRun(t *testing.T) {
|
|||
name: "unarchived repo tty",
|
||||
wantStdout: "✓ Archived repository OWNER/REPO\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne(true)
|
||||
},
|
||||
isTTY: true,
|
||||
|
|
@ -98,6 +99,7 @@ func Test_ArchiveRun(t *testing.T) {
|
|||
wantStdout: "✓ Archived repository OWNER/REPO\n",
|
||||
opts: ArchiveOptions{},
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne(true)
|
||||
},
|
||||
isTTY: true,
|
||||
|
|
@ -138,6 +140,7 @@ func Test_ArchiveRun(t *testing.T) {
|
|||
io, _, stdout, stderr := iostreams.Test()
|
||||
tt.opts.IO = io
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
q, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -171,22 +171,30 @@ func Test_createRun(t *testing.T) {
|
|||
tty: true,
|
||||
wantStdout: "✓ Created repository OWNER/REPO on GitHub\n",
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Create a new repository on GitHub from scratch")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "addGitIgnore", Value: true}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "chooseGitIgnore", Value: "Go"}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "addLicense", Value: true}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "chooseLicense", Value: "GNU Lesser General Public License v3.0"}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "confirmSubmit", Value: true}})
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) //clone locally?
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -210,16 +218,21 @@ func Test_createRun(t *testing.T) {
|
|||
opts: &CreateOptions{Interactive: true},
|
||||
tty: true,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Create a new repository on GitHub from scratch")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "addGitIgnore", Value: false}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "addLicense", Value: false}})
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "confirmSubmit", Value: false}})
|
||||
},
|
||||
|
|
@ -232,13 +245,17 @@ func Test_createRun(t *testing.T) {
|
|||
opts: &CreateOptions{Interactive: true},
|
||||
tty: true,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Push an existing local repository to GitHub")
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(".")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false)
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -269,16 +286,22 @@ func Test_createRun(t *testing.T) {
|
|||
opts: &CreateOptions{Interactive: true},
|
||||
tty: true,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Push an existing local repository to GitHub")
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(".")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
as.StubOne(true) //ask for adding a remote
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) //ask for adding a remote
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("origin") //ask for remote name
|
||||
as.StubOne(false) //ask to push to remote
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false) //ask to push to remote
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
|
|
@ -309,16 +332,22 @@ func Test_createRun(t *testing.T) {
|
|||
opts: &CreateOptions{Interactive: true},
|
||||
tty: true,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("Push an existing local repository to GitHub")
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(".")
|
||||
//nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt
|
||||
as.Stub([]*prompt.QuestionStub{
|
||||
{Name: "repoName", Value: "REPO"},
|
||||
{Name: "repoDescription", Value: "my new repo"},
|
||||
{Name: "repoVisibility", Value: "Private"},
|
||||
})
|
||||
as.StubOne(true) //ask for adding a remote
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) //ask for adding a remote
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne("origin") //ask for remote name
|
||||
as.StubOne(true) //ask to push to remote
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true) //ask to push to remote
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(
|
||||
|
|
@ -407,6 +436,7 @@ func Test_createRun(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
q, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ func Test_deleteRun(t *testing.T) {
|
|||
askStubs: func(q *prompt.AskStubber) {
|
||||
// TODO: survey stubber doesn't have WithValidator support
|
||||
// so this always passes regardless of prompt input
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne("OWNER/REPO")
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -108,6 +109,7 @@ func Test_deleteRun(t *testing.T) {
|
|||
opts: &DeleteOptions{},
|
||||
wantStdout: "✓ Deleted repository OWNER/REPO\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne("OWNER/REPO")
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -134,6 +136,7 @@ func Test_deleteRun(t *testing.T) {
|
|||
wantStdout: "✓ Deleted repository OWNER/REPO\n",
|
||||
tty: true,
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne("OWNER/REPO")
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -147,6 +150,7 @@ func Test_deleteRun(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
q, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ func TestRepoFork(t *testing.T) {
|
|||
},
|
||||
httpStubs: forkPost,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false)
|
||||
},
|
||||
wantErrOut: "✓ Created fork someone/REPO\n",
|
||||
|
|
@ -254,6 +255,7 @@ func TestRepoFork(t *testing.T) {
|
|||
cs.Register(`git remote add -f origin https://github.com/someone/REPO.git`, 0, "")
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true)
|
||||
},
|
||||
wantErrOut: "✓ Created fork someone/REPO\n✓ Added remote origin\n",
|
||||
|
|
@ -442,6 +444,7 @@ func TestRepoFork(t *testing.T) {
|
|||
},
|
||||
httpStubs: forkPost,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(false)
|
||||
},
|
||||
wantErrOut: "✓ Created fork someone/REPO\n",
|
||||
|
|
@ -455,6 +458,7 @@ func TestRepoFork(t *testing.T) {
|
|||
},
|
||||
httpStubs: forkPost,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true)
|
||||
},
|
||||
execStubs: func(cs *run.CommandStubber) {
|
||||
|
|
@ -475,6 +479,7 @@ func TestRepoFork(t *testing.T) {
|
|||
},
|
||||
httpStubs: forkPost,
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(true)
|
||||
},
|
||||
execStubs: func(cs *run.CommandStubber) {
|
||||
|
|
@ -570,6 +575,7 @@ func TestRepoFork(t *testing.T) {
|
|||
return tt.remotes, nil
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ func TestRenameRun(t *testing.T) {
|
|||
name: "none argument",
|
||||
wantOut: "✓ Renamed repository OWNER/NEW_REPO\n✓ Updated the \"origin\" remote\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne("NEW_REPO")
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -136,6 +137,7 @@ func TestRenameRun(t *testing.T) {
|
|||
},
|
||||
wantOut: "✓ Renamed repository OWNER/NEW_REPO\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne("NEW_REPO")
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -184,6 +186,7 @@ func TestRenameRun(t *testing.T) {
|
|||
},
|
||||
wantOut: "✓ Renamed repository OWNER/NEW_REPO\n✓ Updated the \"origin\" remote\n",
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne(true)
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
|
|
@ -204,6 +207,7 @@ func TestRenameRun(t *testing.T) {
|
|||
DoConfirm: true,
|
||||
},
|
||||
askStubs: func(q *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: q.StubOne is deprecated: use StubPrompt
|
||||
q.StubOne(false)
|
||||
},
|
||||
wantOut: "",
|
||||
|
|
@ -211,6 +215,7 @@ func TestRenameRun(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tt := range testCases {
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
q, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ func TestRunCancel(t *testing.T) {
|
|||
httpmock.StatusStringResponse(202, "{}"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0)
|
||||
},
|
||||
wantOut: "✓ Request to cancel workflow submitted.\n",
|
||||
|
|
@ -195,6 +196,7 @@ func TestRunCancel(t *testing.T) {
|
|||
return ghrepo.FromFullName("OWNER/REPO")
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ func TestRerun(t *testing.T) {
|
|||
httpmock.StringResponse("{}"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
},
|
||||
wantOut: "✓ Requested rerun of run 1234\n",
|
||||
|
|
@ -193,6 +194,7 @@ func TestRerun(t *testing.T) {
|
|||
return ghrepo.FromFullName("OWNER/REPO")
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
|
|
@ -375,6 +375,7 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.JSONResponse([]shared.Annotation{}))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
},
|
||||
opts: &ViewOptions{
|
||||
|
|
@ -411,7 +412,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.FileResponse("./fixtures/run_log.zip"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(1)
|
||||
},
|
||||
wantOut: coolJobRunLogOutput,
|
||||
|
|
@ -464,7 +467,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.FileResponse("./fixtures/run_log.zip"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0)
|
||||
},
|
||||
wantOut: expectedRunLogOutput,
|
||||
|
|
@ -523,7 +528,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.FileResponse("./fixtures/run_log.zip"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(4)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
},
|
||||
wantOut: quuxTheBarfLogOutput,
|
||||
|
|
@ -576,7 +583,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.FileResponse("./fixtures/run_log.zip"))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(4)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0)
|
||||
},
|
||||
wantOut: quuxTheBarfLogOutput,
|
||||
|
|
@ -700,7 +709,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.JSONResponse(shared.FailedJobAnnotations))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(0)
|
||||
},
|
||||
wantOut: "\n✓ trunk successful · 3\nTriggered via push about 59 minutes ago\n\nJOBS\n✓ cool job in 4m34s (ID 10)\nX sad job in 4m34s (ID 20)\n ✓ barf the quux\n X quux the barf\n\nANNOTATIONS\nX the job is sad\nsad job: blaze.py#420\n\n\nFor more information about a job, try: gh run view --job=<job-id>\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
|
|
@ -733,7 +744,9 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.JSONResponse([]shared.Annotation{}))
|
||||
},
|
||||
askStubs: func(as *prompt.AskStubber) {
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(2)
|
||||
//nolint:staticcheck // SA1019: as.StubOne is deprecated: use StubPrompt
|
||||
as.StubOne(1)
|
||||
},
|
||||
wantOut: "\n✓ trunk successful · 3\nTriggered via push about 59 minutes ago\n\n✓ cool job in 4m34s (ID 10)\n ✓ fob the barz\n ✓ barz the fob\n\nTo see the full job log, try: gh run view --log --job=10\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
|
|
@ -830,6 +843,7 @@ func TestViewRun(t *testing.T) {
|
|||
return ghrepo.FromFullName("OWNER/REPO")
|
||||
}
|
||||
|
||||
//nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber
|
||||
as, teardown := prompt.InitAskStubber()
|
||||
defer teardown()
|
||||
if tt.askStubs != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue