Skip to content

Commit f6d0b4a

Browse files
committed
Exclude and satisfy linters
1 parent f8ca402 commit f6d0b4a

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

.golangci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,25 @@ linters:
2020
- gocritic
2121
- makezero
2222
- gosec
23+
settings:
24+
staticcheck:
25+
checks:
26+
- all
27+
- '-QF1008' # Allow embedded structs to be referenced by field
28+
- '-ST1000' # Do not require package comments
29+
revive:
30+
rules:
31+
- name: exported
32+
disabled: true
33+
- name: exported
34+
disabled: true
35+
- name: package-comments
36+
disabled: true
2337

2438
formatters:
2539
enable:
26-
- gci
2740
- gofmt
2841
- goimports
29-
- golines
3042

3143
output:
3244
formats:

cmd/mcpcurl/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type (
7777
Arguments map[string]interface{} `json:"arguments"`
7878
}
7979

80-
// Define structure to match the response format
80+
// Content matches the response format of a text content response
8181
Content struct {
8282
Type string `json:"type"`
8383
Text string `json:"text"`
@@ -284,10 +284,10 @@ func addCommandFromTool(toolsCmd *cobra.Command, tool *Tool, prettyPrint bool) {
284284
cmd.Flags().Bool(name, false, description)
285285
case "array":
286286
if prop.Items != nil {
287-
if prop.Items.Type == "string" {
287+
switch prop.Items.Type {
288+
case "string":
288289
cmd.Flags().StringSlice(name, []string{}, description)
289-
} else if prop.Items.Type == "object" {
290-
// For complex objects in arrays, we'll use a JSON string that users can provide
290+
case "object":
291291
cmd.Flags().String(name+"-json", "", description+" (provide as JSON array)")
292292
}
293293
}
@@ -327,11 +327,12 @@ func buildArgumentsMap(cmd *cobra.Command, tool *Tool) (map[string]interface{},
327327
}
328328
case "array":
329329
if prop.Items != nil {
330-
if prop.Items.Type == "string" {
330+
switch prop.Items.Type {
331+
case "string":
331332
if values, _ := cmd.Flags().GetStringSlice(name); len(values) > 0 {
332333
arguments[name] = values
333334
}
334-
} else if prop.Items.Type == "object" {
335+
case "object":
335336
if jsonStr, _ := cmd.Flags().GetString(name + "-json"); jsonStr != "" {
336337
var jsonArray []interface{}
337338
if err := json.Unmarshal([]byte(jsonStr), &jsonArray); err != nil {

internal/ghmcp/server.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/github/github-mcp-server/pkg/translations"
1515
gogithub "github.com/google/go-github/v69/github"
1616
"github.com/mark3labs/mcp-go/mcp"
17-
1817
"github.com/mark3labs/mcp-go/server"
1918
"github.com/sirupsen/logrus"
2019
)
@@ -170,7 +169,7 @@ func RunStdioServer(cfg StdioServerConfig) error {
170169

171170
logrusLogger := logrus.New()
172171
if cfg.LogFilePath != "" {
173-
file, err := os.OpenFile(cfg.LogFilePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
172+
file, err := os.OpenFile(cfg.LogFilePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
174173
if err != nil {
175174
return fmt.Errorf("failed to open log file: %w", err)
176175
}

pkg/github/repositories.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ func CreateBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (
612612
if err != nil {
613613
return nil, fmt.Errorf("failed to get repository: %w", err)
614614
}
615-
defer resp.Body.Close()
615+
defer func() { _ = resp.Body.Close() }()
616616

617617
fromBranch = *repository.DefaultBranch
618618
}
@@ -622,7 +622,7 @@ func CreateBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (
622622
if err != nil {
623623
return nil, fmt.Errorf("failed to get reference: %w", err)
624624
}
625-
defer resp.Body.Close()
625+
defer func() { _ = resp.Body.Close() }()
626626

627627
// Create new branch
628628
newRef := &github.Reference{
@@ -634,7 +634,7 @@ func CreateBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (
634634
if err != nil {
635635
return nil, fmt.Errorf("failed to create branch: %w", err)
636636
}
637-
defer resp.Body.Close()
637+
defer func() { _ = resp.Body.Close() }()
638638

639639
r, err := json.Marshal(createdRef)
640640
if err != nil {

pkg/translations/translations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TranslationHelper() (TranslationHelperFunc, func()) {
5656
}
5757
}
5858

59-
// dump translationKeyMap to a json file called github-mcp-server-config.json
59+
// DumpTranslationKeyMap writes the translation map to a json file called github-mcp-server-config.json
6060
func DumpTranslationKeyMap(translationKeyMap map[string]string) error {
6161
file, err := os.Create("github-mcp-server-config.json")
6262
if err != nil {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy