Skip to content

Commit

Permalink
review: rename tests file and cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed May 31, 2023
1 parent c0f17c6 commit 191a39f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/src/docs/usage/false-positives.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions pkg/config/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
}
Expand All @@ -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
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down

0 comments on commit 191a39f

Please sign in to comment.