mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-20 10:18:44 -04:00
dev: new commands system (#4412)
This commit is contained in:
parent
b5d7302867
commit
784264d72e
20 changed files with 1189 additions and 1153 deletions
test
|
@ -536,86 +536,6 @@ func TestAbsPathFileAnalysis(t *testing.T) {
|
|||
ExpectHasIssue("indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)")
|
||||
}
|
||||
|
||||
func TestDisallowedOptionsInConfig(t *testing.T) {
|
||||
cases := []struct {
|
||||
cfg string
|
||||
option string
|
||||
}{
|
||||
{
|
||||
cfg: `
|
||||
ruN:
|
||||
Args:
|
||||
- 1
|
||||
`,
|
||||
},
|
||||
{
|
||||
cfg: `
|
||||
run:
|
||||
CPUProfilePath: path
|
||||
`,
|
||||
option: "--cpu-profile-path=path",
|
||||
},
|
||||
{
|
||||
cfg: `
|
||||
run:
|
||||
MemProfilePath: path
|
||||
`,
|
||||
option: "--mem-profile-path=path",
|
||||
},
|
||||
{
|
||||
cfg: `
|
||||
run:
|
||||
TracePath: path
|
||||
`,
|
||||
option: "--trace-path=path",
|
||||
},
|
||||
{
|
||||
cfg: `
|
||||
run:
|
||||
Verbose: true
|
||||
`,
|
||||
option: "-v",
|
||||
},
|
||||
}
|
||||
|
||||
testshared.InstallGolangciLint(t)
|
||||
|
||||
for _, c := range cases {
|
||||
// Run with disallowed option set only in config
|
||||
testshared.NewRunnerBuilder(t).
|
||||
WithConfig(c.cfg).
|
||||
WithTargetPath(testdataDir, minimalPkg).
|
||||
Runner().
|
||||
Run().
|
||||
ExpectExitCode(exitcodes.Failure)
|
||||
|
||||
if c.option == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
args := []string{c.option, "--fast"}
|
||||
|
||||
// Run with disallowed option set only in command-line
|
||||
testshared.NewRunnerBuilder(t).
|
||||
WithNoConfig().
|
||||
WithArgs(args...).
|
||||
WithTargetPath(testdataDir, minimalPkg).
|
||||
Runner().
|
||||
Run().
|
||||
ExpectExitCode(exitcodes.Success)
|
||||
|
||||
// Run with disallowed option set both in command-line and in config
|
||||
|
||||
testshared.NewRunnerBuilder(t).
|
||||
WithConfig(c.cfg).
|
||||
WithArgs(args...).
|
||||
WithTargetPath(testdataDir, minimalPkg).
|
||||
Runner().
|
||||
Run().
|
||||
ExpectExitCode(exitcodes.Failure)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefix(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue