diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 39d434215b35..627a45832b2a 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -2324,8 +2324,7 @@ issues: - gosec - # Run some linter only for test files by excluding its issues - # for everything else. + # Run some linter only for test files by excluding its issues for everything else. - path-except: _test\.go linters: - forbidigo diff --git a/docs/src/docs/usage/false-positives.mdx b/docs/src/docs/usage/false-positives.mdx index 39fd61141349..20b91a5b8f73 100644 --- a/docs/src/docs/usage/false-positives.mdx +++ b/docs/src/docs/usage/false-positives.mdx @@ -81,7 +81,7 @@ issues: - goconst ``` -The opposite, excluding reports *except* for specific paths, is also possible. +The opposite, excluding reports **except** for specific paths, is also possible. In the following example, only test files get checked: ```yml diff --git a/pkg/config/issues.go b/pkg/config/issues.go index 7af15f5c2e0c..417b28bdbf05 100644 --- a/pkg/config/issues.go +++ b/pkg/config/issues.go @@ -154,10 +154,9 @@ func (b *BaseRule) Validate(minConditionsCount int) error { if len(b.Linters) > 0 { nonBlank++ } - // Filtering by path counts as one condition, regardless how it is done - // (one or both). Otherwise a rule with Path and PathExcept set would - // pass validation whereas before the introduction of path-except that - // would't have been precise enough. + // Filtering by path counts as one condition, regardless how it is done (one or both). + // Otherwise, a rule with Path and PathExcept set would pass validation + // whereas before the introduction of path-except that wouldn't have been precise enough. if b.Path != "" || b.PathExcept != "" { nonBlank++ } @@ -168,7 +167,7 @@ func (b *BaseRule) Validate(minConditionsCount int) error { nonBlank++ } if nonBlank < minConditionsCount { - return fmt.Errorf("at least %d of (text, source, [not-]path, linters) should be set", minConditionsCount) + return fmt.Errorf("at least %d of (text, source, path[-except], linters) should be set", minConditionsCount) } return nil } diff --git a/test/testdata/configs/forbidigo_tests.yml b/test/testdata/configs/path-except.yml similarity index 100% rename from test/testdata/configs/forbidigo_tests.yml rename to test/testdata/configs/path-except.yml diff --git a/test/testdata/forbidigo_exclude.go b/test/testdata/path_except.go similarity index 74% rename from test/testdata/forbidigo_exclude.go rename to test/testdata/path_except.go index 23e014cf47bd..ab7b33a09c00 100644 --- a/test/testdata/forbidigo_exclude.go +++ b/test/testdata/path_except.go @@ -1,5 +1,5 @@ //golangcitest:args -Eforbidigo -//golangcitest:config_path testdata/configs/forbidigo_tests.yml +//golangcitest:config_path testdata/configs/path-except.yml //golangcitest:expected_exitcode 0 package testdata diff --git a/test/testdata/forbidigo_exclude_test.go b/test/testdata/path_except_test.go similarity index 81% rename from test/testdata/forbidigo_exclude_test.go rename to test/testdata/path_except_test.go index 73466be1b22d..5f69f87a58e7 100644 --- a/test/testdata/forbidigo_exclude_test.go +++ b/test/testdata/path_except_test.go @@ -1,5 +1,5 @@ //golangcitest:args -Eforbidigo -//golangcitest:config_path testdata/configs/forbidigo_tests.yml +//golangcitest:config_path testdata/configs/path-except.yml package testdata import (