Skip to content

CSHARP-5610: Cleanup unnecessary whitespaces in the codebase #1707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/MongoDB.Driver.Benchmarks/BenchmarkResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public BenchmarkResult(BenchmarkReport benchmarkReport)
Name = Categories.Contains(DriverBenchmarkCategory.BulkWriteBench)
? benchmarkReport.BenchmarkCase.Descriptor.WorkloadMethod.Name
: benchmarkReport.BenchmarkCase.Descriptor.Type.Name;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git blame has difficulties blaming this type of space changes. Git fundamentally sees this as creating a new empty line without spaces and deleting an old line with spaces rather than simply modifying the existing line. As such, git blame will fail to ignore it this change.

dataSetSize = (int)benchmarkReport.BenchmarkCase.Parameters["BenchmarkDataSetSize"];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class DriverBenchmarkCategory
public const string ReadBench = "ReadBench";
public const string SingleBench = "SingleBench";
public const string WriteBench = "WriteBench";

// not included in AllCategories as it's not part of the benchmarking spec
public const string BulkWriteBench = "BulkWriteBench";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public void Setup()
for (var i = 0; i < 10000; i++)
{
var collectionName = __collectionNamespaces[i % __collectionNamespaces.Length];

_clientBulkWriteMixedOpsModels.Add(new BulkWriteInsertOneModel<BsonDocument>(collectionName, smallDocument.DeepClone().AsBsonDocument));
_clientBulkWriteMixedOpsModels.Add(new BulkWriteReplaceOneModel<BsonDocument>(collectionName, FilterDefinition<BsonDocument>.Empty, smallDocument.DeepClone().AsBsonDocument));
_clientBulkWriteMixedOpsModels.Add(new BulkWriteDeleteOneModel<BsonDocument>(collectionName, FilterDefinition<BsonDocument>.Empty));

_collectionBulkWriteMixedOpsModels.Add(new InsertOneModel<BsonDocument>(smallDocument.DeepClone().AsBsonDocument));
_collectionBulkWriteMixedOpsModels.Add(new ReplaceOneModel<BsonDocument>(FilterDefinition<BsonDocument>.Empty, smallDocument.DeepClone().AsBsonDocument));
_collectionBulkWriteMixedOpsModels.Add(new DeleteOneModel<BsonDocument>(FilterDefinition<BsonDocument>.Empty));
Expand All @@ -63,13 +63,13 @@ public void Setup()
public void BeforeTask()
{
_client.DropDatabase(MongoConfiguration.PerfTestDatabaseName);

_database = _client.GetDatabase(MongoConfiguration.PerfTestDatabaseName);
foreach (var collectionName in __collectionNamespaces)
{
_database.CreateCollection(collectionName.Split('.')[1]);
}

_collection = _database.GetCollection<BsonDocument>(MongoConfiguration.PerfTestCollectionName);
}

Expand All @@ -78,7 +78,7 @@ public void SmallDocCollectionBulkWriteMixedOpsBenchmark()
{
_collection.BulkWrite(_collectionBulkWriteMixedOpsModels, new());
}

[Benchmark]
public void SmallDocClientBulkWriteMixedOpsBenchmark()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class LargeDocBulkInsertBenchmark
private BsonDocument[] _largeDocuments;
private InsertOneModel<BsonDocument>[] _collectionBulkWriteInsertModels;
private BulkWriteInsertOneModel<BsonDocument>[] _clientBulkWriteInsertModels;

private static readonly CollectionNamespace __collectionNamespace =
CollectionNamespace.FromFullName($"{MongoConfiguration.PerfTestDatabaseName}.{MongoConfiguration.PerfTestCollectionName}");

Expand Down Expand Up @@ -63,13 +63,13 @@ public void InsertManyLargeBenchmark()
{
_collection.InsertMany(_largeDocuments, new());
}

[Benchmark]
public void LargeDocCollectionBulkWriteInsertBenchmark()
{
_collection.BulkWrite(_collectionBulkWriteInsertModels, new());
}

[Benchmark]
public void LargeDocClientBulkWriteInsertBenchmark()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public void InsertManySmallBenchmark()
{
_collection.InsertMany(_smallDocuments, new());
}

[Benchmark]
public void SmallDocCollectionBulkWriteInsertBenchmark()
{
_collection.BulkWrite(_collectionBulkWriteInsertModels, new());
}

[Benchmark]
public void SmallDocClientBulkWriteInsertBenchmark()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace MongoDB.Bson
/// </summary>
public class DuplicateBsonMemberMapAttributeException : BsonException
{
// constructors
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="DuplicateBsonMemberMapAttributeException" /> class.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/MongoDB.Bson/IO/BsonBinaryReaderSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public UTF8Encoding Encoding
}

/// <summary>
/// Gets or sets whether to fix occurrences of the old binary subtype on input.
/// Gets or sets whether to fix occurrences of the old binary subtype on input.
/// </summary>
public bool FixOldBinarySubTypeOnInput
{
Expand All @@ -89,7 +89,7 @@ public bool FixOldBinarySubTypeOnInput
}

/// <summary>
/// Gets or sets whether to fix occurrences of the old representation of DateTime.MaxValue on input.
/// Gets or sets whether to fix occurrences of the old representation of DateTime.MaxValue on input.
/// </summary>
public bool FixOldDateTimeMaxValueOnInput
{
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Bson/IO/ByteBufferStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public override void WriteCString(string value)
{
// Compare to 128 to preserve original behavior
const int maxLengthToUseCStringUtf8EncodingWith = 128;

if (maxLength <= maxLengthToUseCStringUtf8EncodingWith)
{
using var rentedBuffer = ThreadStaticBuffer.RentBuffer(maxLengthToUseCStringUtf8EncodingWith);
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Bson/IO/InputBufferChunkSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public int MaxUnpooledChunkSize
get { return _maxUnpooledChunkSize; }
}

// methods
// methods
/// <inheritdoc/>
public void Dispose()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public override IEnumerator<BsonElement> GetEnumerator()
/// Returns a hash code for this instance.
/// </summary>
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// </returns>
public override int GetHashCode()
{
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Bson/Serialization/BinaryVectorReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ TExpectedItem[] AsTypedArrayOrThrow<TExpectedItem>()
return result;
}
}

private static float[] ReadSinglesArrayLittleEndian(ReadOnlySpan<byte> span)
{
if ((span.Length & 3) != 0)
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Bson/Serialization/BinaryVectorWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static byte[] WriteToBytes<TItem>(ReadOnlySpan<TItem> vectorData, BinaryV
switch (binaryVectorDataType)
{
case BinaryVectorDataType.Float32:
var length = vectorData.Length * 4;
var length = vectorData.Length * 4;
var result = new byte[2 + length];
result[0] = (byte)binaryVectorDataType;
result[1] = padding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private BsonSerializationContext(

// public properties
/// <summary>
/// Gets a function that, when executed, will indicate whether the type
/// Gets a function that, when executed, will indicate whether the type
/// is a dynamic type.
/// </summary>
public Func<Type, bool> IsDynamicType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public static void Register(string name, IConventionPack conventions, Func<Type,
/// Removes the conventions specified by the given name.
/// </summary>
/// <param name="name">The name.</param>
/// <remarks>Removing a convention allows the removal of the special __defaults__ conventions
/// and the __attributes__ conventions for those who want to completely customize the
/// <remarks>Removing a convention allows the removal of the special __defaults__ conventions
/// and the __attributes__ conventions for those who want to completely customize the
/// experience.</remarks>
public static void Remove(string name)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private bool PropertyMatchesSomeCreatorParameter(BsonClassMap classMap, Property
var constructors = GetUsableConstructors(classTypeInfo);
foreach (var constructorInfo in constructors)
{
if (classTypeInfo.IsAbstract ||
if (classTypeInfo.IsAbstract ||
constructorInfo.IsFamily || // protected
constructorInfo.IsFamilyOrAssembly) // protected internal
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace MongoDB.Bson.Serialization.IdGenerators
{
/// <summary>
/// A GUID generator that generates GUIDs in ascending order. To enable
/// A GUID generator that generates GUIDs in ascending order. To enable
/// an index to make use of the ascending nature make sure to use
/// <see cref="GuidRepresentation.Standard">GuidRepresentation.Standard</see>
/// as the storage representation.
Expand Down Expand Up @@ -62,7 +62,7 @@ public static AscendingGuidGenerator Instance
/// Generates an ascending Guid for a document. Consecutive invocations
/// should generate Guids that are ascending from a MongoDB perspective
/// </summary>
/// <param name="container">The container of the document (will be a
/// <param name="container">The container of the document (will be a
/// MongoCollection when called from the driver). </param>
/// <param name="document">The document it was generated for.</param>
/// <returns>A Guid.</returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace MongoDB.Bson.Serialization.Serializers
/// Serializer for <see cref="ExpandoObject"/>.
/// </summary>
/// <remarks>
/// The use of <see cref="ExpandoObject"/> will serialize any <see cref="List{Object}"/> without type information.
/// The use of <see cref="ExpandoObject"/> will serialize any <see cref="List{Object}"/> without type information.
/// To get the best experience out of using an <see cref="ExpandoObject"/>, any member wanting to be used
/// as an array should use <see cref="List{Object}"/>.
/// </remarks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public IEnumerableDeserializingAsCollectionSerializer<TIEnumerable, TItem, TColl
}

// explicit interface implementations
IBsonSerializer IChildSerializerConfigurable.ChildSerializer => ItemSerializer;
IBsonSerializer IChildSerializerConfigurable.ChildSerializer => ItemSerializer;

IBsonSerializer IChildSerializerConfigurable.WithChildSerializer(IBsonSerializer childSerializer)
=> WithItemSerializer((IBsonSerializer<TItem>)childSerializer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace MongoDB.Driver.Authentication.Gssapi.Sspi
/// Flags for EncryptMessage.
/// </summary>
/// <remarks>
/// See the fQOP parameter at
/// See the fQOP parameter at
/// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375378(v=vs.85).aspx.
/// </remarks>
internal enum EncryptQualityOfProtection : uint
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/Authentication/SaslMapParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace MongoDB.Driver.Authentication
/// "SCRAM is a SASL mechanism whose client response and server challenge
/// messages are text-based messages containing one or more attribute-
/// value pairs separated by commas. Each attribute has a one-letter
/// name."
/// name."
/// </summary>
internal static class SaslMapParser
{
Expand Down
12 changes: 6 additions & 6 deletions src/MongoDB.Driver/Authentication/SaslPrepHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static string SaslPrep(string str, bool allowUnassigned)

/// <summary>
/// Return true if the given <paramref name="ch"/> is an ASCII control character as defined by
/// <a href="https://tools.ietf.org/html/rfc3454#appendix-C.2.1">RFC 3454, Appendix C.2.1</a>.
/// <a href="https://tools.ietf.org/html/rfc3454#appendix-C.2.1">RFC 3454, Appendix C.2.1</a>.
/// </summary>
/// <param name="ch">The character.</param>
/// <returns>Whether the given character is an ASCII control character.</returns>
Expand Down Expand Up @@ -187,7 +187,7 @@ private static int CharCount(int codepoint)

/// <summary>
/// Return true if the given <paramref name="codepoint"/> is inappropriate for canonical representation
/// characters as defined by <a href="https://tools.ietf.org/html/rfc3454#appendix-C.7">RFC 3454, Appendix C.7</a>.
/// characters as defined by <a href="https://tools.ietf.org/html/rfc3454#appendix-C.7">RFC 3454, Appendix C.7</a>.
/// </summary>
/// <param name="codepoint">The Unicode character's codepoint.</param>
/// <returns>True if the codepoint is inappropriate for canonical.</returns>
Expand Down Expand Up @@ -647,7 +647,7 @@ private static bool IsSurrogateCodepoint(int codepoint)

/// <summary>
/// Return true if the given <paramref name="ch"/> is a "commonly mapped to nothing" character as defined by
/// <a href="https://tools.ietf.org/html/rfc3454#appendix-B.1">RFC 3454, Appendix B.1</a>.
/// <a href="https://tools.ietf.org/html/rfc3454#appendix-B.1">RFC 3454, Appendix B.1</a>.
/// </summary>
/// <param name="ch">The character.</param>
/// <returns>Whether the given character is a "commonly mapped to nothing" character.</returns>
Expand All @@ -669,7 +669,7 @@ private static bool MappedToNothing(char ch)

/// <summary>
/// Return true if the given <paramref name="codepoint"/> is a non-ASCII control character as defined by
/// <a href="https://tools.ietf.org/html/rfc3454#appendix-C.2.2">RFC 3454, Appendix C.2.2</a>.
/// <a href="https://tools.ietf.org/html/rfc3454#appendix-C.2.2">RFC 3454, Appendix C.2.2</a>.
/// </summary>
/// <param name="codepoint">The Unicode character's codepoint.</param>
/// <returns>Whether the given character is a non-ASCII control character.</returns>
Expand All @@ -695,7 +695,7 @@ private static bool NonAsciiControl(int codepoint)

/// <summary>
/// Return true if the given <paramref name="ch"/> is a non-ASCII space character as defined by
/// <a href="https://tools.ietf.org/html/rfc3454#appendix-C.1.2">RFC 3454, Appendix C.1.2</a>.
/// <a href="https://tools.ietf.org/html/rfc3454#appendix-C.1.2">RFC 3454, Appendix C.1.2</a>.
/// </summary>
/// <param name="ch">The character.</param>
/// <returns>Whether the given character is a non-ASCII space character.</returns>
Expand Down Expand Up @@ -752,7 +752,7 @@ private static bool PrivateUse(int codepoint)

/// <summary>
/// Return true if the given <paramref name="codepoint"/> is a prohibited character as defined by
///<a href="https://tools.ietf.org/html/rfc4013#section-2.3">RFC 4013, Section 2.3</a>.
///<a href="https://tools.ietf.org/html/rfc4013#section-2.3">RFC 4013, Section 2.3</a>.
/// </summary>
/// <param name="codepoint">The Unicode character's codepoint.</param>
/// <returns>Whether the codepoint is a prohibited character.</returns>
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/Core/Bindings/CoreSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public void StartTransaction(TransactionOptions transactionOptions = null)
throw new InvalidOperationException("Transactions do not support unacknowledged write concerns.");
}

_currentTransaction?.UnpinAll(); // unpin data if any when a new transaction is started
_currentTransaction?.UnpinAll(); // unpin data if any when a new transaction is started
_currentTransaction = new CoreTransaction(transactionNumber, effectiveTransactionOptions);
}

Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/Core/Clusters/ClusterClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void AdvanceClusterTime(BsonDocument newClusterTime)
_clusterTime = GreaterClusterTime(_clusterTime, newClusterTime);
}
}

internal sealed class NoClusterClock : IClusterClock
{
public BsonDocument ClusterTime => null;
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/Core/Clusters/ElectionId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public bool Equals(ElectionId other)
/// Returns a hash code for this instance.
/// </summary>
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// </returns>
public override int GetHashCode()
{
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/Core/Clusters/IClusterClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace MongoDB.Driver.Core.Clusters
internal interface IClusterClock
{
BsonDocument ClusterTime { get; }

void AdvanceClusterTime(BsonDocument newClusterTime);
}
}
4 changes: 2 additions & 2 deletions src/MongoDB.Driver/Core/Compression/ICompressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public enum CompressorType
/// </summary>
Snappy = 1,
/// <summary>
/// The content of the message is compressed using zlib.
/// The content of the message is compressed using zlib.
/// </summary>
Zlib = 2,
/// <summary>
/// The content of the message is compressed using zstandard.
/// The content of the message is compressed using zstandard.
/// </summary>
ZStandard = 3
}
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB.Driver/Core/Compression/ZlibCompressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace MongoDB.Driver.Core.Compression
{
/// <summary>
/// Compressor according to the zlib algorithm.
/// </summary>
/// </summary>
internal sealed class ZlibCompressor : ICompressor
{
private readonly CompressionLevel _compressionLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace MongoDB.Driver.Core.Events.Diagnostics
/// </summary>
public sealed class PerformanceCounterEventSubscriber : IEventSubscriber
{
//static
//static
/// <summary>
/// Installs the performance counters.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace MongoDB.Driver.Core.Events
{
/// <summary>
/// Subscribes methods with a single argument to events
/// Subscribes methods with a single argument to events
/// of that single argument's type.
/// </summary>
public sealed class ReflectionEventSubscriber : IEventSubscriber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ private static void AddSdamTemplates()
LogLevel.Trace,
CmapCommonParams(Description),
(e, _) => GetParams(e.ServerId, "Server description changed", e.NewDescription));
}
}
}
}
Loading
Loading