The following issues were found

src/mongo/db/transaction_history_iterator_test.cpp
1 issues
syntax error
Error

Line: 87

              
}  // namespace

TEST_F(SessionHistoryIteratorTest, NormalHistory) {
    auto entry1 = makeOplogEntry(repl::OpTime(Timestamp(52, 345), 2),  // optime
                                 BSON("x" << 30),                      // o
                                 repl::OpTime());  //  optime of previous write in transaction

    insertOplogEntry(entry1);

            

Reported by Cppcheck.

src/mongo/db/transaction_participant_retryable_writes_test.cpp
1 issues
syntax error
Error

Line: 288

                  boost::optional<OperationContextSession> _opContextSession;
};

TEST_F(TransactionParticipantRetryableWritesTest, SessionEntryNotWrittenOnBegin) {
    const auto& sessionId = *opCtx()->getLogicalSessionId();
    auto txnParticipant = TransactionParticipant::get(opCtx());
    txnParticipant.refreshFromStorageIfNeeded(opCtx());

    const TxnNumber txnNum = 20;

            

Reported by Cppcheck.

src/mongo/db/transaction_participant_test.cpp
1 issues
syntax error
Error

Line: 353

              
// Test that transaction lock acquisition times out in `maxTransactionLockRequestTimeoutMillis`
// milliseconds.
TEST_F(TxnParticipantTest, TransactionThrowsLockTimeoutIfLockIsUnavailable) {
    const std::string dbName = "TestDB";

    auto sessionCheckout = checkOutSession();
    auto txnParticipant = TransactionParticipant::get(opCtx());
    txnParticipant.unstashTransactionResources(opCtx(), "insert");

            

Reported by Cppcheck.

src/mongo/db/update/addtoset_node_test.cpp
1 issues
syntax error
Error

Line: 50

              using mongo::mutablebson::countChildren;
using mongo::mutablebson::Element;

DEATH_TEST_REGEX(AddToSetNodeTest,
                 InitFailsForEmptyElement,
                 R"#(Invariant failure.*modExpr.ok())#") {
    auto update = fromjson("{$addToSet: {}}");
    boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest());
    AddToSetNode node;

            

Reported by Cppcheck.

src/mongo/db/update/arithmetic_node_test.cpp
1 issues
syntax error
Error

Line: 49

              using mongo::mutablebson::countChildren;
using mongo::mutablebson::Element;

DEATH_TEST_REGEX(ArithmeticNodeTest,
                 InitFailsForEmptyElement,
                 R"#(Invariant failure.*modExpr.ok\(\))#") {
    auto update = fromjson("{$inc: {}}");
    boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest());
    ArithmeticNode node(ArithmeticNode::ArithmeticOp::kAdd);

            

Reported by Cppcheck.

src/mongo/db/update/bit_node_test.cpp
1 issues
syntax error
Error

Line: 49

              using mongo::mutablebson::countChildren;
using mongo::mutablebson::Element;

TEST(BitNodeTest, InitWithDoubleFails) {
    boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest());
    auto update = fromjson("{$bit: {a: 0}}");
    BitNode node;
    ASSERT_NOT_OK(node.init(update["$bit"]["a"], expCtx));
}

            

Reported by Cppcheck.

src/mongo/db/update/compare_node_test.cpp
1 issues
syntax error
Error

Line: 50

              using mongo::mutablebson::countChildren;
using mongo::mutablebson::Element;

DEATH_TEST_REGEX(CompareNodeTest,
                 InitFailsForEmptyElement,
                 R"#(Invariant failure.*modExpr.ok\(\))#") {
    auto update = fromjson("{$max: {}}");
    boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest());
    CompareNode node(CompareNode::CompareMode::kMax);

            

Reported by Cppcheck.

src/mongo/db/update/current_date_node_test.cpp
1 issues
syntax error
Error

Line: 65

              using mongo::mutablebson::countChildren;
using mongo::mutablebson::Element;

DEATH_TEST_REGEX(CurrentDateNodeTest,
                 InitFailsForEmptyElement,
                 R"#(Invariant failure.*modExpr.ok\(\))#") {
    auto update = fromjson("{$currentDate: {}}");
    boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest());
    CurrentDateNode node;

            

Reported by Cppcheck.

src/mongo/db/update/delta_executor_test.cpp
1 issues
syntax error
Error

Line: 100

                  }
}

TEST(DeltaExecutorTest, Update) {
    BSONObj preImage(fromjson("{f1: {a: {b: {c: 1}, c: 1}}}"));
    UpdateIndexData indexData;
    constexpr bool mustCheckExistenceForInsertOperations = true;
    indexData.addPath(FieldRef("p.a.b"));
    indexData.addPath(FieldRef("f1.a.b"));

            

Reported by Cppcheck.

src/mongo/db/update/document_diff_applier_test.cpp
1 issues
syntax error
Error

Line: 58

                  ASSERT_BSONOBJ_BINARY_EQ(postImageAgain, expectedPost);
}

TEST(DiffApplierTest, DeleteSimple) {
    const BSONObj preImage(BSON("f1" << 1 << "foo" << 2 << "f2" << 3));

    diff_tree::DocumentSubDiffNode diffNode;
    diffNode.addDelete("f1");
    diffNode.addDelete("f2");

            

Reported by Cppcheck.