diff --git a/.editorconfig b/.editorconfig index ba257f5c..4264c50d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ -# Version: 2.1.0 (Using https://semver.org/) -# Updated: 2021-03-03 +# Version: 3.0.0 (Using https://semver.org/) +# Updated: 2021-08-09 # See https://github.com/RehanSaeed/EditorConfig/releases for release notes. # See https://github.com/RehanSaeed/EditorConfig for updates to this file. # See http://EditorConfig.org for more information about .editorconfig files. @@ -48,7 +48,7 @@ indent_size = 2 trim_trailing_whitespace = false # Web Files -[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,svg,vue}] +[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,pcss,svg,vue}] indent_size = 2 # Batch Files @@ -97,7 +97,7 @@ dotnet_style_readonly_field = true:warning dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning # Expression-level preferences dotnet_style_object_initializer = true:warning dotnet_style_collection_initializer = true:warning @@ -121,7 +121,10 @@ dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning # If you use StyleCop, you'll need to disable SA1636: File header copyright text should match. # dotnet_diagnostic.SA1636.severity = none # Undocumented -dotnet_style_operator_placement_when_wrapping = end_of_line +dotnet_style_operator_placement_when_wrapping = end_of_line:warning +csharp_style_prefer_null_check_over_type_check = true:warning +dotnet_style_namespace_match_folder = true:suggestion +dotnet_diagnostic.IDE0130.severity = suggestion # C# Style Rules # https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules diff --git a/Benchmarks/Serilog.Exceptions.Benchmark/Properties/AssemblyInfo.cs b/Benchmarks/Serilog.Exceptions.Benchmark/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..9aacec97 --- /dev/null +++ b/Benchmarks/Serilog.Exceptions.Benchmark/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] diff --git a/Directory.Build.props b/Directory.Build.props index 212a4ea1..5afce8ba 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,6 +3,7 @@ latest true + AllEnabledByDefault latest enable en-GB diff --git a/Source/Serilog.Exceptions.EntityFrameworkCore/Destructurers/DbUpdateExceptionDestructurer.cs b/Source/Serilog.Exceptions.EntityFrameworkCore/Destructurers/DbUpdateExceptionDestructurer.cs index 7db2447e..905773d1 100644 --- a/Source/Serilog.Exceptions.EntityFrameworkCore/Destructurers/DbUpdateExceptionDestructurer.cs +++ b/Source/Serilog.Exceptions.EntityFrameworkCore/Destructurers/DbUpdateExceptionDestructurer.cs @@ -28,14 +28,10 @@ public override void Destructure( var dbUpdateException = (DbUpdateException)exception; var entriesValue = dbUpdateException.Entries? .Select( -#pragma warning disable IDE0050 // Convert to tuple e => new -#pragma warning restore IDE0050 // Convert to tuple { EntryProperties = e.Properties.Select( -#pragma warning disable IDE0050 // Convert to tuple p => new -#pragma warning restore IDE0050 // Convert to tuple { PropertyName = p.Metadata.Name, p.OriginalValue, diff --git a/Source/Serilog.Exceptions.EntityFrameworkCore/Properties/AssemblyInfo.cs b/Source/Serilog.Exceptions.EntityFrameworkCore/Properties/AssemblyInfo.cs index fb51532b..9aacec97 100644 --- a/Source/Serilog.Exceptions.EntityFrameworkCore/Properties/AssemblyInfo.cs +++ b/Source/Serilog.Exceptions.EntityFrameworkCore/Properties/AssemblyInfo.cs @@ -1,3 +1,5 @@ -using System.Runtime.CompilerServices; +using System; +using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] \ No newline at end of file +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] diff --git a/Source/Serilog.Exceptions.MsSqlServer/Properties/AssemblyInfo.cs b/Source/Serilog.Exceptions.MsSqlServer/Properties/AssemblyInfo.cs index fb51532b..9aacec97 100644 --- a/Source/Serilog.Exceptions.MsSqlServer/Properties/AssemblyInfo.cs +++ b/Source/Serilog.Exceptions.MsSqlServer/Properties/AssemblyInfo.cs @@ -1,3 +1,5 @@ -using System.Runtime.CompilerServices; +using System; +using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] \ No newline at end of file +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] diff --git a/Source/Serilog.Exceptions.SqlServer/Properties/AssemblyInfo.cs b/Source/Serilog.Exceptions.SqlServer/Properties/AssemblyInfo.cs index fb51532b..9aacec97 100644 --- a/Source/Serilog.Exceptions.SqlServer/Properties/AssemblyInfo.cs +++ b/Source/Serilog.Exceptions.SqlServer/Properties/AssemblyInfo.cs @@ -1,3 +1,5 @@ -using System.Runtime.CompilerServices; +using System; +using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] \ No newline at end of file +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] diff --git a/Source/Serilog.Exceptions/Destructurers/TaskCanceledExceptionDestructurer.cs b/Source/Serilog.Exceptions/Destructurers/TaskCanceledExceptionDestructurer.cs index 06f7134d..921dded0 100644 --- a/Source/Serilog.Exceptions/Destructurers/TaskCanceledExceptionDestructurer.cs +++ b/Source/Serilog.Exceptions/Destructurers/TaskCanceledExceptionDestructurer.cs @@ -54,9 +54,7 @@ internal static object DestructureTask( if (task.IsFaulted && task.Exception is not null) { -#pragma warning disable IDE0050 // Convert to tuple return new -#pragma warning restore IDE0050 // Convert to tuple { task.Id, Status = taskStatus, @@ -65,9 +63,7 @@ internal static object DestructureTask( }; } -#pragma warning disable IDE0050 // Convert to tuple return new -#pragma warning restore IDE0050 // Convert to tuple { task.Id, Status = taskStatus, diff --git a/Source/Serilog.Exceptions/Filters/CompositeExceptionPropertyFilter.cs b/Source/Serilog.Exceptions/Filters/CompositeExceptionPropertyFilter.cs index 88a8d680..c2ef6ff6 100644 --- a/Source/Serilog.Exceptions/Filters/CompositeExceptionPropertyFilter.cs +++ b/Source/Serilog.Exceptions/Filters/CompositeExceptionPropertyFilter.cs @@ -19,7 +19,9 @@ public class CompositeExceptionPropertyFilter : IExceptionPropertyFilter /// filters was empty or filter at index {i} is null. public CompositeExceptionPropertyFilter(params IExceptionPropertyFilter[] filters) { +#pragma warning disable CA1508 // This warning should not occur and is fixed in .NET 6. if (filters is null) +#pragma warning restore CA1508 // This warning should not occur and is fixed in .NET 6. { throw new ArgumentNullException(nameof(filters)); } diff --git a/Source/Serilog.Exceptions/Properties/AssemblyInfo.cs b/Source/Serilog.Exceptions/Properties/AssemblyInfo.cs index fb51532b..9aacec97 100644 --- a/Source/Serilog.Exceptions/Properties/AssemblyInfo.cs +++ b/Source/Serilog.Exceptions/Properties/AssemblyInfo.cs @@ -1,3 +1,5 @@ -using System.Runtime.CompilerServices; +using System; +using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] \ No newline at end of file +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] diff --git a/Source/Serilog.Exceptions/Reflection/ReflectionPropertyInfo.cs b/Source/Serilog.Exceptions/Reflection/ReflectionPropertyInfo.cs index 8ba3c121..2039eb2c 100644 --- a/Source/Serilog.Exceptions/Reflection/ReflectionPropertyInfo.cs +++ b/Source/Serilog.Exceptions/Reflection/ReflectionPropertyInfo.cs @@ -95,7 +95,9 @@ public void MarkNameWithTypeNameIfRedefinesThatProperty(ReflectionPropertyInfo o } } +#pragma warning disable CA1801 // This warning should not occur and is fixed in .NET 6. private static bool IsSubTypeOf(Type possibleSubType, Type possibleBaseType) => +#pragma warning restore CA1801 // This warning should not occur and is fixed in .NET 6. #if NETSTANDARD1_3 || NETSTANDARD1_6 possibleBaseType.GetTypeInfo().IsSubclassOf(possibleBaseType); #else diff --git a/Source/Serilog.Exceptions/TypeExtensions.cs b/Source/Serilog.Exceptions/TypeExtensions.cs index 5f93ff92..85cdb480 100644 --- a/Source/Serilog.Exceptions/TypeExtensions.cs +++ b/Source/Serilog.Exceptions/TypeExtensions.cs @@ -94,4 +94,4 @@ public static TypeCode GetTypeCode(this Type type) public static TypeCode GetTypeCode(this Type type) => Type.GetTypeCode(type); #endif } -} \ No newline at end of file +} diff --git a/Tests/Serilog.Exceptions.Test/Destructurers/ReflectionBasedDestructurerTest.cs b/Tests/Serilog.Exceptions.Test/Destructurers/ReflectionBasedDestructurerTest.cs index 0915c79e..7c6fcc18 100644 --- a/Tests/Serilog.Exceptions.Test/Destructurers/ReflectionBasedDestructurerTest.cs +++ b/Tests/Serilog.Exceptions.Test/Destructurers/ReflectionBasedDestructurerTest.cs @@ -9,7 +9,6 @@ namespace Serilog.Exceptions.Test.Destructurers using Serilog.Exceptions.Core; using Serilog.Exceptions.Destructurers; using Xunit; - using Xunit.Abstractions; using static LogJsonOutputUtils; public class ReflectionBasedDestructurerTest diff --git a/Tests/Serilog.Exceptions.Test/Properties/AssemblyInfo.cs b/Tests/Serilog.Exceptions.Test/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..9aacec97 --- /dev/null +++ b/Tests/Serilog.Exceptions.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")] diff --git a/Tools/ExceptionFinderTool/Properties/AssemblyInfo.cs b/Tools/ExceptionFinderTool/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..9aacec97 --- /dev/null +++ b/Tools/ExceptionFinderTool/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Runtime.CompilerServices; + +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Serilog.Exceptions.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001007320f17cde01a37b8b3dff91961943f76893c63352544608de15974586e17739e0b232cdc8cc8762b40d988a21522024abca8116605ed1c8958f350bc6ca4594aa1ca61c1906d85ee76df8d9b404ffd65a5f6efeddd486bddd5b74ff9a7449af0dc9d43da753a3023b20ca616e8313e82a18719b6551f37c45c8d8e4e4cf9bac")]