Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Mar 6, 2024
1 parent a5fdbc3 commit 0b95091
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 9 deletions.
139 changes: 139 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,142 @@ indent_size = 4
charset = utf-8


# Declare types in namespaces
dotnet_diagnostic.CA1050.severity = None

# Use Literals Where Appropriate
dotnet_diagnostic.CA1802.severity = error

# Do not initialize unnecessarily
dotnet_diagnostic.CA1805.severity = error

# Avoid unsealed attributes
dotnet_diagnostic.CA1813.severity = error

# Test for empty strings using string length
dotnet_diagnostic.CA1820.severity = none

# Remove empty finalizers
dotnet_diagnostic.CA1821.severity = error

# Mark members as static
dotnet_diagnostic.CA1822.severity = error

# Avoid unused private fields
dotnet_diagnostic.CA1823.severity = error

# Avoid zero-length array allocations
dotnet_diagnostic.CA1825.severity = error

# Use property instead of Linq Enumerable method
dotnet_diagnostic.CA1826.severity = error

# Do not use Count()/LongCount() when Any() can be used
dotnet_diagnostic.CA1827.severity = error
dotnet_diagnostic.CA1828.severity = error

# Use Length/Count property instead of Enumerable.Count method
dotnet_diagnostic.CA1829.severity = error

# Prefer strongly-typed Append and Insert method overloads on StringBuilder
dotnet_diagnostic.CA1830.severity = error

# Use AsSpan instead of Range-based indexers for string when appropriate
dotnet_diagnostic.CA1831.severity = error

# Use AsSpan instead of Range-based indexers for string when appropriate
dotnet_diagnostic.CA1831.severity = error
dotnet_diagnostic.CA1832.severity = error
dotnet_diagnostic.CA1833.severity = error

# Use StringBuilder.Append(char) for single character strings
dotnet_diagnostic.CA1834.severity = error

# Prefer IsEmpty over Count when available
dotnet_diagnostic.CA1836.severity = error

# Prefer IsEmpty over Count when available
dotnet_diagnostic.CA1836.severity = error

# Use Environment.ProcessId instead of Process.GetCurrentProcess().Id
dotnet_diagnostic.CA1837.severity = error

# Use Environment.ProcessPath instead of Process.GetCurrentProcess().MainModule.FileName
dotnet_diagnostic.CA1839.severity = error

# Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId
dotnet_diagnostic.CA1840.severity = error

# Prefer Dictionary Contains methods
dotnet_diagnostic.CA1841.severity = error

# Do not use WhenAll with a single task
dotnet_diagnostic.CA1842.severity = error

# Do not use WhenAll/WaitAll with a single task
dotnet_diagnostic.CA1842.severity = error
dotnet_diagnostic.CA1843.severity = error

# Use span-based 'string.Concat'
dotnet_diagnostic.CA1845.severity = error

# Prefer AsSpan over Substring
dotnet_diagnostic.CA1846.severity = error

# Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.CA1847.severity = error

# Prefer static HashData method over ComputeHash
dotnet_diagnostic.CA1850.severity = error

# Possible multiple enumerations of IEnumerable collection
dotnet_diagnostic.CA1851.severity = error

# Unnecessary call to Dictionary.ContainsKey(key)
dotnet_diagnostic.CA1853.severity = error

# Prefer the IDictionary.TryGetValue(TKey, out TValue) method
dotnet_diagnostic.CA1854.severity = error

# Use Span<T>.Clear() instead of Span<T>.Fill()
dotnet_diagnostic.CA1855.severity = error

# Incorrect usage of ConstantExpected attribute
dotnet_diagnostic.CA1856.severity = error

# The parameter expects a constant for optimal performance
dotnet_diagnostic.CA1857.severity = error

# Use StartsWith instead of IndexOf
dotnet_diagnostic.CA1858.severity = error

# Avoid using Enumerable.Any() extension method
dotnet_diagnostic.CA1860.severity = error

# Avoid constant arrays as arguments
dotnet_diagnostic.CA1861.severity = error

# Use the StringComparison method overloads to perform case-insensitive string comparisons
dotnet_diagnostic.CA1862.severity = error

# Prefer the IDictionary.TryAdd(TKey, TValue) method
dotnet_diagnostic.CA1864.severity = error

# Use string.Method(char) instead of string.Method(string) for string with single char
dotnet_diagnostic.CA1865.severity = error
dotnet_diagnostic.CA1866.severity = error
dotnet_diagnostic.CA1867.severity = error

