Skip to content

Commit 4b8024e

Browse files
Annotate multiline TODO comments (#924)
* annotate multiline TODO comments * Revert "annotate multiline TODO comments" This reverts commit 8af2a6f. * undo vender/* updates * revert more vender/* udpates * move comments into exported functions
1 parent 13d795d commit 4b8024e

File tree

10 files changed

+42
-44
lines changed

10 files changed

+42
-44
lines changed

bson/bsonrw/value_reader.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ type valueReader struct {
8686

8787
// NewBSONDocumentReader returns a ValueReader using b for the underlying BSON
8888
// representation. Parameter b must be a BSON Document.
89-
//
90-
// TODO(skriptble): There's a lack of symmetry between the reader and writer, since the reader takes
91-
// a []byte while the writer takes an io.Writer. We should have two versions of each, one that takes
92-
// a []byte and one that takes an io.Reader or io.Writer. The []byte version will need to return a
93-
// thing that can return the finished []byte since it might be reallocated when appended to.
9489
func NewBSONDocumentReader(b []byte) ValueReader {
90+
// TODO(skriptble): There's a lack of symmetry between the reader and writer, since the reader takes a []byte while the
91+
// TODO writer takes an io.Writer. We should have two versions of each, one that takes a []byte and one that takes an
92+
// TODO io.Reader or io.Writer. The []byte version will need to return a thing that can return the finished []byte since
93+
// TODO it might be reallocated when appended to.
9594
return newValueReader(b)
9695
}
9796

mongo/integration/collection_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ func TestCollection(t *testing.T) {
137137
assert.Equal(mt, want2, res.InsertedIDs[2], "expected inserted ID %v, got %v", want2, res.InsertedIDs[2])
138138
})
139139
mt.Run("batches", func(mt *mtest.T) {
140-
// TODO(GODRIVER-425): remove this as part a larger project to
141-
// refactor integration and other longrunning tasks.
140+
// TODO(GODRIVER-425): remove this as part a larger project to refactor integration and other longrunning
141+
// TODO tasks.
142142
if os.Getenv("EVR_TASK_ID") == "" {
143143
mt.Skip("skipping long running integration test outside of evergreen")
144144
}
@@ -167,8 +167,8 @@ func TestCollection(t *testing.T) {
167167
assert.Equal(mt, numDocs, len(res.InsertedIDs), "expected %v inserted IDs, got %v", numDocs, len(res.InsertedIDs))
168168
})
169169
mt.Run("large document batches", func(mt *mtest.T) {
170-
// TODO(GODRIVER-425): remove this as part a larger project to
171-
// refactor integration and other longrunning tasks.
170+
// TODO(GODRIVER-425): remove this as part a larger project to refactor integration and other longrunning
171+
// TODO tasks.
172172
if os.Getenv("EVR_TASK_ID") == "" {
173173
mt.Skip("skipping long running integration test outside of evergreen")
174174
}
@@ -249,8 +249,8 @@ func TestCollection(t *testing.T) {
249249
}
250250
})
251251
mt.Run("writeError index", func(mt *mtest.T) {
252-
// TODO(GODRIVER-425): remove this as part a larger project to
253-
// refactor integration and other longrunning tasks.
252+
// TODO(GODRIVER-425): remove this as part a larger project to refactor integration and other longrunning
253+
// TODO tasks.
254254
if os.Getenv("EVR_TASK_ID") == "" {
255255
mt.Skip("skipping long running integration test outside of evergreen")
256256
}

mongo/integration/mtest/mongotest.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ func (t *T) ClearMockResponses() {
268268

269269
// GetStartedEvent returns the most recent CommandStartedEvent, or nil if one is not present.
270270
// This can only be called once per event.
271-
// TODO(GODRIVER-2075): GetStartedEvent documents that it returns the most recent event, but
272-
// actually returns the first event. Update either the documentation or implementation.
273271
func (t *T) GetStartedEvent() *event.CommandStartedEvent {
272+
// TODO(GODRIVER-2075): GetStartedEvent documents that it returns the most recent event, but actually returns the first
273+
// TODO event. Update either the documentation or implementation.
274274
if len(t.started) == 0 {
275275
return nil
276276
}
@@ -281,9 +281,9 @@ func (t *T) GetStartedEvent() *event.CommandStartedEvent {
281281

282282
// GetSucceededEvent returns the most recent CommandSucceededEvent, or nil if one is not present.
283283
// This can only be called once per event.
284-
// TODO(GODRIVER-2075): GetSucceededEvent documents that it returns the most recent event, but
285-
// actually returns the first event. Update either the documentation or implementation.
286284
func (t *T) GetSucceededEvent() *event.CommandSucceededEvent {
285+
// TODO(GODRIVER-2075): GetSucceededEvent documents that it returns the most recent event, but actually returns the
286+
// TODO first event. Update either the documentation or implementation.
287287
if len(t.succeeded) == 0 {
288288
return nil
289289
}
@@ -294,9 +294,9 @@ func (t *T) GetSucceededEvent() *event.CommandSucceededEvent {
294294

295295
// GetFailedEvent returns the most recent CommandFailedEvent, or nil if one is not present.
296296
// This can only be called once per event.
297-
// TODO(GODRIVER-2075): GetFailedEvent documents that it returns the most recent event, but actually
298-
// returns the first event. Update either the documentation or implementation.
299297
func (t *T) GetFailedEvent() *event.CommandFailedEvent {
298+
// TODO(GODRIVER-2075): GetFailedEvent documents that it returns the most recent event, but actually returns the first
299+
// TODO event. Update either the documentation or implementation.
300300
if len(t.failed) == 0 {
301301
return nil
302302
}

mongo/integration/unified/testrunner_operation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ func executeLoop(ctx context.Context, args *loopArgs, loopDone <-chan struct{})
236236
case !args.failuresStored(): // store failures as errors if storeFailuressAsEntity isn't specified
237237
appendErr = entityMap.appendBSONArrayEntity(args.ErrorsEntityID, errDoc)
238238
// errors are test runner errors
239-
// TODO GODRIVER-1950: use error types to determine error vs failure instead of depending on the fact that
240-
// operation.execute prepends "execution failed" to test runner errors
239+
// TODO GODRIVER-1950: use error types to determine error vs failure instead of depending on the
240+
// TODO fact that operation.execute prepends "execution failed" to test runner errors
241241
case strings.Contains(loopErr.Error(), "execution failed: "):
242242
appendErr = entityMap.appendBSONArrayEntity(args.ErrorsEntityID, errDoc)
243243
// failures are if an operation returns an incorrect result or error

x/bsonx/bsoncore/bsoncore.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ func AppendHeader(dst []byte, t bsontype.Type, key string) []byte {
6565
// return append(AppendType(dst, t), key+string(0x00)...)
6666
}
6767

68-
// TODO(skriptble): All of the Read* functions should return src resliced to start just after what
69-
// was read.
68+
// TODO(skriptble): All of the Read* functions should return src resliced to start just after what was read.
7069

7170
// ReadType will return the first byte of the provided []byte as a type. If
7271
// there is no available byte, false is returned.
@@ -197,12 +196,13 @@ func ReadString(src []byte) (string, []byte, bool) {
197196

198197
// AppendDocumentStart reserves a document's length and returns the index where the length begins.
199198
// This index can later be used to write the length of the document.
200-
//
201-
// TODO(skriptble): We really need AppendDocumentStart and AppendDocumentEnd.
202-
// AppendDocumentStart would handle calling ReserveLength and providing the index of the start of
203-
// the document. AppendDocumentEnd would handle taking that start index, adding the null byte,
204-
// calculating the length, and filling in the length at the start of the document.
205-
func AppendDocumentStart(dst []byte) (index int32, b []byte) { return ReserveLength(dst) }
199+
func AppendDocumentStart(dst []byte) (index int32, b []byte) {
200+
// TODO(skriptble): We really need AppendDocumentStart and AppendDocumentEnd. AppendDocumentStart would handle calling
201+
// TODO ReserveLength and providing the index of the start of the document. AppendDocumentEnd would handle taking that
202+
// TODO start index, adding the null byte, calculating the length, and filling in the length at the start of the
203+
// TODO document.
204+
return ReserveLength(dst)
205+
}
206206

207207
// AppendDocumentStartInline functions the same as AppendDocumentStart but takes a pointer to the
208208
// index int32 which allows this function to be used inline.

x/mongo/driver/driver.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ func (ssd SingleConnectionDeployment) MinRTT() time.Duration {
214214
return 0
215215
}
216216

217-
// TODO(GODRIVER-617): We can likely use 1 type for both the Type and the RetryMode by using
218-
// 2 bits for the mode and 1 bit for the type. Although in the practical sense, we might not want to
219-
// do that since the type of retryability is tied to the operation itself and isn't going change,
220-
// e.g. and insert operation will always be a write, however some operations are both reads and
221-
// writes, for instance aggregate is a read but with a $out parameter it's a write.
217+
// TODO(GODRIVER-617): We can likely use 1 type for both the Type and the RetryMode by using 2 bits for the mode and 1
218+
// TODO bit for the type. Although in the practical sense, we might not want to do that since the type of retryability
219+
// TODO is tied to the operation itself and isn't going change, e.g. and insert operation will always be a write,
220+
// TODO however some operations are both reads and writes, for instance aggregate is a read but with a $out parameter
221+
// TODO it's a write.
222222

223223
// Type specifies whether an operation is a read, write, or unknown.
224224
type Type uint

x/mongo/driver/mongocrypt/mongocrypt_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ func testKmsCtx(t *testing.T, ctx *Context, keyAltName bool) {
127127
hostname, err := kmsCtx.HostName()
128128
noerr(t, err)
129129

130-
// TODO GODRIVER-2217: Simply check if hostname != expectedHost once all OSes build the latest
131-
// libmongocrypt versions.
130+
// TODO GODRIVER-2217: Simply check if hostname != expectedHost once all OSes build the latest libmongocrypt
131+
// TODO versions.
132132
//
133133
// Only check for the hostname. libmongocrypt versions that do not include MONGOCRYPT-352 will not
134134
// include the default port "443".

x/mongo/driver/operation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,8 +1265,8 @@ func (op Operation) getReadPrefBasedOnTransaction() (*readpref.ReadPref, error)
12651265
}
12661266

12671267
func (op Operation) createReadPref(desc description.SelectedServer, isOpQuery bool) (bsoncore.Document, error) {
1268-
// TODO(GODRIVER-2231): Instead of checking if isOutputAggregate and desc.Server.WireVersion.Max < 13,
1269-
// somehow check if supplied readPreference was "overwritten" with primary in description.selectForReplicaSet.
1268+
// TODO(GODRIVER-2231): Instead of checking if isOutputAggregate and desc.Server.WireVersion.Max < 13, somehow check
1269+
// TODO if supplied readPreference was "overwritten" with primary in description.selectForReplicaSet.
12701270
if desc.Server.Kind == description.Standalone || (isOpQuery && desc.Server.Kind != description.Mongos) ||
12711271
op.Type == Write || (op.IsOutputAggregate && desc.Server.WireVersion.Max < 13) {
12721272
// Don't send read preference for:

x/mongo/driver/topology/CMAP_spec_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,24 @@ var skippedTestDescriptions = map[string]string{
3939
// asserts that handshake errors trigger events "connection closed" then "pool cleared". The Go
4040
// driver uses the same code path for creating all application connections, so those opposing
4141
// event orders cannot be satisfied simultaneously.
42-
// TODO(DRIVERS-1785): Re-enable this test once the spec test is updated to use the same event
43-
// order as the "errors during authentication are processed" load-balancer SDAM spec test.
42+
// TODO(DRIVERS-1785): Re-enable this test once the spec test is updated to use the same event order as the "errors
43+
// TODO during authentication are processed" load-balancer SDAM spec test.
4444
"error during minPoolSize population clears pool": "event ordering is incompatible with load-balancer SDAM spec test (DRIVERS-1785)",
4545
// GODRIVER-1826: The Go connection pool does not currently always deliver connections created
4646
// by maintain() to waiting check-outs. There is a race condition between the goroutine started
4747
// by maintain() to check-in a requested connection and createConnections() picking up the next
4848
// wantConn created by the waiting check-outs. Most of the time, createConnections() wins and
4949
// starts creating new connections. That is not a problem for general use cases, but it prevents
5050
// the "threads blocked by maxConnecting check out minPoolSize connections" test from passing.
51-
// TODO(DRIVERS-2225): Re-enable this test once the spec test is updated to support the Go pool
52-
// minPoolSize maintain() behavior.
51+
// TODO(DRIVERS-2225): Re-enable this test once the spec test is updated to support the Go pool minPoolSize
52+
// TODO maintain() behavior.
5353
"threads blocked by maxConnecting check out minPoolSize connections": "test requires that connections established by minPoolSize are immediately used to satisfy check-out requests (DRIVERS-2225)",
5454
// GODRIVER-1826: The Go connection pool currently delivers any available connection to the
5555
// earliest waiting check-out request, independent of if that check-out request already
5656
// requested a new connection. That behavior is currently incompatible with the "threads blocked
5757
// by maxConnecting check out returned connections" test, which expects that check-out requests
5858
// that request a new connection cannot be satisfied by a check-in.
59-
// TODO(DRIVERS-2223): Re-enable this test once the spec test is updated to support the Go pool
60-
// check-in behavior.
59+
// TODO(DRIVERS-2223): Re-enable this test once the spec test is updated to support the Go pool check-in behavior.
6160
"threads blocked by maxConnecting check out returned connections": "test requires a checked-in connections cannot satisfy a check-out waiting on a new connection (DRIVERS-2223)",
6261
}
6362

x/mongo/driver/topology/topology_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,8 @@ func runInWindowTest(t *testing.T, directory string, filename string) {
774774
}
775775

776776
// Otherwise, check if the expected frequency is within the given tolerance range.
777-
// TODO(GODRIVER-2179): Use assert.Deltaf() when we migrate all test code to the
778-
// "testify/assert" or an API-compatible library for assertions.
777+
// TODO(GODRIVER-2179): Use assert.Deltaf() when we migrate all test code to the "testify/assert" or an
778+
// TODO API-compatible library for assertions.
779779
low := expected - test.Outcome.Tolerance
780780
high := expected + test.Outcome.Tolerance
781781
assert.True(

0 commit comments

Comments
 (0)