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:
@@ -35,8 +35,8 @@ import (
|
||||
)
|
||||
|
||||
// SocketSet is used to receive events from a socket and shut it down cleanly
|
||||
// when asked. It contains a socket for events and a pipe socket to unblock receive
|
||||
// on shutdown.
|
||||
// when asked. It contains a socket for events and a pipe socket to unblock
|
||||
// receive on shutdown.
|
||||
type SocketSet struct {
|
||||
fdEvents int
|
||||
fdPipe int
|
||||
@@ -80,8 +80,8 @@ func NewSocketSet(groups uint32, name string, proto int) (*SocketSet, error) {
|
||||
}
|
||||
|
||||
// ReceiveBytes waits for bytes from fdEvents and return a byte array truncated
|
||||
// to the message length. It will block until an event is produced, or shutdown is
|
||||
// called.
|
||||
// to the message length. It will block until an event is produced, or shutdown
|
||||
// is called.
|
||||
func (obj *SocketSet) ReceiveBytes() ([]byte, error) {
|
||||
// Select will return when any fd in fdSet (fdEvents and fdPipe) is ready
|
||||
// to read.
|
||||
|
||||
14
util/util.go
14
util/util.go
@@ -70,8 +70,8 @@ func Uint64KeyFromStrInMap(needle string, haystack map[uint64]string) (uint64, b
|
||||
return 0, false
|
||||
}
|
||||
|
||||
// StrRemoveDuplicatesInList removes any duplicate values in the list.
|
||||
// This implementation is possibly sub-optimal (O(n^2)?) but preserves ordering.
|
||||
// StrRemoveDuplicatesInList removes any duplicate values in the list. This
|
||||
// implementation is possibly sub-optimal (O(n^2)?) but preserves ordering.
|
||||
func StrRemoveDuplicatesInList(list []string) []string {
|
||||
unique := []string{}
|
||||
for _, x := range list {
|
||||
@@ -561,8 +561,8 @@ func SessionBusPrivateUsable() (conn *dbus.Conn, err error) {
|
||||
}
|
||||
|
||||
// PriorityStrSliceSort filters any elements matching fn to the end of the list.
|
||||
// You can reverse the match result with a not to filter to the front instead!
|
||||
// A copy of the list is returned, the original is not modified.
|
||||
// You can reverse the match result with a not to filter to the front instead! A
|
||||
// copy of the list is returned, the original is not modified.
|
||||
func PriorityStrSliceSort(input []string, fn func(string) bool) []string {
|
||||
output := []string{}
|
||||
found := []string{}
|
||||
@@ -605,9 +605,9 @@ func SortedStrSliceCompare(a, b []string) error {
|
||||
}
|
||||
|
||||
// PathSlice is a type used to implement sort.Interface on a slice of strings,
|
||||
// where each string is a path. This allows you to call sort.Sort() on a list
|
||||
// of paths, after casting the []string{} to this type. Paths will be sorted
|
||||
// by depth in alphabetical order.
|
||||
// where each string is a path. This allows you to call sort.Sort() on a list of
|
||||
// paths, after casting the []string{} to this type. Paths will be sorted by
|
||||
// depth in alphabetical order.
|
||||
type PathSlice []string
|
||||
|
||||
// Len returns the length of obj. It is required to satisfy sort.Interface.
|
||||
|
||||
Reference in New Issue
Block a user