# Unnecessary call to 'Contains' for sets
dotnet_diagnostic.CA1868.severity = error

# Cache and reuse 'JsonSerializerOptions' instances
dotnet_diagnostic.CA1869.severity = error

# Use a cached 'SearchValues' instance
dotnet_diagnostic.CA1870.severity = error


# Microsoft .NET properties
trim_trailing_whitespace = true
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
Expand Down Expand Up @@ -140,6 +276,9 @@ resharper_wrap_before_binary_pattern_op = false
resharper_wrap_object_and_collection_initializer_style = chop_always
resharper_place_simple_initializer_on_single_line = false

# space
resharper_space_around_lambda_arrow = true

dotnet_style_require_accessibility_modifiers = never:error
resharper_place_type_constraints_on_same_line = false
resharper_blank_lines_inside_namespace = 0
Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.Serilog/NServiceBus.Serilog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageReference Include="Fody" Version="6.8.0" PrivateAssets="all" />
<PackageReference Include="NServiceBus" Version="8.1.6" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="ProjectDefaults" Version="1.0.118" PrivateAssets="all" />
<PackageReference Include="ProjectDefaults" Version="1.0.125" PrivateAssets="all" />
<PackageReference Include="Polyfill" Version="3.0.0" PrivateAssets="all" />
<PackageReference Include="System.Memory" Version="4.5.5" Condition="$(TargetFramework) == 'net48'" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" Condition="'$(TargetFramework)' != 'net8.0'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static void AddInitiator(IInvokeHandlerContext context, string messageId, List<L
static void AddResultingMessages(SagaUpdatedMessage sagaAudit, ILogger logger, List<LogEventProperty> properties)
{
var resultingMessages = sagaAudit.ResultingMessages;
if (!resultingMessages.Any())
if (resultingMessages.Count == 0)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
<PackageReference Include="NServiceBus" Version="8.1.6" />
<PackageReference Include="Serilog" Version="3.1.1" />
<ProjectReference Include="..\NServiceBus.Serilog\NServiceBus.Serilog.csproj" />
<PackageReference Include="ProjectDefaults" Version="1.0.118" PrivateAssets="all" />
<PackageReference Include="ProjectDefaults" Version="1.0.125" PrivateAssets="all" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/Shared.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_OPSIGN/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_PATTERN_OP/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_FIRST_METHOD_CALL/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_CHAINED_METHOD_CALLS/@EntryValue">CHOP_ALWAYS</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean>
Expand Down
6 changes: 3 additions & 3 deletions src/Tests/Snippets/TracingUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static Serilog.Core.Logger SerilogTracingLogger()
return tracingLog;
}

void EnableSagaTracing(EndpointConfiguration configuration, ILogger logger)
static void EnableSagaTracing(EndpointConfiguration configuration, ILogger logger)
{
#region EnableSagaTracing

Expand All @@ -41,7 +41,7 @@ void EnableSagaTracing(EndpointConfiguration configuration, ILogger logger)
#endregion
}

void EnableMessageTracing(EndpointConfiguration configuration, ILogger logger)
static void EnableMessageTracing(EndpointConfiguration configuration, ILogger logger)
{
#region EnableMessageTracing

Expand All @@ -51,7 +51,7 @@ void EnableMessageTracing(EndpointConfiguration configuration, ILogger logger)
#endregion
}

void Seq()
static void Seq()
{
#region SerilogTracingSeq

Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Snippets/Usage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#endregion
}

void Seq()
static void Seq()
{
#region SerilogSeq

Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
<PackageReference Include="Serilog.Sinks.Seq" Version="6.0.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<ProjectReference Include="..\NServiceBus.Serilog\NServiceBus.Serilog.csproj" />
<PackageReference Include="ProjectDefaults" Version="1.0.118" PrivateAssets="all" />
<PackageReference Include="ProjectDefaults" Version="1.0.125" PrivateAssets="all" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/TracingSample/TracingSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="NServiceBus.Persistence.NonDurable" Version="1.0.0" />
<ProjectReference Include="..\NServiceBus.Serilog\NServiceBus.Serilog.csproj" />
<PackageReference Include="ProjectDefaults" Version="1.0.118" PrivateAssets="all" />
<PackageReference Include="ProjectDefaults" Version="1.0.125" PrivateAssets="all" />
</ItemGroup>
</Project>

0 comments on commit 0b95091

Please sign in to comment.