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

style: format code with dotnet-format #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion EntityFrameworkCore/RegexValueObjectEfCoreConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public RegexValueObjectEfCoreConverter()
vo => vo.ToString(),
v =>
IsValid(v) ? From(v) : Empty
) { }
)
{ }

public static TValueObject Empty => (TValueObject)typeof(TValueObject).GetProperty("Empty")!.GetValue(null)!;

Expand Down
8 changes: 4 additions & 4 deletions src/ConstrainedFloat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ConstrainedFloat(float value, float[] range)
{
Range = range;
Value = value;
if(!range.Contains(value))
if (!range.Contains(value))
{
throw new ArgumentOutOfRangeException(nameof(value), $"Value must be within the following values: {Join(", ", range)}.");
}
Expand All @@ -57,12 +57,12 @@ public ConstrainedFloat(float value, float[] range)

public override string ToString() => Value.ToString();

public static cfloat Parse (string s, IFormatProvider? provider) => float.Parse(s, provider);
public static cfloat Parse(string s, IFormatProvider? provider) => float.Parse(s, provider);

public static bool TryParse (string? s, IFormatProvider? provider, out cfloat result)
public static bool TryParse(string? s, IFormatProvider? provider, out cfloat result)
{
var bResult = float.TryParse(s, Globalization.NumberStyles.Any, provider, out var floatResult);
result = bResult ? new (floatResult) : default;
result = bResult ? new(floatResult) : default;
return bResult;
}
}
8 changes: 4 additions & 4 deletions src/OpenApiRegistrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* Copyright © 2022 David G. Moore, Jr., All Rights Reserved
* License: MIT (https://opensource.org/licenses/MIT)
*/
*/
#if NETSTANDARD2_0_OR_GREATER

namespace Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -36,7 +36,7 @@ public static IServiceCollection Describe<T>(this IServiceCollection services)
{
services.ConfigureSwaggerGen(options =>
{
#if NET7_0_OR_GREATER
#if NET7_0_OR_GREATER
options.SchemaGeneratorOptions.CustomTypeMappings[typeof(T)] = () =>
new OpenApiSchema
{
Expand Down Expand Up @@ -83,7 +83,7 @@ public static IServiceCollection Describe<T>(this IServiceCollection services)
}
: null
};
#else
#else
throw new PlatformNotSupportedException(
"This feature is not supported by this framework. Upgrade to .NET 7.0 or higher to use it."
);
Expand All @@ -95,7 +95,7 @@ public static IServiceCollection Describe<T>(this IServiceCollection services)
// Description = typeof(T).GetRuntimeProperty(nameof(IRegexValueObject<ObjectId>.Description)).GetValue(null) as string,
// Example = new OpenApiString(typeof(T).GetRuntimeProperty(nameof(IRegexValueObject<ObjectId>.ExampleValue)).GetValue(null).ToString())
// };
#endif
#endif
});
return services;
}
Expand Down