Skip to content

Commit

Permalink
Automatically linting code
Browse files Browse the repository at this point in the history
  • Loading branch information
rsg-bot authored Jan 1, 2025
1 parent a30beb8 commit 11d83c0
Showing 1 changed file with 53 additions and 53 deletions.
106 changes: 53 additions & 53 deletions src/Conventions/ConventionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,37 @@ public static async ValueTask<IConventionContext> FromAsync(ConventionContextBui
return context;
}

private static ConventionContext FromInitInternal(ConventionContextBuilder builder)
{
var conventions = builder.Require<LoadConventions>();
builder
.AddIfMissing(AssemblyLoadContext.Default)
.AddIfMissing("ExecutingAssembly", conventions.Method.Module.Assembly);
var provider = CreateProvider(builder, conventions);
// ReSharper disable once NullableWarningSuppressionIsUsed
if (builder.state.ServiceProviderFactory is { })
builder.Properties.Set(builder.state.ServiceProviderFactory);
return new(builder, provider);
}
/// <summary>
/// The categories of the convention context
/// </summary>
public ImmutableHashSet<ConventionCategory> Categories { get; set; }

private static ConventionProvider CreateProvider(ConventionContextBuilder builder, LoadConventions loadConventions)
{
var conventions = builder.state.GetConventions();
for (var i = 0; i < conventions.Count; i++)
{
if (conventions[i] is Type type) conventions[i] = ActivatorUtilities.CreateInstance(builder.Properties, type);
}
/// <summary>
/// Gets the configuration.
/// </summary>
public IConfiguration Configuration => this.Get<IConfiguration>() ?? _emptyConfiguration;

conventions.InsertRange(
conventions.FindIndex(z => z is null),
builder.state.CalculateConventions(builder, loadConventions)
);
/// <summary>
/// Get the conventions from the context
/// </summary>
public IConventionProvider Conventions { get; }

return new(builder.GetHostType(), builder.Categories.ToImmutableHashSet(ConventionCategory.ValueComparer), conventions);
}
/// <summary>
/// The host type
/// </summary>
public HostType HostType => this.GetHostType();

Check warning on line 52 in src/Conventions/ConventionContext.cs

View check run for this annotation

Codecov / codecov/patch

src/Conventions/ConventionContext.cs#L52

Added line #L52 was not covered by tests

private static readonly IConfiguration _emptyConfiguration = new ConfigurationBuilder().Build();
/// <summary>
/// A logger that is configured to work with each convention item
/// </summary>
/// <value>The logger.</value>
public ILogger Logger => this.GetOrAdd<ILogger>(() => NullLogger.Instance);

/// <summary>
/// A central location for sharing state between components during the convention building process.
/// </summary>
/// <value>The properties.</value>
public IServiceProviderDictionary Properties { get; }

/// <summary>
/// Creates a base context
Expand All @@ -77,35 +78,34 @@ IConventionProvider conventionProvider
Categories = builder.Categories.ToImmutableHashSet(ConventionCategory.ValueComparer);
}

/// <summary>
/// The host type
/// </summary>
public HostType HostType => this.GetHostType();

/// <summary>
/// The categories of the convention context
/// </summary>
public ImmutableHashSet<ConventionCategory> Categories { get; set; }
private static ConventionProvider CreateProvider(ConventionContextBuilder builder, LoadConventions loadConventions)
{
var conventions = builder.state.GetConventions();
for (var i = 0; i < conventions.Count; i++)
{
if (conventions[i] is Type type) conventions[i] = ActivatorUtilities.CreateInstance(builder.Properties, type);
}

/// <summary>
/// Get the conventions from the context
/// </summary>
public IConventionProvider Conventions { get; }
conventions.InsertRange(
conventions.FindIndex(z => z is null),
builder.state.CalculateConventions(builder, loadConventions)
);

/// <summary>
/// A central location for sharing state between components during the convention building process.
/// </summary>
/// <value>The properties.</value>
public IServiceProviderDictionary Properties { get; }
return new(builder.GetHostType(), builder.Categories.ToImmutableHashSet(ConventionCategory.ValueComparer), conventions);
}

/// <summary>
/// A logger that is configured to work with each convention item
/// </summary>
/// <value>The logger.</value>
public ILogger Logger => this.GetOrAdd<ILogger>(() => NullLogger.Instance);
private static ConventionContext FromInitInternal(ConventionContextBuilder builder)
{
var conventions = builder.Require<LoadConventions>();
builder
.AddIfMissing(AssemblyLoadContext.Default)
.AddIfMissing("ExecutingAssembly", conventions.Method.Module.Assembly);
var provider = CreateProvider(builder, conventions);
// ReSharper disable once NullableWarningSuppressionIsUsed
if (builder.state.ServiceProviderFactory is { })
builder.Properties.Set(builder.state.ServiceProviderFactory);
return new(builder, provider);
}

/// <summary>
/// Gets the configuration.
/// </summary>
public IConfiguration Configuration => this.Get<IConfiguration>() ?? _emptyConfiguration;
private static readonly IConfiguration _emptyConfiguration = new ConfigurationBuilder().Build();

Check warning on line 110 in src/Conventions/ConventionContext.cs

View check run for this annotation

Codecov / codecov/patch

src/Conventions/ConventionContext.cs#L110

Added line #L110 was not covered by tests
}

0 comments on commit 11d83c0

Please sign in to comment.