test: Add a check for too long or badly reflowed docstrings

This ensures that docstring comments are wrapped to 80 chars. ffrank
seemed to be making this mistake far too often, and it's a silly thing
to look for manually. As it turns out, I've made it too, as have many
others. Now we have a test that checks for most cases. There are still a
few stray cases that aren't checked automatically, but this can be
improved upon if someone is motivated to do so.

Before anyone complains about the 80 character limit: this only checks
docstring comments, not source code length or inline source code
comments. There's no excuse for having docstrings that are badly
reflowed or over 80 chars, particularly if you have an automated test.
This commit is contained in:
James Shubin
2020-01-25 04:05:43 -05:00
parent 525e2bafee
commit f67ad9c061
73 changed files with 775 additions and 410 deletions

View File

@@ -37,8 +37,9 @@ const (
// something goes wrong.
// XXX: since the caller of this (via the World API) has no way to tell it it's
// done, does that mean we leak go-routines since it might still be running, but
// perhaps even blocked??? Could this cause a dead-lock? Should we instead return
// some sort of struct which has a close method with it to ask for a shutdown?
// perhaps even blocked??? Could this cause a dead-lock? Should we instead
// return some sort of struct which has a close method with it to ask for a
// shutdown?
func WatchStr(ctx context.Context, client interfaces.Client, key string) (chan error, error) {
// new key structure is $NS/strings/$key = $data
path := fmt.Sprintf("%s/strings/%s", ns, key)
@@ -70,8 +71,8 @@ func GetStr(ctx context.Context, client interfaces.Client, key string) (string,
return val, nil
}
// SetStr sets a key and hostname pair to a certain value. If the value is
// nil, then it deletes the key. Otherwise the value should point to a string.
// SetStr sets a key and hostname pair to a certain value. If the value is nil,
// then it deletes the key. Otherwise the value should point to a string.
// TODO: TTL or delete disconnect?
func SetStr(ctx context.Context, client interfaces.Client, key string, data *string) error {
// key structure is $NS/strings/$key = $data