The following issues were found

src/mongo/db/repl/replication_consistency_markers_impl_test.cpp
1 issues
syntax error
Error

Line: 124

                  return RecoveryUnitNoop::waitUntilDurable(opCtx);
}

TEST_F(ReplicationConsistencyMarkersTest, InitialSyncFlag) {
    ReplicationConsistencyMarkersImpl consistencyMarkers(
        getStorageInterface(), kMinValidNss, kOplogTruncateAfterPointNss, kInitialSyncIdNss);
    auto opCtx = getOperationContext();
    ASSERT(consistencyMarkers.createInternalCollections(opCtx).isOK());
    consistencyMarkers.initializeMinValidDocument(opCtx);

            

Reported by Cppcheck.

src/mongo/db/repl/replication_coordinator_impl_elect_v1.cpp
1 issues
Boolean value assigned to pointer.
Error

Line: 61 CWE codes: 587

                      if (_dismissed) {
            return;
        }
        LOGV2(21434, "Lost election", "isDryRun"_attr = _isDryRun);
        _replCoord->_topCoord->processLoseElection();
        const auto electionState = _replCoord->_electionState.get();
        if (_isDryRun && electionState->_electionDryRunFinishedEvent.isValid()) {
            _replCoord->_replExecutor->signalEvent(electionState->_electionDryRunFinishedEvent);
        }

            

Reported by Cppcheck.

src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp
1 issues
syntax error
Error

Line: 119

                  std::unique_ptr<MockNetwork> _mock;
};

TEST(LastVote, LastVoteAcceptsUnknownField) {
    auto lastVoteBSON =
        BSON("candidateIndex" << 1 << "term" << 2 << "_id" << 3 << "unknownField" << 1);
    auto lastVoteSW = LastVote::readFromLastVote(lastVoteBSON);
    ASSERT_OK(lastVoteSW.getStatus());
    ASSERT_BSONOBJ_EQ(lastVoteSW.getValue().toBSON(), BSON("term" << 2 << "candidateIndex" << 1));

            

Reported by Cppcheck.

src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp
1 issues
syntax error
Error

Line: 59

              using executor::RemoteCommandRequest;
using executor::RemoteCommandResponse;

TEST(ReplSetHeartbeatArgs, AcceptsUnknownField) {
    ReplSetHeartbeatArgsV1 hbArgs;
    hbArgs.setConfigTerm(1);
    hbArgs.setConfigVersion(1);
    hbArgs.setHeartbeatVersion(1);
    hbArgs.setTerm(1);

            

Reported by Cppcheck.

src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp
1 issues
syntax error
Error

Line: 61

              
typedef ReplicationCoordinator::ReplSetReconfigArgs ReplSetReconfigArgs;

TEST_F(ReplCoordTest, NodeReturnsNotYetInitializedWhenReconfigReceivedPriorToInitialization) {
    // start up but do not initiate
    init();
    start();
    BSONObjBuilder result;
    ReplSetReconfigArgs args;

            

Reported by Cppcheck.

src/mongo/db/repl/replication_coordinator_impl_test.cpp
1 issues
syntax error
Error

Line: 138

                  return replCoord->awaitHelloResponse(newOpCtx.get(), horizonParams, topologyVersion, deadline);
}

TEST_F(ReplCoordTest, IsMasterIsFalseDuringStepdown) {
    BSONObj configObj = BSON("_id"
                             << "mySet"
                             << "version" << 1 << "members"
                             << BSON_ARRAY(BSON("_id" << 1 << "host"
                                                      << "node1:12345")

            

Reported by Cppcheck.

src/mongo/db/repl/replication_process_test.cpp
1 issues
syntax error
Error

Line: 77

                  return cc().makeOperationContext();
}

TEST_F(ReplicationProcessTest, ServiceContextDecorator) {
    auto serviceContext = getServiceContext();
    ASSERT_FALSE(ReplicationProcess::get(serviceContext));
    ReplicationProcess* replicationProcess = new ReplicationProcess(
        _storageInterface.get(),
        std::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()),

            

Reported by Cppcheck.

src/mongo/db/repl/replication_recovery_test.cpp
1 issues
syntax error
Error

Line: 411

                  _assertDocumentsInCollectionEqualsUnordered(opCtx, testNs, expectedColl);
}

TEST_F(ReplicationRecoveryTest, RecoveryWithNoOplogSucceeds) {
    ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
    auto opCtx = getOperationContext();

    // Create the database.
    ASSERT_OK(getStorageInterface()->createCollection(

            

Reported by Cppcheck.

src/mongo/db/repl/reporter_test.cpp
1 issues
syntax error
Error

Line: 237

                  ASSERT_EQUALS(reporter->join(), reporter->trigger());
}

TEST(UpdatePositionArgs, AcceptsUnknownField) {
    UpdatePositionArgs updatePositionArgs;
    BSONObjBuilder bob;
    bob.append(UpdatePositionArgs::kCommandFieldName, 1);
    bob.append(UpdatePositionArgs::kUpdateArrayFieldName, BSONArray());
    bob.append("unknownField", 1);  // append an unknown field.

            

Reported by Cppcheck.

src/mongo/db/repl/roll_back_local_operations_test.cpp
1 issues
syntax error
Error

Line: 68

                  return std::make_pair(makeOp(seconds, term, wallClockMillis), RecordId(++recordId));
}

TEST(RollBackLocalOperationsTest, InvalidLocalOplogIterator) {
    class InvalidOplogInterface : public OplogInterface {
    public:
        std::string toString() const override {
            return "";
        }

            

Reported by Cppcheck.