Skip to content

Commit 8a3f2cc

Browse files
wiggin77claude
andcommitted
Fix linter errors and align golangci-lint config with Jira plugin
- Fix bodyclose errors in client/client_test.go - Fix misspelling in build/pluginctl/logs.go (configration -> configuration) - Align golangci-lint config with mattermost-plugin-jira - Update goconst.min-len from 2 to 3 - Remove extra exclude-rules for revive linter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 1d4b7c1 commit 8a3f2cc

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

.golangci.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ run:
66

77
linters-settings:
88
goconst:
9-
min-len: 2
9+
min-len: 3
1010
min-occurrences: 2
1111
gofmt:
1212
simplify: true
@@ -115,15 +115,6 @@ issues:
115115
- path: server/configuration.go
116116
linters:
117117
- unused
118-
- linters:
119-
- revive
120-
text: unused-parameter
121-
- linters:
122-
- revive
123-
text: var-naming
124-
- linters:
125-
- revive
126-
text: error-strings
127118
- path: _test\.go
128119
linters:
129120
- bodyclose

build/pluginctl/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func checkJSONLogsSetting(ctx context.Context, client *model.Client4) error {
181181
return fmt.Errorf("failed to fetch config: %w", err)
182182
}
183183
if cfg.LogSettings.FileJson == nil || !*cfg.LogSettings.FileJson {
184-
return errors.New("JSON output for file logs are disabled. Please enable LogSettings.FileJson via the configration in Mattermost.") //nolint:revive,stylecheck
184+
return errors.New("JSON output for file logs are disabled. Please enable LogSettings.FileJson via the configuration in Mattermost.") //nolint:revive,stylecheck
185185
}
186186

187187
return nil

client/client_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ import (
2323
func TestRoundTripper(t *testing.T) {
2424
t.Run("Valid response", func(t *testing.T) {
2525
pluginAPI := &plugintest.API{}
26-
pluginAPI.On("PluginHTTP", mock.AnythingOfType("*http.Request")).Return(&http.Response{StatusCode: http.StatusOK})
26+
pluginAPI.On("PluginHTTP", mock.AnythingOfType("*http.Request")).Return(&http.Response{StatusCode: http.StatusOK, Body: http.NoBody})
2727

2828
roundTripper := pluginAPIRoundTripper{api: pluginAPI}
2929
req, err := http.NewRequest(http.MethodPost, "url", nil)
3030
require.NoError(t, err)
3131

3232
resp, err := roundTripper.RoundTrip(req)
3333
require.NoError(t, err)
34+
defer resp.Body.Close()
3435
require.Equal(t, http.StatusOK, resp.StatusCode)
3536
})
3637

@@ -44,6 +45,9 @@ func TestRoundTripper(t *testing.T) {
4445
require.NoError(t, err)
4546

4647
resp, err := roundTripper.RoundTrip(req)
48+
if resp != nil && resp.Body != nil {
49+
defer resp.Body.Close()
50+
}
4751
require.Nil(t, resp)
4852
require.Error(t, err)
4953
})

0 commit comments

Comments
 (0)