Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
johnallers committed Feb 26, 2025
1 parent 1a9691e commit 2d022b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions pkg/connector/tickets.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (ln *Linear) CreateTicket(ctx context.Context, ticket *v2.Ticket, schema *v
payload.FieldOptions[cf.Id] = val
}

labelIds := make([]string, 0, len(ticket.Labels))
labelIDs := make([]string, 0, len(ticket.Labels))
for _, label := range ticket.Labels {
// Workaround issue where an empty label exists in ticket.Labels
if label == "" {
Expand All @@ -97,10 +97,10 @@ func (ln *Linear) CreateTicket(ctx context.Context, ticket *v2.Ticket, schema *v
}
}

labelIds = append(labelIds, issueLabel.ID)
labelIDs = append(labelIDs, issueLabel.ID)
}

payload.LabelIds = labelIds
payload.LabelIDs = labelIDs

issue, err := ln.client.CreateIssue(ctx, payload)
if err != nil {
Expand All @@ -113,7 +113,7 @@ func (ln *Linear) CreateTicket(ctx context.Context, ticket *v2.Ticket, schema *v
}

func (ln *Linear) GetTicketSchema(ctx context.Context, schemaID string) (*v2.TicketSchema, annotations.Annotations, error) {
teams, _, _, _, err := ln.client.ListTeamWorkflowStates(ctx, linear.GetTeamsVars{TeamIds: []string{schemaID}, First: 2})
teams, _, _, _, err := ln.client.ListTeamWorkflowStates(ctx, linear.GetTeamsVars{TeamIDs: []string{schemaID}, First: 2})
if err != nil {
return nil, nil, fmt.Errorf("baton-linear: failed to list team workflow states: %w", err)
}
Expand Down Expand Up @@ -289,9 +289,9 @@ func (ln *Linear) BulkCreateTickets(ctx context.Context, request *v2.TicketsServ
payloads[i].FieldOptions[cf.Id] = val
}

labelIds := make([]string, 0, len(req.Labels))
labelIds = append(labelIds, req.Labels...)
payloads[i].LabelIds = labelIds
labelIDs := make([]string, 0, len(req.Labels))
labelIDs = append(labelIDs, req.Labels...)
payloads[i].LabelIDs = labelIDs
}

issues, err := ln.client.BulkCreateIssues(ctx, &payloads)
Expand Down Expand Up @@ -319,13 +319,13 @@ func (ln *Linear) BulkGetTickets(ctx context.Context, request *v2.TicketsService
}

// Extract ticket IDs from the request
ticketIds := make([]string, 0, len(request.TicketRequests))
ticketIDs := make([]string, 0, len(request.TicketRequests))
for _, req := range request.TicketRequests {
ticketIds = append(ticketIds, req.Id)
ticketIDs = append(ticketIDs, req.Id)
}

// Query the issues
issues, _, _, err := ln.client.ListIssuesById(ctx, ticketIds)
issues, _, _, err := ln.client.ListIssuesByIDs(ctx, ticketIDs)
if err != nil {
return nil, fmt.Errorf("baton-linear: failed to query issues: %w", err)
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/linear/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ type GetTeamVars struct {
}

type GetTeamsVars struct {
TeamIds []string `json:"teamIds,omitempty"`
TeamIDs []string `json:"teamIds,omitempty"`
After string `json:"after,omitempty"`
First int `json:"first,omitempty"`
}
Expand All @@ -148,7 +148,7 @@ type CreateIssuePayload struct {
TeamId string
Title string
Description string
LabelIds []string
LabelIDs []string
FieldOptions map[string]interface{}
}

Expand Down Expand Up @@ -577,7 +577,7 @@ func (c *Client) GetTeamMemberships(ctx context.Context, getTeamVars GetTeamVars
return res.Data.Team.Memberships.Nodes, "", resp, rlData, nil
}

// ListTeamWorkflowStates returns workflow states for specific teams
// ListTeamWorkflowStates returns workflow states for specific teams.
func (c *Client) ListTeamWorkflowStates(ctx context.Context, getTeamsVars GetTeamsVars) ([]Team, string, *http.Response, *v2.RateLimitDescription, error) {
query := `query TeamWorkflowStates($after: String, $first: Int, $teamIds: [ID!]) {
teams(after: $after, first: $first, filter: { id: { in: $teamIds } }) {
Expand Down Expand Up @@ -664,8 +664,8 @@ func createIssuePayloadToInputMap(payload CreateIssuePayload) *map[string]interf
"title": payload.Title,
"description": payload.Description,
}
if len(payload.LabelIds) > 0 {
input["labelIds"] = payload.LabelIds
if len(payload.LabelIDs) > 0 {
input["labelIds"] = payload.LabelIDs
}
for key, value := range payload.FieldOptions {
input[key] = value
Expand Down Expand Up @@ -828,8 +828,8 @@ func (c *Client) GetIssue(ctx context.Context, issueId string) (*Issue, error) {
return &res.Data.Issue, nil
}

func (c *Client) ListIssuesById(ctx context.Context, issueIds []string) (*[]Issue, *http.Response, *v2.RateLimitDescription, error) {
if len(issueIds) == 0 {
func (c *Client) ListIssuesByIDs(ctx context.Context, issueIDs []string) (*[]Issue, *http.Response, *v2.RateLimitDescription, error) {
if len(issueIDs) == 0 {
return &[]Issue{}, nil, nil, nil
}

Expand Down Expand Up @@ -862,7 +862,7 @@ func (c *Client) ListIssuesById(ctx context.Context, issueIds []string) (*[]Issu

b := map[string]interface{}{
"query": query,
"variables": map[string]interface{}{"issueIds": issueIds},
"variables": map[string]interface{}{"issueIds": issueIDs},
}

var res GraphQLIssuesResponse
Expand Down

0 comments on commit 2d022b8

Please sign in to comment.