From c986ee5fbdff047481fdf3b2d665baa9256bd51f Mon Sep 17 00:00:00 2001 From: "Iskander (Alex) Sharipov" Date: Sat, 2 Feb 2019 17:21:28 +0300 Subject: [PATCH] checkers: add checkers info fields test (#794) Don't permit empty summary or param docs. Signed-off-by: Iskander Sharipov --- checkers/checkers_test.go | 14 ++++++++++++++ checkers/hexLiteral_checker.go | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/checkers/checkers_test.go b/checkers/checkers_test.go index 3932cdebe..e05c47796 100644 --- a/checkers/checkers_test.go +++ b/checkers/checkers_test.go @@ -54,6 +54,20 @@ func TestTags(t *testing.T) { } } +func TestDocs(t *testing.T) { + for _, info := range lintpack.GetCheckersInfo() { + if info.Summary == "" { + t.Errorf("%q checker lacks summary", info.Name) + } + for key, p := range info.Params { + if p.Usage == "" { + t.Errorf("%q checker %q param lacks usage docs", + info.Name, key) + } + } + } +} + func TestStableList(t *testing.T) { // Verify that new checker is not added without "experimental" // tag by accident. When stable checker is about to be added, diff --git a/checkers/hexLiteral_checker.go b/checkers/hexLiteral_checker.go index 8216417a8..a700314cf 100644 --- a/checkers/hexLiteral_checker.go +++ b/checkers/hexLiteral_checker.go @@ -14,7 +14,7 @@ func init() { var info lintpack.CheckerInfo info.Name = "hexLiteral" info.Tags = []string{"style", "experimental"} - info.Summary = "" + info.Summary = "Detects hex literals that have mixed case letter digits" info.Before = ` x := 0X12 y := 0xfF`