Formats code comments as sentences in the production sources.

Capitalizes the first word and adds the terminal period across the domain, application, data access, infrastructure, API and web layers and the plugins. No comment is reworded. The change also normalizes the TODO bodies to lowercase, leaves commented-out code untouched, corrects the Threat/Treat typo and the dangling hyphen in the exception middleware, and collapses two accidental repeated terminal periods.
This commit is contained in:
BinaryAlley committed 2026-11-16 18:16:17 +02:00
1 parent 88455fec9c
commit 727aa33318
142 files changed
+403 -403

No files matched your search

@@ -32,9 +32,9 @@ public static class SharedConfiguration
configuration.SetBasePath(basePath);
configuration.AddJsonFile("appsettings.shared.json", optional: false, reloadOnChange: true);
configuration.AddJsonFile("appsettings.shared.development.json", optional: true, reloadOnChange: true);
configuration.AddEnvironmentVariables(); // environment variables should override the configuration files
configuration.AddEnvironmentVariables(); // Environment variables should override the configuration files.
// bind the appsettings sections
// Bind the appsettings sections.
services.AddOptions<DatabaseSettingsDto>()
.Bind(configuration.GetRequiredSection(DatabaseSettingsDto.SECTION_NAME))
.ValidateFluently()
@@ -33,16 +33,16 @@ public static class ExceptionUtilities
/// <returns>A list of exceptions representing the list of inner exception(s) of <paramref name="exception"/>.</returns>
public static IEnumerable<Exception> GetInnerExceptions(this Exception exception, int maximumDepth = 5)
{
// check if there are any more inner exceptions to return
// Check if there are any more inner exceptions to return.
if (exception == null || maximumDepth <= 0)
yield break;
// yield the current level exception itself
// Yield the current level exception itself.
yield return exception;
// if the exception is an AggregateException, treat it differently and get its all exceptions
// If the exception is an AggregateException, treat it differently and get its all exceptions.
if (exception is AggregateException aggregateException)
foreach (Exception? innerException in aggregateException.InnerExceptions.SelectMany(innerException => innerException.GetInnerExceptions(maximumDepth - 1)))
yield return innerException;
// if it's a normal exception, recursively get its list of inner exceptions and yield them
// If it's a normal exception, recursively get its list of inner exceptions and yield them.
foreach (Exception innerException in exception.InnerException?.GetInnerExceptions(maximumDepth - 1) ?? [])
yield return innerException;
}
@@ -23,7 +23,7 @@ public static class OptionsBuilderValidationUtilities
/// <returns>The same <see cref="OptionsBuilder{TOptions}"/> instance, to allow for chaining.</returns>
public static OptionsBuilder<TOptions> ValidateFluently<TOptions>(this OptionsBuilder<TOptions> optionsBuilder) where TOptions : class
{
// register a singleton instance of IValidateOptions<TOptions> using the validator
// Register a singleton instance of IValidateOptions<TOptions> using the validator.
optionsBuilder.Services.AddSingleton<IValidateOptions<TOptions>>(
serviceProvider => new ValidationOptions<TOptions>(optionsBuilder.Name, serviceProvider.GetRequiredService<IValidator<TOptions>>()));
return optionsBuilder;
@@ -41,22 +41,22 @@ public class ValidationOptions<TOptions> : IValidateOptions<TOptions> where TOpt
/// <returns>A <see cref="ValidateOptionsResult"/> that indicates whether the validation was successful or not.</returns>
public ValidateOptionsResult Validate(string? name, TOptions options)
{
// check if the name of the options is specified and matches the provided one
// Check if the name of the options is specified and matches the provided one.
if (Name is not null && Name != name)
return ValidateOptionsResult.Skip;
ArgumentNullException.ThrowIfNull(options, nameof(options)); // don't go further if the options are null
ArgumentNullException.ThrowIfNull(options, nameof(options)); // Don't go further if the options are null.
List<Error> validationResult = _validator.Validate(options); // validate the options using the validator
List<Error> validationResult = _validator.Validate(options); // Validate the options using the validator.
// return a response based on the validation result
// Return a response based on the validation result.
if (validationResult.Count == 0)
return ValidateOptionsResult.Success;
// if the validation fails, collect the error messages
// If the validation fails, collect the error messages.
string[] errors = [.. validationResult.Select(error => $"Options validation failed for '{error.Code}' with error: '{error.Description}'")];
// and return them with a failure result
// And return them with a failure result.
return ValidateOptionsResult.Fail(errors);
}
}
@@ -36,7 +36,7 @@ public class CorsSettingsDtoValidator : AbstractValidator<CorsSettingsDto>
private bool BeValidOrigin(string origin)
{
if (origin == "*")
return true; // wildcard allowed without credentials
return true; // Wildcard allowed without credentials.
return Uri.TryCreate(origin, UriKind.Absolute, out Uri? uri) && (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps) && !origin.EndsWith('/');
}
}