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

@@ -73,7 +73,7 @@ public class BookEntity : IStorageEntity, IAuditableEntity
public ReleaseCountry? ReleaseCountry { get; set; }
/// <summary>
/// Gets or sets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
/// Gets or sets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0").
/// </summary>
public string? ReleaseVersion { get; set; }
@@ -141,7 +141,7 @@ public class BookEntity : IStorageEntity, IAuditableEntity
/// Gets or sets the volume or book number in the series, if applicable.
/// </summary>
public float? VolumeNumber { get; set; }
// TODO: uncomment when series is implemented
// TODO: uncomment when series is implemented.
/// <summary>
/// Gets or sets the series id, if the book is part of a series.
/// </summary>
@@ -21,7 +21,7 @@ internal sealed class ValidationRule<TRequest, TProperty> : IValidationRule<TReq
private readonly List<Func<TProperty, bool>> _predicates = [];
private readonly List<Error> _predicateErrors = [];
// instance-aware predicates get their own separate pair of lists instead of being merged into the
// Instance-aware predicates get their own separate pair of lists instead of being merged into the
// lists above, because they have a different delegate signature (TRequest, TProperty) vs (TProperty).
// Keeping them separate avoids wrapping every plain predicate in an adapter, just to fit one shape.
private readonly List<Func<TRequest, TProperty, bool>> _instanceAwarePredicates = [];
@@ -132,7 +132,7 @@ internal sealed class ValidationRule<TRequest, TProperty> : IValidationRule<TReq
/// <returns>The <see cref="Error"/> of every predicate that fails; empty if the rule passes.</returns>
public IEnumerable<Error> Validate(TRequest instance)
{
// evaluate the condition first, if it returns false, skip validation entirely.
// Evaluate the condition first, if it returns false, skip validation entirely.
if (condition is not null && !condition(instance))
yield break;
@@ -76,7 +76,7 @@ internal sealed class ValidationRuleForEach<TRequest, TItem> : IValidationRule<T
/// <returns>The current <see cref="IRuleBuilder{TRequest, TItem}"/> instance for method chaining.</returns>
public IRuleBuilder<TRequest, TItem> WithError(Error error)
{
// validation rules always produce validation errors, regardless of the error type of the source error
// Validation rules always produce validation errors, regardless of the error type of the source error.
Error validationError = Error.Validation(description: error.Description);
currentError = validationError;
if (isLastAddedPredicateInstanceAware && _instanceAwarePredicateErrors.Count > 0)
@@ -106,7 +106,7 @@ internal sealed class ValidationRuleForEach<TRequest, TItem> : IValidationRule<T
/// <returns>One <see cref="Error"/> per failing predicate, per item; empty if every item passes.</returns>
public IEnumerable<Error> Validate(TRequest instance)
{
// evaluate the condition first, if it returns false, skip validation entirely.
// Evaluate the condition first, if it returns false, skip validation entirely.
if (condition is not null && !condition(instance))
yield break;
@@ -218,7 +218,7 @@ public static class TrackEntityMapping
repositoryEntity.ReleaseCountry,
repositoryEntity.ReleaseVersion
);
// language and original language make sense only if their subproperties have values
// Language and original language make sense only if their subproperties have values.
LanguageInfoDto? languageInfo = !string.IsNullOrWhiteSpace(repositoryEntity.LanguageCode) ||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageName) ||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageNativeName)
@@ -48,7 +48,7 @@ public static class LibraryMapping
{
Id = scanId.Value,
LibraryId = domainEntity.Id.Value,
UserId = domainEntity.UserId.Value, // rest of properties will be populated by EF Core
UserId = domainEntity.UserId.Value, // Rest of properties will be populated by EF Core.
Status = default,
User = null!,
Library = null!,
@@ -199,7 +199,7 @@ public static class BookEntityMapping
repositoryEntity.ReleaseCountry,
repositoryEntity.ReleaseVersion
);
// language and original language make sense only if their subproperties have values
// Language and original language make sense only if their subproperties have values.
LanguageInfoDto? languageInfoEntity = !string.IsNullOrWhiteSpace(repositoryEntity.LanguageCode) ||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageName) ||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageNativeName)
@@ -65,7 +65,7 @@ internal static class ApplicationHandlerTelemetry
{
activity?.SetStatus(ActivityStatusCode.Error, error);
RecordOutcome(activity, handlerName, handlerType, duration, isSuccess: false);
// business-rule failures are routine outcomes (e.g. failed logins), so log at Debug to avoid noise from high-frequency handlers
// Business-rule failures are routine outcomes (e.g. failed logins), so log at Debug to avoid noise from high-frequency handlers.
logger.LogDebug("Failed handling {HandlerType} {HandlerName} in {DurationMs}ms: {Error}", handlerType, handlerName, duration.TotalMilliseconds, error);
}
@@ -38,7 +38,7 @@ public class LibraryScanJobProgressChangedDomainEventHandler : IDomainEventHandl
public async ValueTask HandleAsync(LibraryScanJobProgressChangedDomainEvent domainEvent, CancellationToken cancellationToken)
{
_mediaLibrariesScanProgressTracker.UpdateScanJobProgress(domainEvent.LibraryId, domainEvent.MediaLibraryScanCompositeId, domainEvent.Progress);
// notify SignalR clients that the library scan progress changed
// Notify SignalR clients that the library scan progress changed.
await _debouncedLibraryScanProgressNotifier.SendLibraryProgressUpdateEventAsync(domainEvent.MediaLibraryScanCompositeId, cancellationToken).ConfigureAwait(false);
}
}
@@ -38,7 +38,7 @@ public class LibraryScanProgressChangedDomainEventHandler : IDomainEventHandler<
public async ValueTask HandleAsync(LibraryScanProgressChangedDomainEvent domainEvent, CancellationToken cancellationToken)
{
_mediaLibrariesScanProgressTracker.UpdateScanProgress(domainEvent.LibraryId, domainEvent.MediaLibraryScanCompositeId);
// notify SignalR clients that the library scan progress changed
// Notify SignalR clients that the library scan progress changed.
await _debouncedLibraryScanProgressNotifier.SendLibraryProgressUpdateEventAsync(domainEvent.MediaLibraryScanCompositeId, cancellationToken).ConfigureAwait(false);
}
}
@@ -63,7 +63,7 @@ public class GetThemeAssetQueryHandler : IQueryHandler<GetThemeAssetQuery, Resul
Result<ThemeAssetDto> assetResult = await _themeService.GetAssetAsync(theme.ThemeId, query.AssetPath!, cancellationToken).ConfigureAwait(false);
if (assetResult.IsFailure)
{
// the stored files of a bundled theme removed externally are restored, so its assets keep being served
// The stored files of a bundled theme removed externally are restored, so its assets keep being served.
if (theme.InstallSource == ThemeInstallSource.Bundled)
{
Result<Success> restoreResult = await _themeService.RestoreBundledThemeAsync(theme.ThemeId, cancellationToken).ConfigureAwait(false);
@@ -84,7 +84,7 @@ public class RecoverPasswordCommandHandler : ICommandHandler<RecoverPasswordComm
return Errors.Authentication.InvalidTotpCode;
// Generate the hash of a temporary password and record when it was created, so that the reset flow can expire it after 15 minutes.
getUserResult.Value.TempPassword = Uri.EscapeDataString(_hashService.HashString("Abcd123$")); // TODO: Replace the hardcoded password with a randomly generated one.
getUserResult.Value.TempPassword = Uri.EscapeDataString(_hashService.HashString("Abcd123$")); // TODO: replace the hardcoded password with a randomly generated one.
getUserResult.Value.TempPasswordCreated = DateTime.UtcNow;
// Update the user and persist the temporary password.
@@ -116,7 +116,7 @@ public class RegisterUserCommandHandler : ICommandHandler<RegisterUserCommand, R
if (saveChangesResult.IsFailure)
return saveChangesResult.Errors;
// TODO: Insert the default admin profile preferences when they are implemented.
// TODO: insert the default admin profile preferences when they are implemented.
// If 2FA was enabled, the TOTP secret needs to be delivered to the client unencrypted, so it can be displayed.
return new RegistrationResponse(user.Id, user.Username, totpSecret);
}
@@ -21,7 +21,7 @@ public class RegisterUserCommandValidator : AbstractValidator<RegisterUserComman
.WithError(Errors.Authentication.UsernameCannotBeEmpty)
.Length(3, 255)
.WithError(Errors.Authentication.UsernameMustBeBetween3And255CharactersLong)
.Matches("^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]$") // only allow letters, numbers, dots, underscores and hyphens, and must start and end with letter or number
.Matches("^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]$") // Only allow letters, numbers, dots, underscores and hyphens, and must start and end with letter or number.
.WithError(Errors.Authentication.InvalidUsername);
RuleFor(command => command.Password)
@@ -24,7 +24,7 @@ public class UpdateUserRoleAndPermissionsCommandValidator : AbstractValidator<Up
.Must(id => id != Guid.Empty)
.WithError(DomainErrors.Users.UserIdCannotBeEmpty);
// validate each permission Id when the list is provided
// Validate each permission Id when the list is provided.
RuleForEach(command => command.Permissions)
.NotEmpty()
.WithError(ApplicationErrors.Authorization.PermissionIdCannotBeEmpty)