File tree Expand file tree Collapse file tree 6 files changed +26
-23
lines changed Expand file tree Collapse file tree 6 files changed +26
-23
lines changed Original file line number Diff line number Diff line change 99 "github.com/stretchr/testify/require"
1010 "gopkg.in/yaml.v3"
1111
12+ "github.com/golangci/golangci-lint/pkg/exitcodes"
1213 "github.com/golangci/golangci-lint/test/testshared"
1314)
1415
@@ -52,7 +53,19 @@ func TestFix(t *testing.T) {
5253 cfg , err := yaml .Marshal (rc .config )
5354 require .NoError (t , err )
5455
55- testshared .NewLintRunner (t ).RunWithYamlConfig (string (cfg ), args ... )
56+ var runResult * testshared.RunResult
57+ if rc .configPath != "" {
58+ args = append (args , "-c" , rc .configPath )
59+ runResult = testshared .NewLintRunner (t ).RunCommand ("run" , args ... )
60+ } else {
61+ runResult = testshared .NewLintRunner (t ).RunWithYamlConfig (string (cfg ), args ... )
62+ }
63+
64+ // nolintlint test uses non existing linters (bob, alice)
65+ if rc .expectedLinter != "nolintlint" {
66+ runResult .ExpectExitCode (exitcodes .Success )
67+ }
68+
5669 output , err := os .ReadFile (input )
5770 require .NoError (t , err )
5871
Original file line number Diff line number Diff line change 1+ linters-settings :
2+ gocritic :
3+ enabled-checks :
4+ - ruleguard
5+ settings :
6+ ruleguard :
7+ rules : ' ruleguard/rangeExprCopy.go,ruleguard/strings_simplify.go'
8+
Original file line number Diff line number Diff line change 1- //args: -Egocritic
2- //config: linters-settings.gocritic.enabled-checks=ruleguard
3- //config: linters-settings.gocritic.settings.ruleguard.rules=ruleguard/rangeExprCopy.go,ruleguard/strings_simplify.go
1+ // args: -Egocritic
2+ // config_path: testdata/configs/gocritic-fix.yml
43package p
54
65import (
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- //args: -Egocritic
2- //config: linters-settings.gocritic.enabled-checks=ruleguard
3- //config: linters-settings.gocritic.settings.ruleguard.rules=ruleguard/rangeExprCopy.go,ruleguard/strings_simplify.go
1+ // args: -Egocritic
2+ // config_path: testdata/configs/gocritic-fix.yml
43package p
54
65import (
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments