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:
@@ -66,8 +66,8 @@ func (obj *CPUCountFact) Init(init *facts.Init) error {
|
||||
}
|
||||
|
||||
// Stream returns the changing values that this fact has over time. It will
|
||||
// first poll sysfs to get the initial cpu count, and then receives UEvents
|
||||
// from the kernel as CPUs are added/removed.
|
||||
// first poll sysfs to get the initial cpu count, and then receives UEvents from
|
||||
// the kernel as CPUs are added/removed.
|
||||
func (obj CPUCountFact) Stream() error {
|
||||
defer close(obj.init.Output) // signal when we're done
|
||||
|
||||
@@ -178,8 +178,8 @@ func getCPUCount() (int64, error) {
|
||||
return parseCPUList(string(dat))
|
||||
}
|
||||
|
||||
// Parses a line of the form X,Y,Z,... where X,Y,Z can be either a single CPU or a
|
||||
// contiguous range of CPUs. e.g. "2,4-31,32-63". If there is an error parsing
|
||||
// Parses a line of the form X,Y,Z,... where X,Y,Z can be either a single CPU or
|
||||
// a contiguous range of CPUs. e.g. "2,4-31,32-63". If there is an error parsing
|
||||
// the line the function will return 0.
|
||||
func parseCPUList(list string) (int64, error) {
|
||||
var count int64
|
||||
|
||||
Reference in New Issue
Block a user