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

@@ -372,10 +372,8 @@ func (obj *Simple) Watcher(ctx context.Context, path string, opts ...etcd.OpOpti
// will return an error. Remember to add the WithPrefix() option if you want to
// watch recursively.
// TODO: do we need to support retry and changed client connections?
// XXX: do we need to track last successful revision and retry from there?
// XXX: if so, use:
// lastRev := response.Header.Revision // TODO: +1 ?
// etcd.WithRev(rev)
// XXX: do we need to track last successful revision and retry from there? If so
// use: lastRev := response.Header.Revision // TODO: +1 ? and: etcd.WithRev(rev)
func (obj *Simple) ComplexWatcher(ctx context.Context, path string, opts ...etcd.OpOption) (*interfaces.WatcherInfo, error) {
if obj.client == nil { // catch bugs, this often means programming error
return nil, fmt.Errorf("client is nil") // extra safety!