diff --git a/.globalconfig b/.globalconfig new file mode 100644 index 0000000..8377e78 --- /dev/null +++ b/.globalconfig @@ -0,0 +1,50 @@ +is_global = true + +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0003.md +dotnet_diagnostic.Proj0003.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0010.md +dotnet_diagnostic.Proj0010.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0020.md +dotnet_diagnostic.Proj0020.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0039.md +dotnet_diagnostic.Proj0039.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0040.md +dotnet_diagnostic.Proj0040.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0043.md +dotnet_diagnostic.Proj0043.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0048.md +dotnet_diagnostic.Proj0048.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0200.md +dotnet_diagnostic.Proj0200.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0201.md +dotnet_diagnostic.Proj0201.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0202.md +dotnet_diagnostic.Proj0202.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0205.md +dotnet_diagnostic.Proj0205.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0206.md +dotnet_diagnostic.Proj0206.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0208.md +dotnet_diagnostic.Proj0208.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0216.md +dotnet_diagnostic.Proj0216.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0240.md +dotnet_diagnostic.Proj0240.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0243.md +dotnet_diagnostic.Proj0243.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0400.md +dotnet_diagnostic.Proj0400.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0453.md +dotnet_diagnostic.Proj0453.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0501.md +# TODO: https://github.com/Suchiman/SerilogAnalyzer/issues/64 +dotnet_diagnostic.Proj0501.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj0800.md +dotnet_diagnostic.Proj0800.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj1003.md +dotnet_diagnostic.Proj1003.severity = suggestion +# https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/blob/main/docs/rules/Proj3000.md +dotnet_diagnostic.Proj3000.severity = suggestion + +# TODO: https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/issues/611 +dotnet_diagnostic.Proj1001.severity = suggestion diff --git a/assets/icon.png b/assets/icon.png index 438c1c1..f973da2 100644 Binary files a/assets/icon.png and b/assets/icon.png differ diff --git a/src/Benchmarks/Benchmarks.csproj b/src/Benchmarks/Benchmarks.csproj index fc83790..f52239e 100644 --- a/src/Benchmarks/Benchmarks.csproj +++ b/src/Benchmarks/Benchmarks.csproj @@ -3,7 +3,7 @@ Exe net10.0 - $(NoWarn);1591 + $(NoWarn);CS1591 false @@ -12,7 +12,7 @@ - + diff --git a/src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj b/src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj index d7c01ba..2d640c4 100644 --- a/src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj +++ b/src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj @@ -2,29 +2,27 @@ net10.0;net462 - net10.0 + net10.0 false - $(NoWarn);1591 + $(NoWarn);CS1591 $(DefineConstants);CODE_GENERATION_ATTRIBUTES + + + + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + \ No newline at end of file diff --git a/src/Destructurama.Attributed.Tests/LogWithNameAttributeTests.cs b/src/Destructurama.Attributed.Tests/LogWithNameAttributeTests.cs index 6df87c1..f5b2d98 100644 --- a/src/Destructurama.Attributed.Tests/LogWithNameAttributeTests.cs +++ b/src/Destructurama.Attributed.Tests/LogWithNameAttributeTests.cs @@ -10,7 +10,7 @@ public class LogWithNameAttributeTests { [TestCase("John Doe")] [TestCase(null)] - public void AttributesAreConsultedWhenDestructuring(string name) + public void AttributesAreConsultedWhenDestructuring(string? name) { var customized = new PersonalData { diff --git a/src/Destructurama.Attributed.Tests/Support/DelegatingSink.cs b/src/Destructurama.Attributed.Tests/Support/DelegatingSink.cs index a8c00b5..d504e0d 100644 --- a/src/Destructurama.Attributed.Tests/Support/DelegatingSink.cs +++ b/src/Destructurama.Attributed.Tests/Support/DelegatingSink.cs @@ -15,6 +15,7 @@ public DelegatingSink(Action write) public void Emit(LogEvent logEvent) => _write(logEvent); + [System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "Serilog004:Constant MessageTemplate verifier", Justification = "tests")] public static LogEvent Execute(object obj, string messageTemplate = "Here is {@Customized}", Action? configure = null) { LogEvent evt = null!; diff --git a/src/Destructurama.Attributed/Attributed/AttributedDestructuringPolicy.cs b/src/Destructurama.Attributed/Attributed/AttributedDestructuringPolicy.cs index 89c2403..39f35e0 100644 --- a/src/Destructurama.Attributed/Attributed/AttributedDestructuringPolicy.cs +++ b/src/Destructurama.Attributed/Attributed/AttributedDestructuringPolicy.cs @@ -47,7 +47,7 @@ public bool TryDestructure(object value, ILogEventPropertyValueFactory propertyV return cached.CanDestructure; } - private IEnumerable GetPropertiesRecursive(Type type) + private static IEnumerable GetPropertiesRecursive(Type type) { var seenNames = new HashSet(); diff --git a/src/Destructurama.Attributed/Attributed/CustomPropertyInfoExtension.cs b/src/Destructurama.Attributed/Attributed/CustomPropertyInfoExtension.cs index c03ae09..87bfc73 100644 --- a/src/Destructurama.Attributed/Attributed/CustomPropertyInfoExtension.cs +++ b/src/Destructurama.Attributed/Attributed/CustomPropertyInfoExtension.cs @@ -20,7 +20,7 @@ public static IEnumerable GetCustomAttributesEx(this PropertyInfo pro var type = propertyInfo.DeclaringType; // Do not check attribute explicitly to not take dependency from System.ComponentModel.Annotations package. - var metadataTypeAttribute = type.GetCustomAttributes(true).Where(t => t.GetType().FullName == "System.ComponentModel.DataAnnotations.MetadataTypeAttribute").FirstOrDefault(); + var metadataTypeAttribute = type.GetCustomAttributes(true).FirstOrDefault(t => t.GetType().FullName == "System.ComponentModel.DataAnnotations.MetadataTypeAttribute"); if (metadataTypeAttribute != null) { var metadataType = (Type)metadataTypeAttribute.GetType().GetProperty("MetadataClassType").GetValue(metadataTypeAttribute, null); diff --git a/src/Destructurama.Attributed/Destructurama.Attributed.csproj b/src/Destructurama.Attributed/Destructurama.Attributed.csproj index de02c90..9bca4ff 100644 --- a/src/Destructurama.Attributed/Destructurama.Attributed.csproj +++ b/src/Destructurama.Attributed/Destructurama.Attributed.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -8,8 +8,11 @@ - + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c1bda18..80acf08 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -11,11 +11,12 @@ Apache-2.0 false icon.png + https://raw.githubusercontent.com/destructurama/attributed/refs/heads/master/assets/icon.png embedded true true - True + true serilog;attributed enable README.md @@ -28,9 +29,14 @@ - - + + + + + + + diff --git a/src/destructurama-attributed.slnx b/src/destructurama-attributed.slnx index b7ef721..85eed51 100644 --- a/src/destructurama-attributed.slnx +++ b/src/destructurama-attributed.slnx @@ -21,6 +21,7 @@ +