Skip to content

Commit

Permalink
checkers: add checkers info fields test (go-critic#794)
Browse files Browse the repository at this point in the history
Don't permit empty summary or param docs.

Signed-off-by: Iskander Sharipov <[email protected]>
  • Loading branch information
quasilyte authored Feb 2, 2019
1 parent cbe095d commit c986ee5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions checkers/checkers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion checkers/hexLiteral_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit c986ee5

Please sign in to comment.