Skip to content

Commit f319667

Browse files
committed
fixing lint
1 parent e304034 commit f319667

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

pkg/github/labels.go

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func ListLabels(getGQLClient GetGQLClientFn, t translations.TranslationHelperFun
160160
vars := map[string]any{
161161
"owner": githubv4.String(owner),
162162
"repo": githubv4.String(repo),
163-
"issueNumber": githubv4.Int(issueNumber),
163+
"issueNumber": githubv4.Int(issueNumber), // #nosec G115 - issue numbers are always small positive integers
164164
}
165165

166166
if err := client.Query(ctx, &query, vars); err != nil {
@@ -190,52 +190,52 @@ func ListLabels(getGQLClient GetGQLClientFn, t translations.TranslationHelperFun
190190

191191
return mcp.NewToolResultText(string(out)), nil
192192

193-
} else {
194-
var query struct {
195-
Repository struct {
196-
Labels struct {
197-
Nodes []struct {
198-
ID githubv4.ID
199-
Name githubv4.String
200-
Color githubv4.String
201-
Description githubv4.String
202-
}
203-
TotalCount githubv4.Int
204-
} `graphql:"labels(first: 100)"`
205-
} `graphql:"repository(owner: $owner, name: $repo)"`
206-
}
193+
}
207194

208-
vars := map[string]any{
209-
"owner": githubv4.String(owner),
210-
"repo": githubv4.String(repo),
211-
}
195+
var query struct {
196+
Repository struct {
197+
Labels struct {
198+
Nodes []struct {
199+
ID githubv4.ID
200+
Name githubv4.String
201+
Color githubv4.String
202+
Description githubv4.String
203+
}
204+
TotalCount githubv4.Int
205+
} `graphql:"labels(first: 100)"`
206+
} `graphql:"repository(owner: $owner, name: $repo)"`
207+
}
212208

213-
if err := client.Query(ctx, &query, vars); err != nil {
214-
return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "Failed to list labels", err), nil
215-
}
209+
vars := map[string]any{
210+
"owner": githubv4.String(owner),
211+
"repo": githubv4.String(repo),
212+
}
216213

217-
labels := make([]map[string]any, len(query.Repository.Labels.Nodes))
218-
for i, labelNode := range query.Repository.Labels.Nodes {
219-
labels[i] = map[string]any{
220-
"id": fmt.Sprintf("%v", labelNode.ID),
221-
"name": string(labelNode.Name),
222-
"color": string(labelNode.Color),
223-
"description": string(labelNode.Description),
224-
}
225-
}
214+
if err := client.Query(ctx, &query, vars); err != nil {
215+
return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "Failed to list labels", err), nil
216+
}
226217

227-
response := map[string]any{
228-
"labels": labels,
229-
"totalCount": int(query.Repository.Labels.TotalCount),
218+
labels := make([]map[string]any, len(query.Repository.Labels.Nodes))
219+
for i, labelNode := range query.Repository.Labels.Nodes {
220+
labels[i] = map[string]any{
221+
"id": fmt.Sprintf("%v", labelNode.ID),
222+
"name": string(labelNode.Name),
223+
"color": string(labelNode.Color),
224+
"description": string(labelNode.Description),
230225
}
226+
}
231227

232-
out, err := json.Marshal(response)
233-
if err != nil {
234-
return nil, fmt.Errorf("failed to marshal labels: %w", err)
235-
}
228+
response := map[string]any{
229+
"labels": labels,
230+
"totalCount": int(query.Repository.Labels.TotalCount),
231+
}
236232

237-
return mcp.NewToolResultText(string(out)), nil
233+
out, err := json.Marshal(response)
234+
if err != nil {
235+
return nil, fmt.Errorf("failed to marshal labels: %w", err)
238236
}
237+
238+
return mcp.NewToolResultText(string(out)), nil
239239
}
240240
}
241241

0 commit comments

Comments
 (0)