Skip to content
Merged
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
50 changes: 50 additions & 0 deletions .globalconfig
Original file line number Diff line number Diff line change
@@ -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
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<NoWarn>$(NoWarn);1591</NoWarn>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Destructurama.Attributed\Destructurama.Attributed.csproj" />
<ProjectReference Include="../Destructurama.Attributed/Destructurama.Attributed.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@

<PropertyGroup>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net10.0;net462</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net10.0</TargetFrameworks>
<TargetFramework Condition="'$(OS)' != 'Windows_NT'">net10.0</TargetFramework>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);1591</NoWarn>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<DefineConstants>$(DefineConstants);CODE_GENERATION_ATTRIBUTES</DefineConstants> <!--Test with LogPropertyIgnoreAttribute requires it.-->
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.4" PrivateAssets="all" />
<PackageReference Include="MarkdownSnippets.MsBuild" Version="27.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Telemetry.Abstractions" Version="10.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit.Analyzers" Version="*" PrivateAssets="All" />
<PackageReference Include="NUnit3TestAdapter" Version="6.0.1" />
<PackageReference Include="PublicApiGenerator" Version="11.5.4" />
<PackageReference Include="Serilog" Version="4.3.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="PublicApiGenerator" Version="11.5.4" />
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MarkdownSnippets.MsBuild" Version="27.0.2" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Destructurama.Attributed\Destructurama.Attributed.csproj" />
<ProjectReference Include="../../src/Destructurama.Attributed\Destructurama.Attributed.csproj" />

Check warning on line 25 in src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj

View workflow job for this annotation

GitHub Actions / windows-latest

<ProjectReference Include> contains backward slashes (https://dotnet-project-file-analyzers.github.io/rules/Proj0023.html)

Check warning on line 25 in src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj

View workflow job for this annotation

GitHub Actions / windows-latest

<ProjectReference Include> contains backward slashes (https://dotnet-project-file-analyzers.github.io/rules/Proj0023.html)

Check warning on line 25 in src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj

View workflow job for this annotation

GitHub Actions / windows-latest

<ProjectReference Include> contains backward slashes (https://dotnet-project-file-analyzers.github.io/rules/Proj0023.html)

Check warning on line 25 in src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj

View workflow job for this annotation

GitHub Actions / windows-latest

<ProjectReference Include> contains backward slashes (https://dotnet-project-file-analyzers.github.io/rules/Proj0023.html)

Check warning on line 25 in src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj

View workflow job for this annotation

GitHub Actions / windows-latest

<ProjectReference Include> contains backward slashes (https://dotnet-project-file-analyzers.github.io/rules/Proj0023.html)

Check warning on line 25 in src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj

View workflow job for this annotation

GitHub Actions / windows-latest

<ProjectReference Include> contains backward slashes (https://dotnet-project-file-analyzers.github.io/rules/Proj0023.html)

Check warning on line 25 in src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj

View workflow job for this annotation

GitHub Actions / windows-latest

<ProjectReference Include> contains backward slashes (https://dotnet-project-file-analyzers.github.io/rules/Proj0023.html)

Check warning on line 25 in src/Destructurama.Attributed.Tests/Destructurama.Attributed.Tests.csproj

View workflow job for this annotation

GitHub Actions / windows-latest

<ProjectReference Include> contains backward slashes (https://dotnet-project-file-analyzers.github.io/rules/Proj0023.html)
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public DelegatingSink(Action<LogEvent> 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<AttributedDestructuringPolicyOptions>? configure = null)
{
LogEvent evt = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public bool TryDestructure(object value, ILogEventPropertyValueFactory propertyV
return cached.CanDestructure;
}

private IEnumerable<PropertyInfo> GetPropertiesRecursive(Type type)
private static IEnumerable<PropertyInfo> GetPropertiesRecursive(Type type)
{
var seenNames = new HashSet<string>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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);
Expand Down
7 changes: 5 additions & 2 deletions src/Destructurama.Attributed/Destructurama.Attributed.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -8,8 +8,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="4.3.0" />
<PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="All" />
<PackageReference Include="Serilog" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Destructurama.Attributed.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100638a43140e8a1271c1453df1379e64b40b67a1f333864c1aef5ac318a0fa2008545c3d35a82ef005edf0de1ad1e1ea155722fe289df0e462f78c40a668cbc96d7be1d487faef5714a54bb4e57909c86b3924c2db6d55ccf59939b99eb0cab6e8a91429ba0ce630c08a319b323bddcbbd509f1afe4ae77a6cbb8b447f588febc3" />
<InternalsVisibleTo Include="Benchmarks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100638a43140e8a1271c1453df1379e64b40b67a1f333864c1aef5ac318a0fa2008545c3d35a82ef005edf0de1ad1e1ea155722fe289df0e462f78c40a668cbc96d7be1d487faef5714a54bb4e57909c86b3924c2db6d55ccf59939b99eb0cab6e8a91429ba0ce630c08a319b323bddcbbd509f1afe4ae77a6cbb8b447f588febc3" />
</ItemGroup>
Expand Down
12 changes: 9 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageIcon>icon.png</PackageIcon>
<PackageIconUrl>https://raw.githubusercontent.com/destructurama/attributed/refs/heads/master/assets/icon.png</PackageIconUrl>
<DebugType>embedded</DebugType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">True</ContinuousIntegrationBuild>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
<PackageTags>serilog;attributed</PackageTags>
<Nullable>enable</Nullable>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand All @@ -28,9 +29,14 @@
</PropertyGroup>

<ItemGroup Condition="'$(IsPackable)' == 'true'">
<None Include="..\..\assets\icon.png" Pack="true" PackagePath="\" Visible="false" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" Visible="false" />
<None Include="../../assets/icon.png" Pack="true" PackagePath="\" Visible="false" />
<None Include="../../README.md" Pack="true" PackagePath="\" Visible="false" />
<PackageReference Include="MinVer" Version="6.1.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="DotNetProjectFile.Analyzers" Version="1.8.0" PrivateAssets="all" />
<PackageReference Include="SerilogAnalyzer " Version="0.15.0" PrivateAssets="all" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/destructurama-attributed.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<File Path="../.editorconfig" />
<File Path="../.gitattributes" />
<File Path="../.gitignore" />
<File Path="../.globalconfig" />
<File Path="../assets/Destructurama.snk" />
<File Path="../assets/icon.png" />
<File Path="../CHANGES.md" />
Expand Down