Fix linting issues: canonicalheader, embeddedstructfieldcheck, iotamixing, makezero, testableexamples, wastedassign, usetesting, tparallel, unconvert, intrange, iface
- canonicalheader: fix cacheTTL header value to canonical form - embeddedstructfieldcheck: move embedded fields before regular fields in 4 structs - iotamixing: split const blocks mixing iota with non-iota constants - makezero: use make([]T, 0, n) instead of make([]T, n) before appending - testableexamples: add missing Output: comment to ExampleOption_UnwrapOrZero - wastedassign: remove wasted initial assignments in 4 locations - usetesting: replace os.MkdirTemp/os.Setenv with t.TempDir/t.Setenv in tests - tparallel: add t.Parallel() to 8 top-level test functions - unconvert: remove 16 unnecessary type conversions - intrange: convert 3 for loops to use integer range syntax - iface: consolidate identical EditPrompter and Prompt interfaces via type alias Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
6c11ecd9ab
commit
dca59d52b6
113 changed files with 222 additions and 287 deletions
|
|
@ -100,7 +100,6 @@ func runDelete(config deleteConfig) error {
|
|||
}
|
||||
|
||||
return printResults(config, query.DeleteProject.Project)
|
||||
|
||||
}
|
||||
|
||||
func deleteItemArgs(config deleteConfig) (*deleteProjectMutation, map[string]interface{}) {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ func runAddItem(config addItemConfig) error {
|
|||
}
|
||||
|
||||
return printResults(config, query.CreateProjectItem.ProjectV2Item)
|
||||
|
||||
}
|
||||
|
||||
func addItemArgs(config addItemConfig) (*addProjectItemMutation, map[string]interface{}) {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@ func runDeleteItem(config deleteItemConfig) error {
|
|||
}
|
||||
|
||||
return printResults(config)
|
||||
|
||||
}
|
||||
|
||||
func deleteItemArgs(config deleteItemConfig) (*deleteProjectItemMutation, map[string]interface{}) {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ func NewCmdLink(f *cmdutil.Factory, runF func(config linkConfig) error) *cobra.C
|
|||
}
|
||||
|
||||
func validateRepoOrTeamFlag(opts *linkOpts) error {
|
||||
|
||||
linkedTarget := ""
|
||||
if opts.repo != "" {
|
||||
linkedTarget = opts.repo
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ func runMarkTemplate(config markTemplateConfig) error {
|
|||
}
|
||||
|
||||
return printResults(config, query.TemplateProject.Project)
|
||||
|
||||
}
|
||||
query, variables := markTemplateArgs(config)
|
||||
err = config.client.Mutate("MarkProjectTemplate", query, variables)
|
||||
|
|
|
|||
|
|
@ -324,7 +324,6 @@ func TestJSONProjectItem_DraftIssue_ProjectV2ItemFieldIterationValue(t *testing.
|
|||
t,
|
||||
`{"items":[{"sprint":{"title":"Iteration Title","startDate":"","duration":0,"iterationId":"iterationId"},"content":{"type":"DraftIssue","body":"a body","title":"Pull Request title","id":"draftIssueId"},"id":"draftIssueId"}],"totalCount":5}`,
|
||||
string(out))
|
||||
|
||||
}
|
||||
|
||||
func TestJSONProjectItem_DraftIssue_ProjectV2ItemFieldMilestoneValue(t *testing.T) {
|
||||
|
|
@ -363,5 +362,4 @@ func TestJSONProjectItem_DraftIssue_ProjectV2ItemFieldMilestoneValue(t *testing.
|
|||
t,
|
||||
`{"items":[{"milestone":{"title":"Milestone Title","dueOn":"","description":""},"content":{"type":"DraftIssue","body":"a body","title":"Pull Request title","id":"draftIssueId"},"id":"draftIssueId"}],"totalCount":5}`,
|
||||
string(out))
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ type iprompter interface {
|
|||
|
||||
type hostScopedClient struct {
|
||||
*api.Client
|
||||
|
||||
hostname string
|
||||
}
|
||||
|
||||
|
|
@ -207,6 +208,7 @@ type projectQueryBase struct {
|
|||
|
||||
type projectQueryWithQueryableItems struct {
|
||||
projectQueryBase
|
||||
|
||||
Items struct {
|
||||
PageInfo PageInfo
|
||||
TotalCount int
|
||||
|
|
@ -216,6 +218,7 @@ type projectQueryWithQueryableItems struct {
|
|||
|
||||
type projectQueryWithoutQueryableItems struct {
|
||||
projectQueryBase
|
||||
|
||||
Items struct {
|
||||
PageInfo PageInfo
|
||||
TotalCount int
|
||||
|
|
@ -1753,7 +1756,6 @@ func projectFieldValueData(v FieldValueNodes) interface{} {
|
|||
}
|
||||
}
|
||||
return names
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -408,7 +408,6 @@ func TestProjects_ViewerQueryDoesNotUseQueryItems(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestProjectFields_LowerLimit(t *testing.T) {
|
||||
|
||||
defer gock.Off()
|
||||
gock.Observe(gock.DumpRequest)
|
||||
|
||||
|
|
@ -605,7 +604,6 @@ func TestNewOwner_nonTTY(t *testing.T) {
|
|||
client := NewTestClient()
|
||||
_, err := client.NewOwner(false, "")
|
||||
assert.EqualError(t, err, "owner is required when not running interactively")
|
||||
|
||||
}
|
||||
|
||||
func TestProjectItems_FieldTitle(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ func NewCmdUnlink(f *cmdutil.Factory, runF func(config unlinkConfig) error) *cob
|
|||
}
|
||||
|
||||
func validateRepoOrTeamFlag(opts *unlinkOpts) error {
|
||||
|
||||
unlinkedTarget := ""
|
||||
if opts.repo != "" {
|
||||
unlinkedTarget = opts.repo
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@ func TestRunView_User(t *testing.T) {
|
|||
|
||||
err := runView(config)
|
||||
assert.NoError(t, err)
|
||||
|
||||
}
|
||||
|
||||
func TestRunView_Viewer(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue