Skip to content

Commit c986ee5

Browse files
authored
checkers: add checkers info fields test (go-critic#794)
Don't permit empty summary or param docs. Signed-off-by: Iskander Sharipov <[email protected]>
1 parent cbe095d commit c986ee5

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

checkers/checkers_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ func TestTags(t *testing.T) {
5454
}
5555
}
5656

57+
func TestDocs(t *testing.T) {
58+
for _, info := range lintpack.GetCheckersInfo() {
59+
if info.Summary == "" {
60+
t.Errorf("%q checker lacks summary", info.Name)
61+
}
62+
for key, p := range info.Params {
63+
if p.Usage == "" {
64+
t.Errorf("%q checker %q param lacks usage docs",
65+
info.Name, key)
66+
}
67+
}
68+
}
69+
}
70+
5771
func TestStableList(t *testing.T) {
5872
// Verify that new checker is not added without "experimental"
5973
// tag by accident. When stable checker is about to be added,

checkers/hexLiteral_checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func init() {
1414
var info lintpack.CheckerInfo
1515
info.Name = "hexLiteral"
1616
info.Tags = []string{"style", "experimental"}
17-
info.Summary = ""
17+
info.Summary = "Detects hex literals that have mixed case letter digits"
1818
info.Before = `
1919
x := 0X12
2020
y := 0xfF`

0 commit comments

Comments
 (0)