dev: use directives instead of comments for tests (#2978)

This commit is contained in:
Ludovic Fernandez 2022-07-15 15:32:10 +02:00 committed by GitHub
parent 0abb298136
commit 27f921fa14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
166 changed files with 292 additions and 279 deletions

View File

@ -629,12 +629,12 @@ type WSLSettings struct {
// CustomLinterSettings encapsulates the meta-data of a private linter.
// For example, a private linter may be added to the golangci config file as shown below.
//
// linters-settings:
// custom:
// example:
// path: /example.so
// description: The description of the linter
// original-url: github.com/golangci/example-linter
// linters-settings:
// custom:
// example:
// path: /example.so
// description: The description of the linter
// original-url: github.com/golangci/example-linter
type CustomLinterSettings struct {
// Path to a plugin *.so file that implements the private linter.
Path string

View File

@ -310,7 +310,7 @@ index 2c9f78d..c0d5791 100644
--- a/gofmt.go
+++ b/gofmt.go
@@ -1,9 +1,9 @@
//args: -Egofmt
//golangcitest:args -Egofmt
package p
- func gofmt(a, b int) int {

View File

@ -34,6 +34,7 @@ type jsonObject struct {
}
// NewRevive returns a new Revive linter.
//
//nolint:dupl
func NewRevive(settings *config.ReviveSettings) *goanalysis.Linter {
var mu sync.Mutex

View File

@ -84,6 +84,7 @@ type Node struct {
// Visit method is invoked for each node encountered by Walk.
// If the result visitor w is not nil, Walk visits each of the children
// of node with the visitor w, followed by a call of w.Visit(nil).
//
//nolint:gocyclo,gocritic
func (f *Node) Visit(node ast.Node) ast.Visitor {
switch typedNode := node.(type) {
@ -173,6 +174,7 @@ func (f *Node) Visit(node ast.Node) ast.Visitor {
// The variadic arguments may start with link and category types,
// and must end with a format string and any arguments.
//
//nolint:interfacer
func (f *Node) errorf(n ast.Node, format string, args ...interface{}) {
pos := f.fset.Position(n.Pos())

View File

@ -24,6 +24,7 @@ var errorLineRx = regexp.MustCompile(`^\S+?: (.*)\((\S+?)\)$`)
//
// Sources files are supplied as fullshort slice.
// It consists of pairs: full path to source file and its base name.
//
//nolint:gocyclo,funlen
func errorCheck(outStr string, wantAuto bool, defaultWantedLinter string, fullshort ...string) (err error) {
var errs []error
@ -179,6 +180,7 @@ var (
)
// wantedErrors parses expected errors from comments in a file.
//
//nolint:nakedret
func wantedErrors(file, short, defaultLinter string) (errs []wantedError) {
cache := make(map[string]*regexp.Regexp)

View File

@ -248,7 +248,7 @@ type runContext struct {
func buildConfigFromShortRepr(t *testing.T, repr string, config map[string]interface{}) {
kv := strings.Split(repr, "=")
require.Len(t, kv, 2)
require.Len(t, kv, 2, "repr: %s", repr)
keyParts := strings.Split(kv[0], ".")
require.True(t, len(keyParts) >= 2, len(keyParts))
@ -308,47 +308,55 @@ func extractRunContextFromComments(t *testing.T, sourcePath string) *runContext
continue
}
line = strings.TrimLeft(strings.TrimPrefix(line, "//"), " ")
if strings.HasPrefix(line, "args: ") {
require.Nil(t, rc.args)
args := strings.TrimPrefix(line, "args: ")
require.NotEmpty(t, args)
rc.args = strings.Split(args, " ")
continue
if !strings.HasPrefix(line, "//golangcitest:") {
require.Failf(t, "invalid prefix of comment line %s", line)
}
if strings.HasPrefix(line, "config: ") {
repr := strings.TrimPrefix(line, "config: ")
require.NotEmpty(t, repr)
// TODO(ldez) replace that by strings.Cut when we will drop go1.17
var before string
var after string
if i := strings.Index(line, " "); i >= 0 {
before = line[:i]
after = strings.TrimSpace(line[i+len(" "):])
} else {
require.Failf(t, "invalid prefix of comment line %s", line)
}
switch before {
case "//golangcitest:args":
require.Nil(t, rc.args)
require.NotEmpty(t, after)
rc.args = strings.Split(after, " ")
continue
case "//golangcitest:config":
require.NotEmpty(t, after)
if rc.config == nil {
rc.config = map[string]interface{}{}
}
buildConfigFromShortRepr(t, repr, rc.config)
buildConfigFromShortRepr(t, after, rc.config)
continue
}
if strings.HasPrefix(line, "config_path: ") {
configPath := strings.TrimPrefix(line, "config_path: ")
require.NotEmpty(t, configPath)
rc.configPath = configPath
case "//golangcitest:config_path":
require.NotEmpty(t, after)
rc.configPath = after
continue
}
if strings.HasPrefix(line, "expected_linter: ") {
expectedLinter := strings.TrimPrefix(line, "expected_linter: ")
require.NotEmpty(t, expectedLinter)
rc.expectedLinter = expectedLinter
case "//golangcitest:expected_linter":
require.NotEmpty(t, after)
rc.expectedLinter = after
continue
}
require.Fail(t, "invalid prefix of comment line %s", line)
default:
require.Failf(t, "invalid prefix of comment line %s", line)
}
}
// guess the expected linter if none is specified
if rc.expectedLinter == "" {
for _, arg := range rc.args {
if strings.HasPrefix(arg, "-E") && !strings.Contains(arg, ",") {
require.Empty(t, rc.expectedLinter, "could not infer expected linter for errors because multiple linters are enabled. Please use the `expected_linter: ` directive in your test to indicate the linter-under-test.") //nolint:lll
require.Empty(t, rc.expectedLinter, "could not infer expected linter for errors because multiple linters are enabled. Please use the `//golangcitest:expected_linter ` directive in your test to indicate the linter-under-test.") //nolint:lll
rc.expectedLinter = arg[2:]
}
}

View File

@ -1,4 +1,4 @@
//args: -Easciicheck
//golangcitest:args -Easciicheck
package testdata
import (

View File

@ -1,4 +1,4 @@
//args: -Ebidichk
//golangcitest:args -Ebidichk
package testdata
import "fmt"

View File

@ -1,4 +1,4 @@
//args: -Ebodyclose
//golangcitest:args -Ebodyclose
package testdata
import (

View File

@ -1,4 +1,4 @@
// args: -Econtainedctx
//golangcitest:args -Econtainedctx
package testdata
import "context"

View File

@ -1,4 +1,4 @@
//args: -Econtextcheck
//golangcitest:args -Econtextcheck
package testdata
import "context"

View File

@ -1,5 +1,5 @@
//args: -Ecyclop
//config: linters-settings.cyclop.max-complexity=15
//golangcitest:args -Ecyclop
//golangcitest:config linters-settings.cyclop.max-complexity=15
package testdata
func cyclopComplexFunc(s string) { // ERROR "calculated cyclomatic complexity for function cyclopComplexFunc is 22, max is 15"

View File

@ -1,4 +1,4 @@
//args: -Edeadcode
//golangcitest:args -Edeadcode
package testdata
var y int

View File

@ -1,5 +1,5 @@
// args: -Edecorder
// config_path: testdata/configs/decorder.yml
//golangcitest:args -Edecorder
//golangcitest:config_path testdata/configs/decorder.yml
package testdata
import "math"

View File

@ -1,4 +1,4 @@
// args: -Edecorder
//golangcitest:args -Edecorder
package testdata
import "math"

View File

@ -1,5 +1,5 @@
//args: -Estylecheck,golint --internal-cmd-test
//config_path: testdata/configs/default_exclude.yml
//golangcitest:args -Estylecheck,golint --internal-cmd-test
//golangcitest:config_path testdata/configs/default_exclude.yml
/*Package testdata ...*/
package testdata

View File

@ -1,5 +1,5 @@
//args: -Edepguard
//config_path: testdata/configs/depguard.yml
//golangcitest:args -Edepguard
//golangcitest:config_path testdata/configs/depguard.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Edepguard
//config_path: testdata/configs/depguard_additional_guards.yml
//golangcitest:args -Edepguard
//golangcitest:config_path testdata/configs/depguard_additional_guards.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Edepguard
//config_path: testdata/configs/depguard_ignore_file_rules.yml
//golangcitest:args -Edepguard
//golangcitest:config_path testdata/configs/depguard_ignore_file_rules.yml
package testdata
// NOTE - No lint errors becuase this file is ignored

View File

@ -1,4 +1,4 @@
//args: -Edogsled
//golangcitest:args -Edogsled
package testdata
func Dogsled() {

View File

@ -1,5 +1,5 @@
//args: -Edupl
//config: linters-settings.dupl.threshold=20
//golangcitest:args -Edupl
//golangcitest:config linters-settings.dupl.threshold=20
package testdata
type DuplLogger struct{}

View File

@ -1,4 +1,4 @@
//args: -Edurationcheck
//golangcitest:args -Edurationcheck
package testdata
import (

View File

@ -1,4 +1,4 @@
//args: -Eerrcheck
//golangcitest:args -Eerrcheck
package testdata
import (

View File

@ -1,6 +1,6 @@
//args: -Eerrcheck
//config: linters-settings.errcheck.check-blank=true
//config: linters-settings.errcheck.exclude=testdata/errcheck/exclude.txt
//golangcitest:args -Eerrcheck
//golangcitest:config linters-settings.errcheck.check-blank=true
//golangcitest:config linters-settings.errcheck.exclude=testdata/errcheck/exclude.txt
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Eerrcheck
//config_path: testdata/errcheck/exclude_functions.yml
//golangcitest:args -Eerrcheck
//golangcitest:config_path testdata/errcheck/exclude_functions.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Eerrcheck
//config_path: testdata/errcheck/ignore_config.yml
//golangcitest:args -Eerrcheck
//golangcitest:config_path testdata/errcheck/ignore_config.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Eerrcheck
//config: linters-settings.errcheck.check-blank=true
//golangcitest:args -Eerrcheck
//golangcitest:config linters-settings.errcheck.check-blank=true
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Eerrcheck
//config: linters-settings.errcheck.check-type-assertions=true
//golangcitest:args -Eerrcheck
//golangcitest:config linters-settings.errcheck.check-type-assertions=true
package testdata
func ErrorTypeAssertion(filter map[string]interface{}) bool {

View File

@ -1,5 +1,5 @@
// args: -Eerrchkjson
// config_path: testdata/configs/errchkjson.yml
//golangcitest:args -Eerrchkjson
//golangcitest:config_path testdata/configs/errchkjson.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
// args: -Eerrchkjson
// config_path: testdata/configs/errchkjson_check_error_free_encoding.yml
//golangcitest:args -Eerrchkjson
//golangcitest:config_path testdata/configs/errchkjson_check_error_free_encoding.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
// args: -Eerrchkjson
// config_path: testdata/configs/errchkjson_no_exported.yml
//golangcitest:args -Eerrchkjson
//golangcitest:config_path testdata/configs/errchkjson_no_exported.yml
package testdata
import (

View File

@ -1,4 +1,4 @@
//args: -Eerrname
//golangcitest:args -Eerrname
package testdata
import (

View File

@ -1,4 +1,4 @@
//args: -Eerrorlint
//golangcitest:args -Eerrorlint
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Eerrorlint
//config_path: testdata/configs/errorlint_asserts.yml
//golangcitest:args -Eerrorlint
//golangcitest:config_path testdata/configs/errorlint_asserts.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Eerrorlint
//config_path: testdata/configs/errorlint_comparison.yml
//golangcitest:args -Eerrorlint
//golangcitest:config_path testdata/configs/errorlint_comparison.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Eerrorlint
//config_path: testdata/configs/errorlint_errorf.yml
//golangcitest:args -Eerrorlint
//golangcitest:config_path testdata/configs/errorlint_errorf.yml
package testdata
import (

View File

@ -1,4 +1,4 @@
// args: -Eexecinquery
//golangcitest:args -Eexecinquery
package testdata
import (

View File

@ -1,4 +1,4 @@
//args: -Eexhaustive
//golangcitest:args -Eexhaustive
package testdata
type Direction int

View File

@ -1,5 +1,5 @@
//args: -Eexhaustive
//config_path: testdata/configs/exhaustive_default.yml
//golangcitest:args -Eexhaustive
//golangcitest:config_path testdata/configs/exhaustive_default.yml
package testdata
type Direction int

View File

@ -1,4 +1,4 @@
//args: -Eexhaustive
//golangcitest:args -Eexhaustive
package testdata
// Code generated by some program. DO NOT EDIT.

View File

@ -1,5 +1,5 @@
//args: -Eexhaustive
//config_path: testdata/configs/exhaustive_ignore_enum_members.yml
//golangcitest:args -Eexhaustive
//golangcitest:config_path testdata/configs/exhaustive_ignore_enum_members.yml
package testdata
type Direction int

View File

@ -1,4 +1,4 @@
// args: -Eexhaustivestruct --internal-cmd-test
//golangcitest:args -Eexhaustivestruct --internal-cmd-test
package testdata
import "time"

View File

@ -1,5 +1,5 @@
// args: -Eexhaustivestruct --internal-cmd-test
// config_path: testdata/configs/exhaustivestruct.yml
//golangcitest:args -Eexhaustivestruct --internal-cmd-test
//golangcitest:config_path testdata/configs/exhaustivestruct.yml
package testdata
import "time"

View File

@ -1,4 +1,4 @@
// args: -Eexhaustruct
//golangcitest:args -Eexhaustruct
package testdata
import "time"

View File

@ -1,5 +1,5 @@
// args: -Eexhaustruct
// config_path: testdata/configs/exhaustruct.yml
//golangcitest:args -Eexhaustruct
//golangcitest:config_path testdata/configs/exhaustruct.yml
package testdata
import "time"

View File

@ -1,4 +1,4 @@
//args: -Eexportloopref
//golangcitest:args -Eexportloopref
package testdata
import "fmt"

View File

@ -1,5 +1,5 @@
//args: -Egci
//config_path: testdata/configs/gci.yml
//golangcitest:args -Egci
//golangcitest:config_path testdata/configs/gci.yml
package gci
import (

View File

@ -1,5 +1,5 @@
// args: -Egocritic
// config_path: testdata/configs/gocritic-fix.yml
//golangcitest:args -Egocritic
//golangcitest:config_path testdata/configs/gocritic-fix.yml
package p
import (

View File

@ -1,4 +1,4 @@
//args: -Egodot
//golangcitest:args -Egodot
package p
/*

View File

@ -1,4 +1,4 @@
//args: -Egofmt
//golangcitest:args -Egofmt
package p
func gofmt(a, b int) int {

View File

@ -1,5 +1,5 @@
//args: -Egofumpt
//config: linters-settings.gofumpt.extra-rules=true
//golangcitest:args -Egofumpt
//golangcitest:config linters-settings.gofumpt.extra-rules=true
package p
import "fmt"

View File

@ -1,4 +1,4 @@
//args: -Egofmt,goimports
//golangcitest:args -Egofmt,goimports
package p
import (

View File

@ -1,4 +1,4 @@
//args: -Emisspell
//golangcitest:args -Emisspell
package p
import "log"

View File

@ -1,6 +1,6 @@
//args: -Enolintlint -Elll
//expected_linter: nolintlint
//config: linters-settings.nolintlint.allow-leading-space=false
//golangcitest:args -Enolintlint -Elll
//golangcitest:expected_linter nolintlint
//golangcitest:config linters-settings.nolintlint.allow-leading-space=false
package p
import "fmt"

View File

@ -1,6 +1,6 @@
//args: -Ewhitespace
//config: linters-settings.whitespace.multi-if=true
//config: linters-settings.whitespace.multi-func=true
//golangcitest:args -Ewhitespace
//golangcitest:config linters-settings.whitespace.multi-if=true
//golangcitest:config linters-settings.whitespace.multi-func=true
package p
import "fmt"

View File

@ -1,5 +1,5 @@
//args: -Egci
//config_path: testdata/configs/gci.yml
//golangcitest:args -Egci
//golangcitest:config_path testdata/configs/gci.yml
package gci
import (

View File

@ -1,5 +1,5 @@
// args: -Egocritic
// config_path: testdata/configs/gocritic-fix.yml
//golangcitest:args -Egocritic
//golangcitest:config_path testdata/configs/gocritic-fix.yml
package p
import (

View File

@ -1,4 +1,4 @@
//args: -Egodot
//golangcitest:args -Egodot
package p
/*

View File

@ -1,4 +1,4 @@
//args: -Egofmt
//golangcitest:args -Egofmt
package p
func gofmt(a, b int) int {

View File

@ -1,5 +1,5 @@
// args: -Egofumpt
// config: linters-settings.gofumpt.extra-rules=true
//golangcitest:args -Egofumpt
//golangcitest:config linters-settings.gofumpt.extra-rules=true
package p
import "fmt"

View File

@ -1,4 +1,4 @@
//args: -Egofmt,goimports
//golangcitest:args -Egofmt,goimports
package p
func goimports(a, b int) int {

View File

@ -1,4 +1,4 @@
//args: -Emisspell
//golangcitest:args -Emisspell
package p
import "log"

View File

@ -1,6 +1,6 @@
//args: -Enolintlint -Elll
//expected_linter: nolintlint
//config: linters-settings.nolintlint.allow-leading-space=false
//golangcitest:args -Enolintlint -Elll
//golangcitest:expected_linter nolintlint
//golangcitest:config linters-settings.nolintlint.allow-leading-space=false
package p
import "fmt"

View File

@ -1,6 +1,6 @@
//args: -Ewhitespace
//config: linters-settings.whitespace.multi-if=true
//config: linters-settings.whitespace.multi-func=true
//golangcitest:args -Ewhitespace
//golangcitest:config linters-settings.whitespace.multi-if=true
//golangcitest:config linters-settings.whitespace.multi-func=true
package p
import "fmt"

View File

@ -1,5 +1,5 @@
//args: -Eforbidigo
//config_path: testdata/configs/forbidigo.yml
//golangcitest:args -Eforbidigo
//golangcitest:config_path testdata/configs/forbidigo.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Eforbidigo
//config_path: testdata/configs/forbidigo.yml
//golangcitest:args -Eforbidigo
//golangcitest:config_path testdata/configs/forbidigo.yml
package testdata
import "fmt"

View File

@ -1,5 +1,5 @@
//args: -Eforbidigo
//config: linters-settings.forbidigo.exclude-godoc-examples=false
//golangcitest:args -Eforbidigo
//golangcitest:config linters-settings.forbidigo.exclude-godoc-examples=false
package testdata
import "fmt"

View File

@ -1,4 +1,4 @@
//args: -Eforcetypeassert
//golangcitest:args -Eforcetypeassert
package testdata
import "fmt"

View File

@ -1,6 +1,6 @@
//args: -Efunlen
//config: linters-settings.funlen.lines=20
//config: linters-settings.funlen.statements=10
//golangcitest:args -Efunlen
//golangcitest:config linters-settings.funlen.lines=20
//golangcitest:config linters-settings.funlen.statements=10
package testdata
func TooManyLines() { // ERROR `Function 'TooManyLines' is too long \(22 > 20\)`

View File

@ -1,5 +1,5 @@
//args: -Egci
//config_path: testdata/configs/gci.yml
//golangcitest:args -Egci
//golangcitest:config_path testdata/configs/gci.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Egci
//config_path: testdata/configs/gci.yml
//golangcitest:args -Egci
//golangcitest:config_path testdata/configs/gci.yml
package gci
import (

View File

@ -1,5 +1,5 @@
/*MY TITLE!*/ // ERROR `Expected:TITLE\., Actual: TITLE!`
// args: -Egoheader
// config_path: testdata/configs/go-header.yml
//golangcitest:args -Egoheader
//golangcitest:config_path testdata/configs/go-header.yml
package testdata

View File

@ -1,5 +1,5 @@
/*MY TITLE.*/
// args: -Egoheader
// config_path: testdata/configs/go-header.yml
//golangcitest:args -Egoheader
//golangcitest:config_path testdata/configs/go-header.yml
package testdata

View File

@ -1,4 +1,4 @@
//args: -Egochecknoglobals
//golangcitest:args -Egochecknoglobals
package testdata
import (

View File

@ -1,4 +1,4 @@
//args: -Egochecknoinits
//golangcitest:args -Egochecknoinits
package testdata
import "fmt"

View File

@ -1,5 +1,5 @@
//args: -Egocognit
//config: linters-settings.gocognit.min-complexity=2
//golangcitest:args -Egocognit
//golangcitest:config linters-settings.gocognit.min-complexity=2
package testdata
func GoCognit_CC4_GetWords(number int) string { // ERROR "cognitive complexity 4 of func .* is high .*"

View File

@ -1,4 +1,4 @@
//args: -Egoconst
//golangcitest:args -Egoconst
package testdata
import "fmt"

View File

@ -1,5 +1,5 @@
//args: -Egoconst
//config: linters-settings.goconst.ignore-calls=false
//golangcitest:args -Egoconst
//golangcitest:config linters-settings.goconst.ignore-calls=false
package testdata
import "fmt"

View File

@ -1,5 +1,5 @@
//args: -Egoconst
//config: linters-settings.goconst.ignore-tests=false
//golangcitest:args -Egoconst
//golangcitest:config linters-settings.goconst.ignore-tests=false
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Egoconst
//config: linters-settings.goconst.ignore-tests=true
//golangcitest:args -Egoconst
//golangcitest:config linters-settings.goconst.ignore-tests=true
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Egocritic
//config_path: testdata/configs/gocritic.yml
//golangcitest:args -Egocritic
//golangcitest:config_path testdata/configs/gocritic.yml
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Egocyclo
//config: linters-settings.gocyclo.min-complexity=20
//golangcitest:args -Egocyclo
//golangcitest:config linters-settings.gocyclo.min-complexity=20
package testdata
import "net/http"

View File

@ -1,4 +1,4 @@
//args: -Egodot
//golangcitest:args -Egodot
package testdata
// Godot checks top-level comments // ERROR "Comment should end in a period"

View File

@ -1,5 +1,5 @@
//args: -Egodox
//config: linters-settings.godox.keywords=FIXME,TODO
//golangcitest:args -Egodox
//golangcitest:config linters-settings.godox.keywords=FIXME,TODO
package testdata
func todoLeftInCode() {

View File

@ -1,4 +1,4 @@
//args: -Egoerr113
//golangcitest:args -Egoerr113
package testdata
import "os"

View File

@ -1,4 +1,4 @@
//args: -Egofmt
//golangcitest:args -Egofmt
package testdata
import "fmt"

View File

@ -1,5 +1,5 @@
//args: -Egofmt
//config: linters-settings.gofmt.simplify=false
//golangcitest:args -Egofmt
//golangcitest:config linters-settings.gofmt.simplify=false
package testdata
import "fmt"

View File

@ -1,4 +1,4 @@
// args: -Egofumpt
//golangcitest:args -Egofumpt
package testdata
import "fmt"

View File

@ -1,5 +1,5 @@
// args: -Egofumpt
// config: linters-settings.gofumpt.extra-rules=true
//golangcitest:args -Egofumpt
//golangcitest:config linters-settings.gofumpt.extra-rules=true
package testdata
import "fmt"

View File

@ -1,4 +1,4 @@
//args: -Egoimports
//golangcitest:args -Egoimports
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Egoimports
//config: linters-settings.goimports.local-prefixes=github.com/golangci/golangci-lint
//golangcitest:args -Egoimports
//golangcitest:config linters-settings.goimports.local-prefixes=github.com/golangci/golangci-lint
package goimports
import (

View File

@ -1,4 +1,4 @@
//args: -Egolint --internal-cmd-test
//golangcitest:args -Egolint --internal-cmd-test
package testdata
var Go_lint string // ERROR "don't use underscores in Go names; var `Go_lint` should be `GoLint`"

View File

@ -1,4 +1,4 @@
//args: -Egomnd
//golangcitest:args -Egomnd
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Egomodguard
//config_path: testdata/configs/gomodguard.yml
//golangcitest:args -Egomodguard
//golangcitest:config_path testdata/configs/gomodguard.yml
package testdata
import (

View File

@ -1,4 +1,4 @@
//args: -Egoprintffuncname
//golangcitest:args -Egoprintffuncname
package testdata
func PrintfLikeFuncWithBadName(format string, args ...interface{}) { // ERROR "printf-like formatting function 'PrintfLikeFuncWithBadName' should be named 'PrintfLikeFuncWithBadNamef'"

View File

@ -1,4 +1,4 @@
//args: -Egosec
//golangcitest:args -Egosec
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Egosec
//config_path: testdata/configs/gosec.yml
//golangcitest:args -Egosec
//golangcitest:config_path testdata/configs/gosec.yml
package testdata
import "io/ioutil"

View File

@ -1,5 +1,5 @@
//args: -Egosec
//config_path: testdata/configs/gosec_severity_confidence.yml
//golangcitest:args -Egosec
//golangcitest:config_path testdata/configs/gosec_severity_confidence.yml
package testdata
import (

View File

@ -1,4 +1,4 @@
//args: -Egosimple
//golangcitest:args -Egosimple
package testdata
import (

View File

@ -1,5 +1,5 @@
//args: -Egovet
//config: linters-settings.govet.check-shadowing=true
//golangcitest:args -Egovet
//golangcitest:config linters-settings.govet.check-shadowing=true
package testdata
import (

Some files were not shown because too many files have changed in this diff Show More