From 960c3dd040bb30cea02beaab1b75686fad1bce06 Mon Sep 17 00:00:00 2001 From: Anton Telyshev Date: Sun, 6 Oct 2024 14:58:34 +0300 Subject: [PATCH] self-review fixes --- README.md | 8 ++++---- pkg/analyzer/analyzer.go | 4 ++-- pkg/analyzer/analyzer_test.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0dfcaee..df53a62 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: diff --git a/pkg/analyzer/analyzer.go b/pkg/analyzer/analyzer.go index 44b1667..6959059 100644 --- a/pkg/analyzer/analyzer.go +++ b/pkg/analyzer/analyzer.go @@ -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 } diff --git a/pkg/analyzer/analyzer_test.go b/pkg/analyzer/analyzer_test.go index 8dee6ee..108d21f 100644 --- a/pkg/analyzer/analyzer_test.go +++ b/pkg/analyzer/analyzer_test.go @@ -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") @@ -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 {