dev: new commands system ()

This commit is contained in:
Ludovic Fernandez 2024-02-27 00:03:48 +01:00 committed by GitHub
parent b5d7302867
commit 784264d72e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 1189 additions and 1153 deletions

View file

@ -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