Skip to content

Commit

Permalink
Format project and enable warning for missing this qualifier
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanGreve committed Oct 27, 2024
1 parent 3896d41 commit ccceced
Show file tree
Hide file tree
Showing 27 changed files with 44 additions and 37 deletions.
15 changes: 11 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ dotnet_sort_system_directives_first = true
file_header_template = unset

# this. and Me. preferences
dotnet_style_qualification_for_event = false:silent
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_event = true:warning
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_method = true:warning
dotnet_style_qualification_for_property = true:warning

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
Expand Down Expand Up @@ -170,6 +170,10 @@ csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion

#### Naming styles ####
[*.{cs,vb}]
Expand Down Expand Up @@ -361,4 +365,7 @@ dotnet_naming_style.s_camelcase.required_prefix = s_
dotnet_naming_style.s_camelcase.required_suffix =
dotnet_naming_style.s_camelcase.word_separator =
dotnet_naming_style.s_camelcase.capitalization = camel_case
tab_width = 4
indent_size = 4
end_of_line = crlf

2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Abstractions/CacheOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ public static implicit operator DistributedCacheEntryOptions(CacheOptions option
SlidingExpiration = options.SlidingExpiration,
};
}
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Abstractions/ICompressionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public interface ICompressionService
byte[] Expand(ReadOnlyMemory<byte> compressedBuffer);

#endregion
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Abstractions/IMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public interface IMessage : INotification
/// This property is intended to provide a unique reference for each message instance.
/// </value>
Guid Id { get; init; }
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Abstractions/IMessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ public interface IMessageBus : IAsyncDisposable
/// Thrown if the channel is closed before a message can be received.
/// </exception>
ValueTask<T?> SubscribeAsync<T>(string channelName, string? topic = default, CancellationToken cancellationToken = default) where T : class, IMessage;
}
}
4 changes: 2 additions & 2 deletions AdvancedSystems.Core.Tests/Common/ArchiveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void TestCompress()
public void TestCompress_ThrowsIfEmpty()
{
// Arrange
byte[] buffer = Enumerable.Empty<byte>().ToArray();
byte[] buffer = Enumerable.Empty<byte>().ToArray();

// Act
void Compress()
Expand Down Expand Up @@ -73,4 +73,4 @@ void Expand()
}

#endregion
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Tests/Common/ObjectSerializerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ public void TestSerializationRoundtrip()
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ public void TestTryAddOptions_FromActionsBuilder()
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ public CachingServiceFixture()
public ICachingService CachingService { get; private set; }

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public CompressionServiceFixture()
public ICompressionService CompressionService { get; private set; }

#endregion
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Tests/Fixtures/MessageBusFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public MessageBusFixture()
public IMessageBus MessageBus { get; private set; }

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ public SerializationServiceFixture()
public ISerializationService SerializationService { get; private set; }

#endregion
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Tests/Models/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ namespace AdvancedSystems.Core.Tests.Models;
internal record Person(string FirstName, string LastName);

[JsonSerializable(typeof(Person), GenerationMode = JsonSourceGenerationMode.Default)]
internal partial class PersonContext : JsonSerializerContext;
internal partial class PersonContext : JsonSerializerContext;
2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Tests/Services/CachingServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ public async Task TestAddCachingService()
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ public async Task TestAddCompressionService()
}

#endregion
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core.Tests/Services/MessageBusTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ public async Task TestAddMessageBus()
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ public async Task TestAddSerializationService()
}

#endregion
}
}
4 changes: 2 additions & 2 deletions AdvancedSystems.Core/Common/Archive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static byte[] Expand(ReadOnlyMemory<byte> compressedBuffer)
{
if (compressedBuffer.IsEmpty) throw new ArgumentException("Buffer to expand cannot be empty.", nameof(compressedBuffer));
using var expandedStream = new MemoryStream();

unsafe
{
fixed (byte* pointer = &compressedBuffer.Span[0])
Expand All @@ -48,4 +48,4 @@ public static byte[] Expand(ReadOnlyMemory<byte> compressedBuffer)

return expandedStream.ToArray();
}
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core/Common/ExceptionFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ public static bool False(Action action)
action();
return false;
}
}
}
4 changes: 2 additions & 2 deletions AdvancedSystems.Core/Common/ObjectSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public static ReadOnlySpan<byte> Serialize<T>(T value, JsonTypeInfo<T> typeInfo)
/// <inheritdoc cref="ISerializationService.Deserialize{T}(byte[], JsonTypeInfo{T})" />
public static T? Deserialize<T>(ReadOnlySpan<byte> buffer, JsonTypeInfo<T> typeInfo) where T : class
{
return JsonSerializer.Deserialize(buffer, typeInfo);
return JsonSerializer.Deserialize(buffer, typeInfo);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public static partial class ServiceCollectionExtensions
/// </remarks>
public static IServiceCollection TryAddOptions<TOptions>(this IServiceCollection services, IConfigurationSection configurationSection) where TOptions : class
{
bool hasOptions = services.Any(service => service.ServiceType == typeof(IConfigureOptions<TOptions>));
bool isRegistered = services.Any(service => service.ServiceType == typeof(IConfigureOptions<TOptions>));

if (!hasOptions)
if (!isRegistered)
{
services.AddOptions<TOptions>()
.Bind(configurationSection)
Expand Down Expand Up @@ -90,4 +90,4 @@ private static void ValidateOptions<TOptions>(TOptions options) where TOptions :
throw new ValidationException($"Validation failed for options: {string.Join(", ", results.Select(r => r.ErrorMessage))}");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public static IServiceCollection AddSerializationService(this IServiceCollection
services.TryAdd(ServiceDescriptor.Singleton<ISerializationService, SerializationService>());
return services;
}
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core/Extensions/Linq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ public static bool IsNullOrEmpty<T>(this IEnumerable<T> enumerable)
{
return enumerable == null || !enumerable.Any();
}
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core/Services/CachingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ public async ValueTask SetAsync<T>(string key, T value, JsonTypeInfo<T> typeInfo

#endregion

}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core/Services/CompressionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public byte[] Expand(ReadOnlyMemory<byte> compressedBuffer)
}

#endregion
}
}
6 changes: 3 additions & 3 deletions AdvancedSystems.Core/Services/MessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ public async ValueTask PublishAsync<T>(T message, string? topic = default, Cance

if (snapshot.Count == 0) throw new InvalidOperationException($"Unknown topic ('{topic}').");

foreach(var broadcast in snapshot)
foreach (var broadcast in snapshot)
{
this._logger.LogDebug("Publishing {Message} to channel {Channel}.", message, broadcast.Name);
await broadcast.Channel.Writer.WriteAsync(message, cancellationToken);
}
}

/// <inheritdoc />
public async ValueTask<T?> SubscribeAsync<T>(string channelName, string? topic = default, CancellationToken cancellationToken = default) where T: class, IMessage
public async ValueTask<T?> SubscribeAsync<T>(string channelName, string? topic = default, CancellationToken cancellationToken = default) where T : class, IMessage
{
if (!this._broadcasts.TryGetValue(channelName, out Broadcast<IMessage>? broadcast) || broadcast is null)
{
Expand Down Expand Up @@ -103,4 +103,4 @@ public ValueTask DisposeAsync()
}

#endregion
}
}
2 changes: 1 addition & 1 deletion AdvancedSystems.Core/Services/SerializationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public byte[] Serialize<T>(T value, JsonTypeInfo<T> typeInfo) where T : class
}

#endregion
}
}

0 comments on commit ccceced

Please sign in to comment.