diff --git a/.golangci.yml b/.golangci.yml index cdd1054..b8b20f5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,7 @@ -# v1.55.2 +# v1.57.2 # Please don't remove the first line. It uses in CI to determine the golangci version run: - deadline: 5m + timeout: 5m issues: # Maximum issues count per one linter. Set to 0 to disable. Default is 50. @@ -24,6 +24,11 @@ issues: - gocognit - funlen - lll + - forcetypeassert + - path: js\/modules\/k6\/html\/.*\.go + text: "exported: exported " + linters: + - revive - path: js\/modules\/k6\/http\/.*_test\.go linters: # k6/http module's tests are quite complex because they often have several nested levels. @@ -38,17 +43,10 @@ issues: text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden' linters-settings: - nolintlint: - # Disable to ensure that nolint directives don't have a leading space. Default is true. - allow-leading-space: false exhaustive: default-signifies-exhaustive: true - govet: - check-shadowing: true cyclop: max-complexity: 25 - maligned: - suggest-new: true dupl: threshold: 150 goconst: diff --git a/dashboard/command.go b/dashboard/command.go index b60a9ae..618b01e 100644 --- a/dashboard/command.go +++ b/dashboard/command.go @@ -52,7 +52,7 @@ func newReplayCommand(assets *assets, proc *process) *cobra.Command { Long: `The replay command load the recorded dashboard events (NDJSON format) and replay it for the dashboard UI. The compressed file will be automatically decompressed if the file extension is .gz`, Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { err := replay(args[0], opts, assets, proc) if err != nil { return err @@ -107,7 +107,7 @@ func newAggregateCommand(proc *process) *cobra.Command { Long: `The aggregate command converts the file saved by json output to dashboard format events file. The files will be automatically compressed/decompressed if the file extension is .gz`, Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { return aggregate(args[0], args[1], opts, proc) }, } @@ -153,7 +153,7 @@ $ k6 ` + OutputName + ` replay test_result.ndjson $ k6 run --out web-dashboard=record=test_result.ndjson script.js $ k6 ` + OutputName + ` report test_result.ndjson test_result_report.html`, Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { opts.Port = -1 opts.Export = args[1] diff --git a/dashboard/customize_test.go b/dashboard/customize_test.go index 5a5910c..7dd94aa 100644 --- a/dashboard/customize_test.go +++ b/dashboard/customize_test.go @@ -47,7 +47,7 @@ func Test_customize(t *testing.T) { assert.False(t, gjson.GetBytes(conf, `tabs.#(id="custom")`).Exists()) } -func Test_customize_env_found(t *testing.T) { //nolint:paralleltest +func Test_customize_env_found(t *testing.T) { t.Setenv("XK6_DASHBOARD_CONFIG", "testdata/customize/config-custom.js") th := helper(t).osFs() diff --git a/dashboard/extension_test.go b/dashboard/extension_test.go index 62605f4..1ef8efb 100644 --- a/dashboard/extension_test.go +++ b/dashboard/extension_test.go @@ -222,7 +222,7 @@ func TestExtension_error_used_port(t *testing.T) { assert.NoError(t, ext.Stop()) } -func TestExtension_open(t *testing.T) { //nolint:paralleltest +func TestExtension_open(t *testing.T) { var params output.Params params.Logger = logrus.StandardLogger() diff --git a/dashboard/meter_test.go b/dashboard/meter_test.go index d6873e5..5a0c53e 100644 --- a/dashboard/meter_test.go +++ b/dashboard/meter_test.go @@ -58,7 +58,7 @@ func Test_meter_add(t *testing.T) { metric := met.registry.Get("foo") assert.NotNil(t, metric) - assert.Equal(t, 1.0, metric.Sink.(*metrics.CounterSink).Value) //nolint:forcetypeassert + assert.Equal(t, 1.0, metric.Sink.(*metrics.CounterSink).Value) } func Test_meter_update_error(t *testing.T) { diff --git a/dashboard/replay_test.go b/dashboard/replay_test.go index 2a71697..faf6691 100644 --- a/dashboard/replay_test.go +++ b/dashboard/replay_test.go @@ -64,7 +64,7 @@ func Test_replay_gz(t *testing.T) { assert.Equal(t, testdataEventLines, len(lines)) } -func Test_replay_open(t *testing.T) { //nolint:paralleltest +func Test_replay_open(t *testing.T) { opts := &options{ Port: 0, Host: "127.0.0.1",