Skip to content

Commit

Permalink
self-review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonboom committed Oct 6, 2024
1 parent f63363c commit 960c3dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ In any case, you can just not enable the linter.
```shell
$ nilnil --checked-types chan,func,iface,map,ptr,uintptr,unsafeptr ./...
$ nilnil --detect-opposite-too ./...
$ nilnil --detect-opposite-too --checked-types ptr ./..
$ nilnil --detect-opposite ./...
$ nilnil --detect-opposite --checked-types ptr ./..
```
### golangci-lint
Expand All @@ -106,9 +106,9 @@ https://golangci-lint.run/usage/linters/#nilnil
```yaml
linters-settings:
nilnil:
# Detect opposite situation (simultaneous return of non-nil error and valid value).
# In addition, detect opposite situation (simultaneous return of non-nil error and valid value).
# Default: false
detect-opposite-too: true
detect-opposite: true
# List of return types to check.
# Default: ["chan", "func", "iface", "map", "ptr", "uintptr", "unsafeptr"]
checked-types:
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func New() *analysis.Analyzer {
Requires: []*analysis.Analyzer{inspect.Analyzer},
}
a.Flags.Var(&n.checkedTypes, "checked-types", "comma separated list of return types to check")
a.Flags.BoolVar(&n.detectOppositeToo, "detect-opposite-too", false,
"detect opposite situation (simultaneous return of non-nil error and valid value)")
a.Flags.BoolVar(&n.detectOppositeToo, "detect-opposite", false,
"in addition, detect opposite situation (simultaneous return of non-nil error and valid value)")

return a
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestNilNil_Flags_DetectOpposite(t *testing.T) {
t.Parallel()

anlzr := analyzer.New()
if err := anlzr.Flags.Set("detect-opposite-too", "true"); err != nil {
if err := anlzr.Flags.Set("detect-opposite", "true"); err != nil {
t.Fatal(err)
}
analysistest.Run(t, analysistest.TestData(), anlzr, "opposite")
Expand All @@ -42,7 +42,7 @@ func TestNilNil_Flags_DetectOppositeAndCheckedTypes(t *testing.T) {
t.Parallel()

anlzr := analyzer.New()
if err := anlzr.Flags.Set("detect-opposite-too", "true"); err != nil {
if err := anlzr.Flags.Set("detect-opposite", "true"); err != nil {
t.Fatal(err)
}
if err := anlzr.Flags.Set("checked-types", "chan,map"); err != nil {
Expand Down

0 comments on commit 960c3dd

Please sign in to comment.