Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force editorconfig + small changes #446

Merged
merged 5 commits into from
Dec 2, 2024
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
7 changes: 0 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@ trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
end_of_line = lf

[*.{csproj,json,config,yml,props}]
indent_size = 2

[*.sh]
end_of_line = lf

[*.{cmd, bat}]
end_of_line = crlf

csharp_style_namespace_declarations = file_scoped:suggestion
11 changes: 6 additions & 5 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Write-Output "build: Build started"

Push-Location $PSScriptRoot
try {
if(Test-Path .\artifacts) {
if (Test-Path .\artifacts) {
Write-Output "build: Cleaning ./artifacts"
Remove-Item ./artifacts -Force -Recurse
}
Expand All @@ -28,8 +28,9 @@ try {
Write-Output "build: Package version suffix is $suffix"
Write-Output "build: Build version suffix is $buildSuffix"

& dotnet format --no-restore --verify-no-changes --severity error
& dotnet build -c Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
if($LASTEXITCODE -ne 0) { throw "Build failed" }
if ($LASTEXITCODE -ne 0) { throw "Build failed" }

foreach ($src in Get-ChildItem src/*) {
Push-Location $src
Expand All @@ -41,7 +42,7 @@ try {
} else {
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts
}
if($LASTEXITCODE -ne 0) { throw "Packaging failed" }
if ($LASTEXITCODE -ne 0) { throw "Packaging failed" }

Pop-Location
}
Expand All @@ -52,7 +53,7 @@ try {
Write-Output "build: Testing project in $test"

& dotnet test -c Release --no-build --no-restore
if($LASTEXITCODE -ne 0) { throw "Testing failed" }
if ($LASTEXITCODE -ne 0) { throw "Testing failed" }

Pop-Location
}
Expand All @@ -65,7 +66,7 @@ try {

foreach ($nupkg in Get-ChildItem artifacts/*.nupkg) {
& dotnet nuget push -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json "$nupkg"
if($LASTEXITCODE -ne 0) { throw "Publishing failed" }
if ($LASTEXITCODE -ne 0) { throw "Publishing failed" }
}

if (!($suffix)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ public static LoggerConfiguration Configuration(
{
var configurationReader = readerOptions switch
{
{ ConfigurationAssemblySource: {} } => GetConfigurationReader(configuration, readerOptions, readerOptions.ConfigurationAssemblySource.Value),
{ Assemblies: {} } => GetConfigurationReader(configuration, readerOptions, readerOptions.Assemblies),
{ ConfigurationAssemblySource: { } } => GetConfigurationReader(configuration, readerOptions, readerOptions.ConfigurationAssemblySource.Value),
{ Assemblies: { } } => GetConfigurationReader(configuration, readerOptions, readerOptions.Assemblies),
_ => GetConfigurationReader(configuration, readerOptions ?? new ConfigurationReaderOptions(), readerOptions?.DependencyContext),
};
return settingConfiguration.Settings(configurationReader);
Expand Down
8 changes: 0 additions & 8 deletions src/Serilog.Settings.Configuration/Properties/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Microsoft.Extensions.Configuration (appsettings.json) support for Serilog.</Description>
<Authors>Serilog Contributors</Authors>
<!-- These must match the Dependencies tab in https://www.nuget.org/packages/microsoft.extensions.configuration at
the target version. -->
<TargetFrameworks>net462;netstandard2.0;net8.0;net9.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>serilog;json;appsettings</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand All @@ -16,15 +15,12 @@
<RootNamespace>Serilog</RootNamespace>
</PropertyGroup>

<ItemGroup>
<Using Remove="System.Net.Http" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="PolySharp" Version="1.13.2" PrivateAssets="All" />
<PackageReference Include="Serilog" Version="4.2.0-*" />
<None Include="..\..\assets\icon.png" Pack="true" PackagePath="" Visible="false" />
<None Include="..\..\README.md" Pack="true" PackagePath="" />
<None Include="..\..\README.md" Pack="true" PackagePath="" Visible="false" />
<InternalsVisibleTo Include="Serilog.Settings.Configuration.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b81894191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066b19485ec" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ObjectArgumentValue(IConfigurationSection section, IReadOnlyCollection<As
// process a nested configuration to populate an Action<> logger/sink config parameter?
var typeInfo = toType.GetTypeInfo();
if (typeInfo.IsGenericType &&
typeInfo.GetGenericTypeDefinition() is {} genericType && genericType == typeof(Action<>))
typeInfo.GetGenericTypeDefinition() is { } genericType && genericType == typeof(Action<>))
{
var configType = typeInfo.GenericTypeArguments[0];
IConfigurationReader configReader = new ConfigurationReader(_section, _configurationAssemblies, resolutionContext);
Expand Down Expand Up @@ -185,14 +185,28 @@ bool TryCallCtor(Type type, Dictionary<string, IConfigurationSection> suppliedAr
}
else
{
return new { ci, args, isCallable = false, matches, stringMatches,
usedArguments = suppliedNames };
return new
{
ci,
args,
isCallable = false,
matches,
stringMatches,
usedArguments = suppliedNames
};
}
}
}

return new { ci, args, isCallable = true, matches, stringMatches,
usedArguments = suppliedNames };
return new
{
ci,
args,
isCallable = true,
matches,
stringMatches,
usedArguments = suppliedNames
};
})
.Where(binding => binding.isCallable)
.OrderByDescending(binding => binding.matches)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET7_0
#if NET9_0

using PublicApiGenerator;
using Shouldly;
Expand All @@ -15,7 +15,7 @@ public void PublicApi_Should_Not_Change_Unintentionally()
new()
{
IncludeAssemblyAttributes = false,
ExcludeAttributes = new[] { "System.Diagnostics.DebuggerDisplayAttribute" },
ExcludeAttributes = [ "System.Diagnostics.DebuggerDisplayAttribute" ],
});

publicApi.ShouldMatchApproved(options => options.WithFilenameGenerator((_, _, fileType, fileExtension) => $"{assembly.GetName().Name!}.{fileType}.{fileExtension}"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static IConfigurationRoot GetConfigRoot(
{
var configBuilder = new ConfigurationBuilder();

configBuilder.AddJsonString(appsettingsJsonLevel ?? "{}");
configBuilder.AddJsonString(appsettingsJsonLevel ?? "{}");
configBuilder.AddJsonString(appsettingsDevelopmentJsonLevel ?? "{}");
configBuilder.Add(new ReloadableConfigurationSource(envVariables ?? new Dictionary<string, string?>()));

Expand Down
4 changes: 0 additions & 4 deletions test/TestDummies/TestDummies.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,4 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
<Using Remove="System.Net.Http" />
</ItemGroup>

</Project>