From 8cc76edee41b5b535f77268b35b306db89743c44 Mon Sep 17 00:00:00 2001 From: Max Schaefer Date: Wed, 20 May 2020 10:05:26 +0100 Subject: [PATCH] Rephrase a comment and split up some very long lines. --- ql/src/semmle/go/frameworks/NoSQL.qll | 44 ++++++++++++++++++--------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/ql/src/semmle/go/frameworks/NoSQL.qll b/ql/src/semmle/go/frameworks/NoSQL.qll index da198d02183..ba3f4f9f11b 100644 --- a/ql/src/semmle/go/frameworks/NoSQL.qll +++ b/ql/src/semmle/go/frameworks/NoSQL.qll @@ -29,51 +29,65 @@ module NoSQL { abstract class Range extends DataFlow::Node { } /** - * Holds if method `name` of `Collection` struct of `go.mongodb.org/mongo-driver/mongo` - * package interprets parameter `n` as a query. + * Holds if method `name` of struct `Collection` from package + * [go.mongodb.org/mongo-driver/mongo](https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo) + * interprets parameter `n` as a query. */ private predicate collectionMethods(string name, int n) { // func (coll *Collection) CountDocuments(ctx context.Context, filter interface{}, // opts ...*options.CountOptions) (int64, error) name = "CountDocuments" and n = 1 or - // func (coll *Collection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*DeleteResult, error) + // func (coll *Collection) DeleteMany(ctx context.Context, filter interface{}, + // opts ...*options.DeleteOptions) (*DeleteResult, error) name = "DeleteMany" and n = 1 or - // func (coll *Collection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*DeleteResult, error) + // func (coll *Collection) DeleteOne(ctx context.Context, filter interface{}, + // opts ...*options.DeleteOptions) (*DeleteResult, error) name = "DeleteOne" and n = 1 or - // func (coll *Collection) Distinct(ctx context.Context, fieldName string, filter interface{}, ...) ([]interface{}, error) + // func (coll *Collection) Distinct(ctx context.Context, fieldName string, filter interface{}, + // ...) ([]interface{}, error) name = "Distinct" and n = 2 or - // func (coll *Collection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*Cursor, error) + // func (coll *Collection) Find(ctx context.Context, filter interface{}, + // opts ...*options.FindOptions) (*Cursor, error) name = "Find" and n = 1 or - // func (coll *Collection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) *SingleResult + // func (coll *Collection) FindOne(ctx context.Context, filter interface{}, + // opts ...*options.FindOneOptions) *SingleResult name = "FindOne" and n = 1 or - // func (coll *Collection) FindOneAndDelete(ctx context.Context, filter interface{}, ...) *SingleResult + // func (coll *Collection) FindOneAndDelete(ctx context.Context, filter interface{}, ...) + // *SingleResult name = "FindOneAndDelete" and n = 1 or - // func (coll *Collection) FindOneAndReplace(ctx context.Context, filter interface{}, replacement interface{}, ...) *SingleResult + // func (coll *Collection) FindOneAndReplace(ctx context.Context, filter interface{}, + // replacement interface{}, ...) *SingleResult name = "FindOneAndReplace" and n = 1 or - // func (coll *Collection) FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, ...) *SingleResult + // func (coll *Collection) FindOneAndUpdate(ctx context.Context, filter interface{}, + // update interface{}, ...) *SingleResult name = "FindOneAndUpdate" and n = 1 or - // func (coll *Collection) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, ...) (*UpdateResult, error) + // func (coll *Collection) ReplaceOne(ctx context.Context, filter interface{}, + // replacement interface{}, ...) (*UpdateResult, error) name = "ReplaceOne" and n = 1 or - // func (coll *Collection) UpdateMany(ctx context.Context, filter interface{}, update interface{}, ...) (*UpdateResult, error) + // func (coll *Collection) UpdateMany(ctx context.Context, filter interface{}, + // update interface{}, ...) (*UpdateResult, error) name = "UpdateMany" and n = 1 or - // func (coll *Collection) UpdateOne(ctx context.Context, filter interface{}, update interface{}, ...) (*UpdateResult, error) + // func (coll *Collection) UpdateOne(ctx context.Context, filter interface{}, + // update interface{}, ...) (*UpdateResult, error) name = "UpdateOne" and n = 1 or - // func (coll *Collection) Watch(ctx context.Context, pipeline interface{}, ...) (*ChangeStream, error) + // func (coll *Collection) Watch(ctx context.Context, pipeline interface{}, ...) + // (*ChangeStream, error) name = "Watch" and n = 1 or - // func (coll *Collection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (*Cursor, error) + // func (coll *Collection) Aggregate(ctx context.Context, pipeline interface{}, + // opts ...*options.AggregateOptions) (*Cursor, error) name = "Aggregate" and n = 1 }