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

@@ -33,17 +33,15 @@ const (
MergePrefixPuppet = "mgmt_"
)
// mergeGraph returns the merged graph containing all vertices
// and edges found in the graphs produced by the lang and Puppet GAPIs
// associated with the wrapping GAPI.
// Vertices are merged if they adhere to the following rules (for any
// given value of POSTFIX):
// 1. The graph from lang contains a noop vertex named puppet_POSTFIX
// 2. The graph from Puppet contains an empty class mgmt_POSTFIX
// 3. The resulting graph will contain one noop vertex named POSTFIX
// that replaces all nodes mentioned in (1) and (2)
// All edges connecting to any of the vertices merged this way
// will be present in the merged graph.
// mergeGraph returns the merged graph containing all vertices and edges found
// in the graphs produced by the lang and Puppet GAPIs associated with the
// wrapping GAPI. Vertices are merged if they adhere to the following rules (for
// any given value of POSTFIX): (1) The graph from lang contains a noop vertex
// named puppet_POSTFIX. (2) The graph from Puppet contains an empty class
// mgmt_POSTFIX. (3) The resulting graph will contain one noop vertex named
// POSTFIX that replaces all nodes mentioned in (1) and (2). All edges
// connecting to any of the vertices merged this way will be present in the
// merged graph.
func mergeGraphs(graphFromLang, graphFromPuppet *pgraph.Graph) (*pgraph.Graph, error) {
if graphFromLang == nil || graphFromPuppet == nil {
return nil, fmt.Errorf("cannot merge graphs until both child graphs are loaded")