Rewords additional code comments as complete sentences

This commit is contained in:
BinaryAlley committed 2026-09-13 20:40:46 +03:00
1 parent 36e43b7999
commit 871644b3c9
23 files changed
+171 -140

No files matched your search

@@ -20,7 +20,7 @@ internal sealed class ValidationRuleForEach<TRequest, TItem> : IValidationRule<T
private readonly List<Error> _instanceAwarePredicateErrors = [];
private Error currentError = Error.Validation();
private Func<TRequest, bool>? condition;
private bool lastAddedPredicateIsInstanceAware;
private bool isLastAddedPredicateInstanceAware;
private AbstractValidator<TItem>? _childValidator;
/// <summary>
@@ -41,7 +41,7 @@ internal sealed class ValidationRuleForEach<TRequest, TItem> : IValidationRule<T
{
_predicates.Add(predicate);
_predicateErrors.Add(currentError);
lastAddedPredicateIsInstanceAware = false;
isLastAddedPredicateInstanceAware = false;
return this;
}
@@ -54,7 +54,7 @@ internal sealed class ValidationRuleForEach<TRequest, TItem> : IValidationRule<T
{
_instanceAwarePredicates.Add(predicate);
_instanceAwarePredicateErrors.Add(currentError);
lastAddedPredicateIsInstanceAware = true;
isLastAddedPredicateInstanceAware = true;
return this;
}
@@ -76,12 +76,12 @@ 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 (lastAddedPredicateIsInstanceAware && _instanceAwarePredicateErrors.Count > 0)
if (isLastAddedPredicateInstanceAware && _instanceAwarePredicateErrors.Count > 0)
_instanceAwarePredicateErrors[^1] = validationError;
else if (!lastAddedPredicateIsInstanceAware && _predicateErrors.Count > 0)
else if (!isLastAddedPredicateInstanceAware && _predicateErrors.Count > 0)
_predicateErrors[^1] = validationError;
return this;
}
@@ -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;